在 WinRTXamlToolkit.Controls.Calendar 上突出显示日期 [英] Highlight days on WinRTXamlToolkit.Controls.Calendar

查看:19
本文介绍了在 WinRTXamlToolkit.Controls.Calendar 上突出显示日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 Windows Phone 8.1 (WINRT) 应用程序.我需要在页面中显示日历,其中包含突出显示的日子,例如 holiays.因此,我从 nuget 添加了 WinRT XAML 工具包 - 日历控件.

<块引用>

PM>安装包 WinRTXamlToolkit.Controls.Calendar

<Grid x:Name="LayoutRoot"><WinRT:Calendar Height="500" x:Name="ActivityCalender"></WinRT:日历></网格></页面>

我有两个问题:

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

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

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

解决方案

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

<WinRT:Calendar x:Name="ActivityCalender" Style="{StaticResource CalendarStyle2}" FontSize="36" FontWeight="Normal" Padding="0" CalendarDayButtonStyle="{StaticResource CalendarButtonCustom}" Horizo​​ntalAlignment="Left" VerticalAlignment=顶部"/></视图框>

完成后,您可以从下面的链接下载样式代码.

I wrote a Windows Phone 8.1 (WINRT) App. I need to show Calendar in the page with Highlighted days like holiays. So, I added WinRT XAML Toolkit - Calendar Control from 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>

I have two questions:

1: The calendar control goes out of margin on right side of phone. Where to change template so that it automatically adjusts according to page/frame width? I copied its four xamls and used these as ResourceDictionaries.

2: Another question, I want to highlight some dates (for example, Holidays) by changing the color of their borders. Where shall I bring this color change in XAML? Highlighted dates should be in different color than a selected date. – Also, please tell me how to highlight these dates (for example, Holidays), which method to use ? Highlighting a day removes the previously highlighted day.

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

解决方案

Try to place calendar control inside a Viewbox control and it will automatically fit control according to the Viewbox control provided width & height.

<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>

once done you can download the style code from the link below. Download Style code for WinRT XAML Tooklit Calendar Control - Windows Phone 8.1

and you will get the output link below image. You can also do customization in style.

这篇关于在 WinRTXamlToolkit.Controls.Calendar 上突出显示日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆