Xamarin形成可绑定网格 [英] Xamarin Forms Bindable Grid
问题描述
https://www.linkedin.com/pulse/bindable-grid-xamarin-forms-jonas-frid
GitHub上的来源:
这正是我所需要的,但是它不响应集合中的更改.我正在使用MvvmHelpers,它对所有ListView都适用:
https://github.com/jamesmontemagno/mvvm-helpers
我假设我需要更新TemplatedTableView.cs以响应CollectionChanged事件-我只是不确定如何执行此操作?
您可以尝试 Syncfusion
在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:local="clr-namespace:DataGridDemo;assembly=DataGridDemo"
xmlns:syncfusion="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms"
x:Class="DataGridDemo.Sample">
<ContentPage.BindingContext>
<local:OrderInfoRepository x:Name="viewModel" />
</ContentPage.BindingContext>
<ContentPage.Content>
<syncfusion:SfDataGrid x:Name="dataGrid"
ItemsSource="{Binding OrderInfoCollection}">
</syncfusion:SfDataGrid>
</ContentPage.Content>
</ContentPage>
请确保在绑定集合更新后调用属性更改事件
它具有很多简洁的功能.
I;m working on a Xamarin Forms application and need to be able to bind to a Grid. I came across this article:
https://www.linkedin.com/pulse/bindable-grid-xamarin-forms-jonas-frid
Source on GitHub:
This is exactly what I need, however it doesn't respond to changes in the collection. I'm using MvvmHelpers which works well for all of the ListView's:
https://github.com/jamesmontemagno/mvvm-helpers
I assume I need to update TemplatedTableView.cs to respond to a CollectionChanged event - I'm just not sure how to do this?
You can try the grid provided by Syncfusion
Use in 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:local="clr-namespace:DataGridDemo;assembly=DataGridDemo"
xmlns:syncfusion="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms"
x:Class="DataGridDemo.Sample">
<ContentPage.BindingContext>
<local:OrderInfoRepository x:Name="viewModel" />
</ContentPage.BindingContext>
<ContentPage.Content>
<syncfusion:SfDataGrid x:Name="dataGrid"
ItemsSource="{Binding OrderInfoCollection}">
</syncfusion:SfDataGrid>
</ContentPage.Content>
</ContentPage>
Be sure to call the property changed event after bound collection is updated
It has alot of neat features.
这篇关于Xamarin形成可绑定网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!