If you add hard-coded buttons to your toolbar, you can set ToolBar.ItemContainerStyle to a custom style to get the desired effect.
<ToolBar.ItemContainerStyle> <Style TargetType="Button"> <Setter Property="Width" Value="21" /> <Setter Property="Height" Value="21" /> </Style> </ToolBar.ItemContainerStyle>
If you use ToolBar.ItemsSource, you can instead use ToolBar.ItemTemplate to define a template for the data in your toolbar.
<ToolBar.ItemTemplate> <DataTemplate> <Button Width="21" Height="21" Content="{Binding}" /> </DataTemplate> </ToolBar.ItemTemplate>
Please note that in some cases both of them can be used simultaneously for added flexibility.
This applies not only to the toolbar, but also to all derived ItemsControl.
Good luck,
Kep amun
source share