Dim*_*kis 6 c# xaml resourcedictionary microsoft-metro .net-4.5
我在了解Windows 8 metro应用程序中的一个样式定义时遇到问题.
使用VS创建metro风格应用程序时,还有一个名为的文件夹
共同
创建.在这个文件夹里有一个名为的文件
StandardStyles.xaml
现在,以下代码片段来自此文件:
<!-- Grid-appropriate 250 pixel square item template as seen in the GroupedItemsPage and ItemsPage -->
<DataTemplate x:Key="Standard250x250ItemTemplate">
<Grid HorizontalAlignment="Left" Width="250" Height="250">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding Image}" Stretch="UniformToFill"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
<TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
</StackPanel>
</Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
我在这里不明白的是静态资源定义,例如边界
Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}"
Run Code Online (Sandbox Code Playgroud)
它与您如何使用模板,绑定和资源无关.
ListViewItemPlaceholderBackgroundThemeBrush位于何处?
非常感谢您的帮助.
迪米
小智 7
在Windows 8客户预览中,您可以在以下位置找到包含资源定义的文件(包括ListViewItemPlaceholderBackgroundThemeBrush):
C:\ Program Files(x86)\ Windows Kits\8.0\Include\winrt\xaml\design\themeresources.xaml
这是微软文档中应该出现的令人难以置信的令人沮丧的事情之一,但现在还没有.
ListViewItemPlaceholderBackgroundThemeBrush是系统画笔资源之一.它由Metro"Light"或"Dark"主题定义(无论您选择哪种应用).
您可以在Blend中查看系统画笔的完整列表.(不幸的是,我还没有找到任何方法在代码中枚举它们.似乎没有任何编程方式来检查主题资源.)
以下是一些可以让您进入完整列表的步骤.(当然,如果您已熟悉Blend,则可以缩写步骤.)
系统画笔资源列表将显示在列表框中.

| 归档时间: |
|
| 查看次数: |
2512 次 |
| 最近记录: |