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

How to set icon in WPF DockingManager header?

Platform: WPF |
Control: DockingManager |
Published Date: January 28, 2016 |
Last Revised Date: August 3, 2021

You can add the icon in header of WPF DockingManager windows by attached property Icon and also can be set by code behind using SetIcon method.

XAML

//How to set flash icon in DockingManagerHeader
<Window x:Class="DockingManagerSetIcon.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
                 Title="DockingManager Set Icon" Height="350" Width="525" >
      <Grid>
          <Grid.RowDefinitions>
               <RowDefinition Height="*"/>
               <RowDefinition Height="20"/>
          </Grid.RowDefinitions>        
          <syncfusion:DockingManager Name="docking1" UseDocumentContainer="True" >
              <StackPanel syncfusion:DockingManager.Header="Item1" Name="Item1" syncfusion:DockingManager.State="Document">
                  <syncfusion:DockingManager.Icon>
                      <ImageBrush ImageSource="/F101794_DM_SetIcon;component/Icon/App.ico" />
                  </syncfusion:DockingManager.Icon>
              </StackPanel>
              <ContentControl syncfusion:DockingManager.Header="Item2" Name="Item2" syncfusion:DockingManager.State="Document" />
          </syncfusion:DockingManager>
          <Button Content="SetIcon" Click="Button_Click" Grid.Row="1"/>
      </Grid>
</Window>

C#

//How to set flash icon in DockingManagerHeader
namespace DockingManagerSetIcon
{
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
    }
    private void Button_Click(object sender, RoutedEventArgs e)
    {
       if (docking1.ActiveWindow != null)
       {
          ImageBrush brush=new ImageBrush();
          BitmapImage bi = new BitmapImage();
          StreamResourceInfo sri = Application.GetResourceStream(new Uri(@"Icon/App.ico", UriKind.RelativeOrAbsolute));
          bi.BeginInit();
          bi.StreamSource = sri.Stream;
          bi.EndInit();
          brush.ImageSource = bi;
          DockingManager.SetIcon(docking1.ActiveWindow,brush);
       }
    }
  }
}

 

Adding icon to WPF DockingManager header

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile