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.
Unfortunately, activation email could not send to your email. Please try again.

SetIcon Does Nothing

Thread ID:

Created:

Updated:

Platform:

Replies:

129328 Mar 13,2017 12:24 PM Mar 15,2017 08:52 AM WPF 5
loading
Tags: DockingManager
Wesley Witt
Asked On March 13, 2017 12:24 PM

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:

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

C#:
        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.BeginInit();
            bi.StreamSource = sri.Stream;
            bi.EndInit();
            brush.ImageSource = bi;
            return brush;
        }

        private void CreateNewDockWindow(System.Windows.Controls.ContentControl window, string headerText, string imageName, DockSide side)
        {
            this.dockingManager.BeginInit();
            this.dockingManager.Children.Add(window);
            DockingManager.SetState(window, DockState.Dock);
            DockingManager.SetSide(window, side, DockState.Dock);
            DockingManager.SetHeader(window, headerText);
            DockingManager.SetIcon(window, this.CreateImageBrush(imageName));
            this.dockingManager.EndInit();
        }


Wesley Witt
Replied On March 13, 2017 04:33 PM

Here is a simple app that shows the problem.

Attachment: WpfApp1_b8a27c94.zip

Marimuthu Sivalingam [Syncfusion]
Replied On March 14, 2017 07:37 AM

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

Regards,
Marimuthu S

Wesley Witt
Replied On March 14, 2017 10:18 AM

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?

Wesley Witt
Replied On March 14, 2017 11:08 AM

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

Marimuthu Sivalingam [Syncfusion]
Replied On March 15, 2017 08:52 AM

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.

Regards,
Marimuthu S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;