Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin表单创建可滚动的时间线_Xamarin_Xamarin.forms_Xamarin.android_Xamarin.ios - Fatal编程技术网

Xamarin表单创建可滚动的时间线

Xamarin表单创建可滚动的时间线,xamarin,xamarin.forms,xamarin.android,xamarin.ios,Xamarin,Xamarin.forms,Xamarin.android,Xamarin.ios,我有个问题。我需要以Xamarin的形式创建以下图像: 我做的第一件事是将时间表设置为背景图像,但是它不容易使用。接下来我想到的是一个网格,但是网格不起作用,因为你需要设置一行的高度,你可以有随机的行。我的想法快用完了!:( 我知道这个网站是为了解决编码问题,但我真的很感激,因为我在这个问题上已经坚持了两个星期了,我想进一步利用这个功能 让我知道!:)如果想要创建一个可滚动的时间线,我建议安装nuget来实现这一点 以下是Xaml的日期可滚动时间线示例代码: <?xml version=

我有个问题。我需要以Xamarin的形式创建以下图像:

我做的第一件事是将时间表设置为背景图像,但是它不容易使用。接下来我想到的是一个网格,但是网格不起作用,因为你需要设置一行的高度,你可以有随机的行。我的想法快用完了!:(

我知道这个网站是为了解决编码问题,但我真的很感激,因为我在这个问题上已经坚持了两个星期了,我想进一步利用这个功能


让我知道!:)

如果想要创建一个可滚动的时间线,我建议安装nuget来实现这一点

以下是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"
             xmlns:syncfusion="clr-namespace:Syncfusion.SfCalendar.XForms;assembly=Syncfusion.SfCalendar.XForms"
             xmlns:schedule="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
             x:Class="XamarinTableView.Views.SyncCalendaPage">
    <ContentPage.Content>
        <StackLayout>
            <Label Text="Welcome to Xamarin.Forms!"
                VerticalOptions="Start" 
                HorizontalOptions="CenterAndExpand" />
            <schedule:SfSchedule x:Name="schedule"
                                    BackgroundColor="LightGray"
                                    ScheduleView="DayView" 
                                    VerticalOptions="FillAndExpand"/>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>
其效果是:


也可以参考自定义的更多外观。

有第三方日历控件可以做到这一点-这是一个非常重要的UI,是一个非常棒的类似于日程安排的控件。还有一个,在Xamarin.Forms中搜索日程安排控件,你会发现很多选项。非常感谢!我会看看这些:)不太确定你的“随机行”。但如上图所示,您仍然可以使用GridView,假设每行的高度(1小时)为200。那么第一个事件的高度可以是100,并且VerticalOption=end。第二高度150。第三高度300,RowSpan=2,以此类推。或者只需将半小时设置为一排,然后玩RowSpan。
schedule.ScheduleView = ScheduleView.DayView;
ScheduleAppointmentCollection scheduleAppointmentCollection = new ScheduleAppointmentCollection();
scheduleAppointmentCollection.Add(new ScheduleAppointment()
{
    StartTime = new DateTime(2020, 9, 24, 09, 0, 0),
    EndTime = new DateTime(2020, 9, 24, 09, 30, 0),
    Subject = "Client Meeting",
    Notes="1111",
    MinHeight = 30,
    Color = Color.FromHex("#FFD80073")
});
scheduleAppointmentCollection.Add(new ScheduleAppointment()
{
    StartTime = new DateTime(2020, 9, 24, 11, 0, 0),
    EndTime = new DateTime(2020, 9, 24, 12, 30, 0),
    Subject = "Anniversary",
    Notes = "1111",
    Color = Color.FromHex("#FFA2C139")
});
schedule.DataSource = scheduleAppointmentCollection;

DayViewSettings dayViewSettings = new DayViewSettings();
dayViewSettings.VerticalLineColor = Color.LightGray;
dayViewSettings.VerticalLineStrokeWidth = 5;
schedule.DayViewSettings = dayViewSettings;