简体   繁体   English

自定义WinRT XAML工具包-日历控件

[英]Customise WinRT XAML Toolkit - Calendar Control

I wrote a Windows Phone 8.1 (WINRT) App . 我写了Windows Phone 8.1(WINRT)App I need to show Calendar in the page. 我需要在页面上显示日历 So, I added WinRT XAML Toolkit - Calendar Control from nuget. 因此,我从nuget添加了WinRT XAML工具包-日历控件

PM> Install-Package WinRTXamlToolkit.Controls.Calendar PM>安装包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">

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

How to Customise this Calendar control, example FontWeight,Foreground,Background? 如何自定义此Calendar控件,例如FontWeight,Foreground,Background?

If the properties aren't exposed by the control or template-bound to template part properties - you'll probably need to change the template. 如果控件未公开属性或模板零件属性未将其绑定到模板,则可能需要更改模板。 You can find the default template here and templates for calendar parts are in the same folder: 您可以在此处找到默认模板,日历部件的模板在同一文件夹中:

WinRTXamlToolkit.Controls.Calendar/WinRTXamlToolkit.Controls.Calendar.Shared/Controls/Calendar

You probably have figured out the answer to this but I was facing a similar problem and figured out a solution so I thought I'd post it here for anyone else who faces a similar conundrum. 您可能已经找到了答案,但是我遇到了类似的问题并想出了解决方案,所以我认为我应该将它发布给其他面临类似难题的人。 If the calendar control is going out of the page, you can wrap it inside a Viewbox so that it fits the screen. 如果日历控件不在页面中,则可以将其包装在Viewbox ,使其适合屏幕。 This is how I managed to do it. 这就是我设法做到的方式。

<Viewbox Stretch="Uniform">
    <Grid Height="600" Width="600">
        <toolkit:Calendar HorizontalAlignment="Center" VerticalAlignment="Center" Tapped="Calendar_Tapped"/>
    </Grid>
</Viewbox>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM