我有这个 XAML:
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" />
</ItemsPanelTemplate>
</GroupStyle.Panel>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupItem">
<WrapPanel Orientation="Horizontal">
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" />
<ItemsPresenter Margin="0,0,0,0" VerticalAlignment="Center"/>
</WrapPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="BorderThickness" Value="0,5,10,5"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}"
Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
Color="Transparent" />
</Style.Resources>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<controls:AlignableWrapPanel HorizontalContentAlignment="Center" Width="90" AllowDrop="True">
<Image Height="50" HorizontalAlignment="Center" Width="50" Source="{Binding Path=Icon}"/>
<Label Width="90" HorizontalContentAlignment="Center" Content="{Binding Path=Name}"/>
</controls:AlignableWrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
而且我希望能够将它放在资源目录文件中,以便我可以将它重用于其他类,但我不知道如何将 xaml 转换为包含我需要的样式标签..