2016-09-27 60 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屬性 –

相關問題