3

I am trying to show an image/icon before the title of window, just like in finder. I have used Window.SetTitleWithRepresentedFilename but it just shows a generic icon not that png file I want to show.enter image description here

Faisal Ghaffar
  • 181
  • 2
  • 12
  • Maybe related https://stackoverflow.com/questions/37945767/how-to-change-application-icon-in-xamarin-forms – Hackerman Nov 09 '18 at 16:17

2 Answers2

2
public override void WindowDidLoad()
{
    base.WindowDidLoad();

    Window.RepresentedUrl = new NSUrl(Path.GetFullPath("check.png"));
    var btn = Window.StandardWindowButton(NSWindowButton.DocumentIconButton);
    btn.Image = NSImage.ImageNamed("check");
}
Faisal Ghaffar
  • 181
  • 2
  • 12
0

You cannot show a PNG with this. It shows the finder icon for the type of the file you are pointing to (not the tumbnail). If you put the users home folder in it will show the little 'house' icon

svn
  • 1,235
  • 10
  • 22