【问题标题】:How to develop Horizontal scrolling calendar in Xamarin Forms?如何在 Xamarin Forms 中开发水平滚动日历?
【发布时间】:2019-12-02 16:33:04
【问题描述】:

我想开发我的日历视图,如图所示。是否可以自定义日期选择器?

【问题讨论】:

  • 我认为 datepicker 不可能做到这一点。
  • @JuniorJiang-MSFT,有免费的插件吗?我试过 SyncFusion,它不是免费的。
  • java中有一些方法可以自定义日历视图,例如telerik.com/forums/customization-of-android-calendar-monthview。但是,xamarin需要自定义BoxView才能实现。这需要将java代码翻译成C#代码。

标签: xamarin.forms datepicker custom-renderer


【解决方案1】:

尝试一些类似的代码

<ScrollView Orientation = "Horizontal">
  <ListView x:Name="datePicker"  ItemSelected="OnSelection" IsPullToRefreshEnabled="True" >
    <ListView.ItemTemplate>
       <DataTemplate>
         <ViewCell>
          <StackLayout Orientation = "Vertical" VerticalOptions="Center Padding="5,0,5,0">
            <Label Text="{Binding Date}"/>
            <Label Text="{Binding month}"/>
            <Label Text="{Binding week}" />
          </StackLayout>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>
</ScrollView>

您可以使用项目选择来更改颜色并使用 inotifypropertychanged 为您的网格向量设置新值。

问候

吉尔赫姆·马克斯

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-10
    • 1970-01-01
    • 2019-01-31
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 2018-03-23
    • 1970-01-01
    相关资源
    最近更新 更多