This is the XAML:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<MenuBar Grid.Column="0" Grid.Row="0" RequestedTheme="Dark" VerticalAlignment="Top" HorizontalAlignment="Left" x:Name="TopMenu" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0" Grid.Column="1" Grid.Row="0" >
<FontIcon x:Name="btnDark" Glyph="" Margin="10,0,0,0"/>
<FontIcon x:Name="btnSettings" Glyph="" Margin="10,0,0,0"/>
</StackPanel>
</Grid>
Note that the menu is dynamically created, it's not in the XAML. How can I create the two font icons at the far right ?
Like, for example, Notepad:
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
This will let the first column, the MenuBar
, take the minimum required width, and let the second column, the StackPanel
with FontIcon
s take the rest.
In your case you want the oposite, so:
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>