2016-09-27 63 views
0

我是一个新手到Xamarin.Forms developer,在我的Application我显示calendar视图。为此我用这个https://github.com/rebeccaXam/XamForms.Controls.Calendar插件来做我的应用程序。这个插件(自定义日历)工作正常,只有一个小的UI issue。在显示日历时,它最初将以默认值2013年10月加载,然后在日历中显示当前的Month。请帮我解决这个问题。Xamarin.Controls.Calendar在Xamarin.Forms最初显示2013年10月

DateSelection.xaml

<?xml version="1.0" encoding="UTF-8"?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TestApp.DateSelection" 
     xmlns:i18n="clr-namespace:CareValet;assembly=CareValet" 
     xmlns:controls="clr-namespace:XamForms.Controls;assembly=XamForms.Controls.Calendar"   
     Title="Date Selection"> 
    <ContentPage.Padding> 
     <OnPlatform x:TypeArguments="Thickness" 
         iOS="20, 40, 20, 20" 
         Android="20, 20, 20, 20" 
         WinPhone="20, 20, 20, 20" /> 
     </ContentPage.Padding> 
    <ContentPage.Content> 
     <ScrollView> 
      <RelativeLayout> 

      //.....My Code.... 
        <controls:Calendar x:Name="calender" Padding="10,0,10,0" StartDay="Sunday" DateClicked="DateClicked" 
         RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width,Factor=1,Constant=0}" 
         RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0,Constant=200}" 
         RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=selectDateText, Property=Y, Factor=1, Constant=25}" 
        RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent,Property=Width, Factor=0}"></controls:Calendar> 

      //.....My Code.... 
       </RelativeLayout> 
      </ScrollView> 
    </ContentPage.Content> 
</ContentPage> 

DateSelection.cs

namespace TestApp 
{ 
    public partial class DateSelection : ContentPage 
    { 

     public DateSelection() 
     { 
      InitializeComponent(); 

     } 


     // Selecting Date 
     void DateClicked(object sender, EventArgs e) 
     { 

     /* 

     Doing some operation while date selection 
     */ 


     } 


    } 
} 

回答

0

它看起来像October 2013 is hardcoded。但是,如果您将StartDate属性设置为您喜欢的任何属性,它也会显示为显示的日期。

+0

是否可以在我的项目中删除硬编码文本“OCTOBER 2013”​​? – Jamal

+0

将TitleLabel属性设置为任何你想要的位置,或者像Stephane提到的设置StartDate属性 –

+0

划伤最后的评论,查看标签应当更新相应的代码时设置StartDate属性 –

相关问题