Is there a way to set a string resource as the text for an AppBarButton rather than having to do it programmatically? The method used below doesn't work for some reason.
<Page>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<CommandBar>
<CommandBar.Content>
<Button
Style="{StaticResource NavigationBackButtonNormalStyle}"
Name="BackButton"
VerticalAlignment="Top"
Click="Back_Click"/>
</CommandBar.Content>
<AppBarButton Name="HelloWorld" x:Uid="HelloWorld">
<AppBarButton.Icon>
<FontIcon Glyph=""/>
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
<Frame Name="MyFrame"/>
</Grid>
</Page>
The reason why your code didn't work, maybe related to the Resources.resw
file. Fisrt as Richard Zhang - MSFT said, you need to create a Strings
folder, and create the corresponding localize folder.
In Resources.resw
, new a key/value called HelloWorld.Label
, set value to Hello World!
Be attention, we are setting the AppBarButton
's Label
. If you set the key to "HelloWorld", then nothing happens.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.