如何更改 MS Silverlight 日历控件中蓝色边框的颜色?

发布于 2024-10-12 00:05:40 字数 378 浏览 2 评论 0原文

在 MS Silverlight 日历控件的顶部,它显示月/年以及一些用于滚动的箭头。这些项目后面是一个浅蓝色矩形。我希望能够更改该矩形的颜色。我该怎么做呢?

我的第一个想法是在 Blend 中打开日历控件,选择编辑模板/副本,然后导航到正确的控件,但该路径并不像我希望的那样明显或可能。打开该控件的副本(模板)后,我几乎没有什么可使用的。事实上,它所做的只是允许我更改背景(整个控件,而不仅仅是月份/年份)和边框。嗯。

UI 中还有用于编辑 CalendarButtonStyle、CalendarDayButtonStyle 和 CalendarItemStyle 的选项。 CalendarItemStyle 似乎最接近我想要的,但如果我能弄清楚那个蓝色矩形/边框/面板/其他东西来自哪里,我就该死了?

At the top of the MS Silverlight Calendar control, it displays the month/year and some arrows for scrolling through those. Behind those items is a light blue rectangle. I'd like to be able to change the color of that rectangle. How would I go about doing that?

My first thought was to open the calendar control in Blend, choose to edit a template/copy and just navigate to the correct control, but that path wasn't as obvious nor as possible as I had hoped. Opening a copy (template) of the control left me very little to work with. In fact, all it does is allow me to change the background (for the entire control, not just the month/year) and the border. Hmmm.

There are also options in the UI to edit the CalendarButtonStyle, CalendarDayButtonStyle and CalendarItemStyle. The CalendarItemStyle seems to be closest to what I want, but I'll be damned if I can figure out where that blue rectangle/border/panel/whatever is coming from?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

≈。彩虹 2024-10-19 00:05:40

日历控件的默认背景实际上是从上到下的 4 级线性渐变,它为标题的浅蓝色背景和日历其余部分的白色背景提供颜色。

实际上,您根本不需要模板化控件来调整此背景渐变。您只需将日历的背景设置为 LinearGradientBrush,其停止点的偏移量为 0.16(从日历标题到正文变化的默认百分比)。

以下是 XAML 中的示例,将标题背景从默认的 #FFD3DEE8 更改为黑色:

<controls:Calendar>
    <controls:Calendar.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="Black" Offset="0.16"/>
            <GradientStop Color="#FFFCFCFD" Offset="0.16"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
    </controls:Calendar.Background>
</controls:Calendar>

The default background for the calendar control is actually a 4-stop linear gradient from top to bottom which provides the colors for both the light-blue background to the header and the white background to the rest of the calendar.

You actually don't need to template the control at all to tweak this background gradient. You can just set the background of the calendar to a LinearGradientBrush with the stops at an Offset of 0.16 (the default percentage where it changes from the header to the body of the calendar).

Here is an example in XAML changing the header background from the default of #FFD3DEE8 to black:

<controls:Calendar>
    <controls:Calendar.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="Black" Offset="0.16"/>
            <GradientStop Color="#FFFCFCFD" Offset="0.16"/>
            <GradientStop Color="White" Offset="1"/>
        </LinearGradientBrush>
    </controls:Calendar.Background>
</controls:Calendar>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文