Articles in this section

how to set icon in DropDownmenuitem for SplitButon

SplitButton allows to set icon for DropDownMenuItem by Icon Property.

The same has been explained in the following code snippet:

XAML:

//Code Explains how to set icon in DropDownmenuitem for SplitButon
<Window
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" x:Class="DropDownButton.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<syncfusion:SplitButtonAdv Name="DropDown" Width="150" Height="50" >
<syncfusion:DropDownMenuGroup >
<syncfusion:DropDownMenuItem Header="Item1"   >
<syncfusion:DropDownMenuItem.Icon>
<Image Name="syn" Width="50" Source=”Syncfusion.jpg"  ></Image>
</syncfusion:DropDownMenuItem.Icon>
</syncfusion:DropDownMenuItem>
<syncfusion:DropDownMenuItem Header="Item2">
<syncfusion:DropDownMenuItem.Icon>
<Image Name="sync1" Source="download.jpg" Width="50"></Image>                  </syncfusion:DropDownMenuItem.Icon>
</syncfusion:DropDownMenuItem>
</syncfusion:DropDownMenuGroup>
</syncfusion:SplitButtonAdv>
</Grid>
</Window>

C#:

//Code Explains how to set icon in DropDownmenuitem for SplitButon
namespace DropDownButton
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
BitmapImage bi3 = new BitmapImage();
bi3.BeginInit();
bi3.UriSource = new Uri("Syncfusion.png", UriKind.Relative);
bi3.EndInit();
syn.Source=bi3;
}
}
}

 

Output:

C:\Users\Ashok.Murugesan\Desktop\KBTask\13.4SprintKBTools\ScreenShot\spliticon.png

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