Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stretch ToolbarTray to be the width of its Row

Tags:

wpf

xaml

A toolbar is on the first row. How can you stretch the toolbar to be the width of the entire row?

<Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>

<ToolBarTray Background="Transparent">
        <!--Toolbar.xaml-->
        <ToolBar x:Name="mainToolbar" 
                 Style="{StaticResource mainToolBarStyle}"
                 ItemsSource="{Binding ToolbarItems}"
                 ItemTemplateSelector="{StaticResource toolBarItemTemplateSelector}"
                 DataContext="{Binding}">
        </ToolBar>
    </ToolBarTray>
like image 436
Pacman Avatar asked Dec 21 '22 16:12

Pacman


1 Answers

I removed the ToolbarTray and set HorizontalContentAlignment="Stretch".

like image 178
Pacman Avatar answered Jan 10 '23 10:01

Pacman