WPF ToolBar content alignment


/ Published in: XML
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <ToolBar>
  2. <ToolBar.Resources>
  3. <Style TargetType="{x:Type ToolBarPanel}">
  4. <Setter Property="Orientation" Value="Vertical"/>
  5. </Style>
  6. </ToolBar.Resources>
  7.  
  8. <!-- This is the downside of this solution:
  9. You have to set the height at some level (once)
  10. or you will end up with controls forcing
  11. the toolbar to auto-size until it fills up it's parent -->
  12. <DockPanel Height="48">
  13. <Button Name="ButtonOne" Click=ButtonOne_Click" />
  14. <Button Name="ButtonTwo" Click=ButtonTwo_Click" />
  15. <Button Name="ButtonThree" Click="ButtonThree_Click" HorizontalAlignment="Right" />
  16. </DockPanel>
  17. </ToolBar>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.