Articles in this section
Category / Section

How to set icon in WPF DockingManager header?

1 min read

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

Conclusion

I hope you enjoyed learning about how to set icon in WPF DockingManager header.

You can refer to our WPF DockingManage feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF DockingManager documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied