0

In C#/UWP, how to create a normal "Button" Xaml Control with an AppBarButton Icon?

For Example, I want to do something like this:

    <Grid Grid.Row="1" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>

        <TextBox  Grid.Column="0" Header="MyTextBox"/>
        <Button   Icon="find"
                  Background="{x:Null}"
                  VerticalAlignment="Bottom" 
                  Grid.Column="1"/>
        </Button>
    </Grid>

Or more specifically:

<Button Icon="find"  … />

(Except the Icon Property only works with an AppBarButton)

1 Answer 1

1

Answer:

Set the content of the button equal to:

<SymbolIcon Symbol="find">.

Example:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="auto"/>
    </Grid.ColumnDefinitions>

    <TextBox  Grid.Column="0" Header="MyTextBox"/>

    <Button Grid.Column="1" 
            Background="{x:Null}"
            VerticalAlignment="Bottom">
        <SymbolIcon Symbol="Find"/>
    </Button>

</Grid>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.