在WinRTXamlToolkit.Controls.Calendar上突出显示日期

时间:2015-06-29 05:04:23

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

我写了一个Windows Phone 8.1(WINRT)应用程序。我需要在页面中显示日历,其中包含像holiays这样的突出显示日期。所以,我从nuget添加了WinRT XAML Toolkit - Calendar Control。

var ctaLayer = new google.maps.KmlLayer({
  url: 'http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml'
});
google.maps.event.addListener(ctaLayer,'status_changed', function() {
  if (ctaLayer.getStatus() != OK) {
     alert("error loading KML, status="+ctaLayer.getStatus());
  }
}
ctaLayer.setMap(map);
PM> Install-Package WinRTXamlToolkit.Controls.Calendar

我有两个问题:

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

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

<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 个答案:

答案 0 :(得分:2)

尝试将日历控件放在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

您将获得图像下方的输出链接。您也可以在风格上进行自定义。 enter image description here