Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何创建带有图标的常规按钮_C#_Uwp - Fatal编程技术网

C# 如何创建带有图标的常规按钮

C# 如何创建带有图标的常规按钮,c#,uwp,C#,Uwp,在C#/UWP中,如何创建带有AppBarButton图标的普通“Button”Xaml控件 例如,我想做这样的事情: <Grid Grid.Row="1" > <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="auto"/> </Grid.Col

在C#/UWP中,如何创建带有AppBarButton图标的普通“Button”Xaml控件

例如,我想做这样的事情:

    <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>

或者更具体地说:

<Button Icon="find"  … />

(图标属性仅适用于AppBarButton除外)

回答:

将按钮的内容设置为:

<SymbolIcon Symbol="find">.
例如:

<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>