Próbuję uzyskać możliwość wyboru ikonki i wyświetlenia jej w Image w WPF.
Znalazłem coś takiego, ale nie do końca rozumiem ten kod. Mogę prosić o rozjaśnienie i pomysł jak to teraz wczytać do property Source należącej do obiektu Image? Czym jest ten string(dlaczego string) do którego to pobieramy i jak go 'oczyścić' na obrazek?

            [DllImport("shell32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Winapi)]
            private static extern int PickIconDlg(IntPtr hwndOwner, System.Text.StringBuilder lpstrFile, int nMaxFile, ref int  lpdwIconIndex);
            
            string iconfile;
            int iconindex = 0;
            int retval;
            System.Text.StringBuilder sb;

            iconfile = Environment.GetFolderPath(Environment.SpecialFolder.System);
            iconfile = iconfile + @"\shell32.dll";
            sb = new System.Text.StringBuilder(iconfile, 500);
            retval = PickIconDlg(new WindowInteropHelper(this).Handle, sb, sb.Length, ref iconindex);
            iconfile = sb.ToString();