We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SetIcon Does Nothing

I am trying to get an icon set in the header of my docked windows. After calling SetIcon there is no icon displayed in the header. Is there some other property i need to set?

Here is what I'm going:

        <syncfusion:DockingManager Margin="0" Grid.Row="2" x:Name="dockingManager" />

        private Brush CreateImageBrush(string imageName)
            ImageBrush brush = new ImageBrush();
            BitmapImage bi = new BitmapImage();
            StreamResourceInfo sri = System.Windows.Application.GetResourceStream(new Uri(imageName, UriKind.RelativeOrAbsolute));
            bi.StreamSource = sri.Stream;
            brush.ImageSource = bi;
            return brush;

        private void CreateNewDockWindow(System.Windows.Controls.ContentControl window, string headerText, string imageName, DockSide side)
            DockingManager.SetState(window, DockState.Dock);
            DockingManager.SetSide(window, side, DockState.Dock);
            DockingManager.SetHeader(window, headerText);
            DockingManager.SetIcon(window, this.CreateImageBrush(imageName));

5 Replies

WW Wesley Witt March 13, 2017 08:33 PM UTC

Here is a simple app that shows the problem.

Attachment: WpfApp1_b8a27c94.zip

MS Marimuthu Sivalingam Syncfusion Team March 14, 2017 11:37 AM UTC

Hi Wesley,

Thank you for contacting Syncfusion Support.

We have checked the reported query in your updated sample. We can use SetIcon attached property of DockingManager in Document and Tabbed dock windows only. So, we have prepared the sample to meet your requirement. In this sample, we have edited the HeaderTemplate of DockingManager to set Icon for Dock window. Please find the sample from the following link.

Sample: WpfApp1

Marimuthu S

WW Wesley Witt March 14, 2017 02:18 PM UTC

Thanks for the response.

In looking at the code you posted I see that it does not do exactly the same thing as my code. Specifically the icon is set statically in the xaml. My requirement is to set the icon dynamically via code when the window is created. If the icon is set in the xaml as you provided then every window would have the same icon. I want to have different icons for different windows. I removed the image source from the data template but that doesn't work because the seticon() call does not work. 

How can I achieve my requirement of having a different icon based on the window I'm creating? Is it possible to apply different header templates to each window dynamically when it is created?

WW Wesley Witt March 14, 2017 03:08 PM UTC

I was able to add code that dynamically creates the header template with each window creation (see attached file). Works great.

I suggest adding something like this to your samples.

Attachment: WpfApp1dynamic_48e3f472.zip

MS Marimuthu Sivalingam Syncfusion Team March 15, 2017 12:52 PM UTC

Hi Wesley,

Thank you for your valuable suggestion. Please let us know if you need any further assistance, we will be happy to assist you.

Marimuthu S.

Live Chat Icon For mobile
Up arrow icon