【问题标题】:Highlight days on WinRTXamlToolkit.Controls.Calendar在 WinRTXamlToolkit.Controls.Calendar 上突出显示日期
【发布时间】:2015-06-29 05:04:22
【问题描述】:

我编写了一个 Windows Phone 8.1 (WINRT) 应用程序。我需要在页面中显示日历,突出显示的日子,如节日。因此,我添加了 WinRT XAML Toolkit - 来自 nuget 的日历控件。

PM> Install-Package WinRTXamlToolkit.Controls.Calendar
<Page
x:Class="DrFit.Pages.ActivityTimeTablePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DrFit.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:WinRT="using:WinRTXamlToolkit.Controls"
Background="Black">

    <Grid x:Name="LayoutRoot">       
        <WinRT:Calendar Height="500" x:Name="ActivityCalender">

        </WinRT:Calendar>
    </Grid>
</Page>

我有两个问题:

1:日历控件超出手机右侧的ma​​rgin。在哪里更改模板以使其根据页面/框架宽度自动调整? 我复制了它的四个 xamls 并将它们用作 ResourceDictionaries。

2:另一个问题,我想通过更改边框颜色来突出显示某些日期(例如假期)。我应该在 XAML 中将这种颜色更改带到哪里? 突出显示的日期应该与所选日期的颜色不同。 – 另外,请告诉我如何突出显示这些日期(例如,假期),使用哪种方法? 突出显示一天会删除之前突出显示的一天。

ActivityCalender.SelectedDate = new DateTime(2015, 6, 21);

【问题讨论】:

    标签: c# xaml windows-runtime windows-phone-8.1 winrt-xaml-toolkit


    【解决方案1】:

    尝试将日历控件放置在 Viewbox 控件中,它会根据 Viewbox 控件提供的宽度和高度自动适应控件。

    <Viewbox Width="300" Height="300">
                <WinRT:Calendar  x:Name="ActivityCalender" Style="{StaticResource CalendarStyle2}" FontSize="36" FontWeight="Normal" Padding="0" CalendarDayButtonStyle="{StaticResource CalendarButtonCustom}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </Viewbox>
    

    完成后,您可以从下面的链接下载样式代码。 Download Style code for WinRT XAML Tooklit Calendar Control - Windows Phone 8.1

    您将获得图片下方的输出链接。您还可以进行风格定制。

    【讨论】:

      猜你喜欢
      • 2021-05-03
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 2014-04-26
      • 2016-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多