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
*/
}
}
}
是否可以在我的項目中刪除硬編碼文本「OCTOBER 2013」? – Jamal
將TitleLabel屬性設置爲任何你想要的位置,或者像Stephane提到的設置StartDate屬性 –
劃傷最後的評論,查看標籤應當更新相應的代碼時設置StartDate屬性 –