微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – “ListViewItemPlaceholderBackgroundThemeBrush”位于何处?

我在了解 Windows 8 metro应用程序中的一个样式定义时遇到问题.

使用VS创建metro风格应用程序时,还有一个名为的文件

Common

创建.在这文件夹里有一个名为的文件

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,15,0"/>
            <TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" textwrapping="Nowrap" Margin="15,10"/>
        </StackPanel>
    </Grid>
</DataTemplate>

这里我不明白的是静态资源定义,例如为边界

Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}"

它与您如何使用模板,绑定和资源无关.

ListViewItemPlaceholderBackgroundThemeBrush位于何处?

非常感谢您的帮助.

迪米

解决方法

这是微软文档中应该出现的令人难以置信的令人沮丧的事情之一,但现在还没有.

ListViewItemPlaceholderBackgroundThemeBrush是系统画笔资源之一.它由Metro“Light”或“Dark”主题定义(无论您选择哪种应用).

您可以在Blend中查看系统画笔的完整列表. (不幸的是,我还没有找到任何方法代码中枚举它们.似乎没有任何编程方式来检查主题资源.)

以下是一些可以让您进入完整列表的步骤. (当然,如果您已熟悉Blend,则可以缩写步骤.)

>打开Expression Blend.
>创建一个新项目,然后选择XAML(Windows Metro风格)>空白应用程序(XAML),然后单击确定.
>在设计图面中单击以选择网格. (在左下角的“对象和时间轴”停靠窗口中,“[网格]”行将突出显示.)
>在右上角的属性停靠窗口中,找到“画笔”类别.
>在“背景:无刷子”的正下方,有一排五个按钮.单击最右侧的按钮(“刷子资源”).

系统画笔资源列表将显示在列表框中.

原文地址:https://www.jb51.cc/csharp/92222.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐