Home > OS >  Big button in navigation view. WinUI / xaml
Big button in navigation view. WinUI / xaml

Time:05-16

Does anyone know how to make a big button with subtext and a picture in a navigation panel (using xaml)? Like in the Windows 11 settings app.

Like this...

CodePudding user response:

You can customise the content of a button with <Button.Context> and the Width with the Width property.

Since a button can only have one piece of content, it is best to put everything you need in a StackPanel or Grid.

     <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
    <Button x:Name="BigButton" Width="300">
        <Button.Content>
            <Grid ColumnDefinitions="1*,3*">
                <Image Source="WHERE YOU IMAGE IS"/>
                <StackPanel Orientation="Vertical"
                            Grid.Column="1">
                    <TextBlock FontWeight="Bold" Text="Joe Wood"/>
                    <TextBlock Text="Managing Director"/>
                </StackPanel>
            </Grid>
        </Button.Content></Button>
  • Related