[英]How do I mimic the default template used for a WPF control?
I've got an area (control of type Border) on my window with content that relates to the selected object in a nearby GridView within a ListView. 我的窗口上有一个区域(类型为Border的控件),其内容与ListView附近的GridView中的选定对象相关。
I want the style of that area to match the style (borders and gradients) of the selected ListViewItem. 我希望该区域的样式与所选ListViewItem的样式(边界和渐变)匹配。 The look will depend on the user's operating system and its theme. 外观将取决于用户的操作系统及其主题。
How do I give my box the same look as a list item? 如何给我的盒子和列表项一样的外观?
Mock-up: 小样:
I don't think I fully understand but my guess is that you are talking about the default ListBox selection brush? 我想我不太了解,但是我猜您正在谈论默认的ListBox选择笔刷吗?
That resource is called 该资源称为
{x:Static SystemColors.HighlightBrushKey}
That is the Blue background you show in your mock up. 那就是您在模型中显示的蓝色背景。 If you want to also set the foreground color that is: 如果还要设置前景色,则:
{x:Static SystemColors.HighlightTextBrushKey}
Those two resources will give the system setting for the given user / OS / theme for selection. 这两个资源将为给定的用户/ OS /主题提供系统设置供选择。 Is that what you are after? 那是你的追求吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.