1
在其代表LayoutAwarePage我xy.xaml文件,我有这样的两个元素重用元素(赢商店应用)
<StackPanel x:Name="LeftCommands" Orientation="Horizontal" Grid.Column="2" Margin="0,0,100,0" HorizontalAlignment="Right">
<Button x:Name="BragButton" HorizontalAlignment="Left"/>
</StackPanel>
和
<Page.TopAppBar>
<AppBar x:Name="PageAppBar" Padding="10,0,10,0" Height="120" Opacity="0.98">
<ItemsControl x:Name="groupTopMenuBar" Margin="116,0,40,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,0,0">
<Button Click="UpperMenu_Click"
Style="{StaticResource TextPrimaryButtonStyle}"
Height="Auto" Margin="20,0,20,0"
CommandParameter="{Binding Group.MenuItemID}">
<StackPanel>
<Image Source="{Binding Group.IconURL}" Width="40"
Height="40" VerticalAlignment="Top" Stretch="UniformToFill" />
<TextBlock Text="{Binding Group.Name}" HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}"
Style="{StaticResource TitleTextStyle}" FontSize="16" />
</StackPanel>
</Button>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</AppBar>
</Page.TopAppBar>
我需要使用这些元素我的应用程序的每一页,我不想在应用程序的每个.xaml文件中写这段代码,所以我想问问是否有任何方法如何做到这一点。
谢谢。