zumero / datagrid Goto Github PK
View Code? Open in Web Editor NEWA Xamarin.Forms control for displaying data in rows and columns.
License: Apache License 2.0
A Xamarin.Forms control for displaying data in rows and columns.
License: Apache License 2.0
A user has found a problem using ObservableCollection as the row source for a DataGrid when the type parameter is a subclass of object rather than object itself. The symptom is that no rows get displayed.
Cause of this problem has not yet been isolated. We have previously found similar problems, but the symptoms were different.
The workaround is to set your Rows to a collection of type ObservableCollection.
Here's a replacement for OnAppearing in XamlTest.xaml.cs
protected override void OnAppearing()
{
base.OnAppearing();
Zumero.DataGrid dg = datagrid;
ObservableCollection<WordPair> oc_wordpairs = new ObservableCollection<WordPair>();
ObservableCollection<object> oc_objects= new ObservableCollection<object>();
IList<object> wp_objects = testData.createLotsOfWordPairsWithButtons(dg);
foreach (object o in wp_objects)
{
oc_wordpairs.Add((WordPair)o);
oc_objects.Add(o);
}
//This does not work.
dg.Rows = (IList<object>)oc_wordpairs;
//This works.
//dg.Rows = (IList<object>)oc_objects;
//This works
//dg.Rows = wp_objects;
}
Found a problem wherein scrolling, apparently when other controls are present, is "overwriting" the other controls because the cells are not being clipped properly.
The rowheight should be larger than the header height to see this problem easily. Here's the code for XamlTest.xaml that reproduces the problem. Uncomment the Grid stuff to see it flow out in the horizontal direction as well. Originally seen on Android.
<?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:d="clr-namespace:Zumero;assembly=Zumero.DataGrid"
xmlns:a="clr-namespace:demo;assembly=demo"
x:Class="demo.xaml.XamlTest">
<StackLayout>
<!--<Button x:Name="btnClickMe" Text="Click Me" />
<Button x:Name="btnAlsoClickMe" Text="Also click me" />
<Grid VerticalOptions = "FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>-->
<Label Grid.Column="0" Text="No cells should be drawn over this label while scrolling" BackgroundColor="Blue" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
<d:DataGrid Grid.Column="1" x:Name="datagrid" SelectionMode="Row" BackgroundColor="Pink" ColumnSpacing="2" RowSpacing="2" RowHeight="100" HeaderHeight="50" VerticalOptions = "FillAndExpand">
<d:DataGrid.FrozenColumn>
<d:Column Width="80">
<d:Column.HeaderView>
<Label Text="Corner" BackgroundColor="Yellow"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<Label Text="{Binding Spanish}" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</DataTemplate>
</d:Column.Template>
</d:Column>
</d:DataGrid.FrozenColumn>
<d:DataGrid.Columns>
<d:Column Width="100">
<d:Column.HeaderView>
<Label Text="English" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<Label Text="{Binding English}" BackgroundColor="White" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</DataTemplate>
</d:Column.Template>
</d:Column>
<d:Column Width="100">
<d:Column.HeaderView>
<Label Text="Spanish" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<Label Text="{Binding Spanish}" BackgroundColor="{Binding SpanishBackgroundColor}" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</DataTemplate>
</d:Column.Template>
</d:Column>
<d:Column Width="100">
<d:Column.HeaderView>
<Label Text="Pic" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<Image Source="{Binding ImageName}"/>
</DataTemplate>
</d:Column.Template>
</d:Column>
<d:Column Width="200">
<d:Column.HeaderView>
<Label Text="Button" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<a:myButton BackgroundColor="Green" TextColor="White" Font="Bold,18" Text="{Binding ButtonText}" OneAction="{Binding Action}"/>
</DataTemplate>
</d:Column.Template>
</d:Column>
<d:Column Width="100">
<d:Column.HeaderView>
<Label Text="X" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<Entry Text="{Binding X}"></Entry>
</DataTemplate>
</d:Column.Template>
</d:Column>
<d:Column Width="100">
<d:Column.HeaderView>
<Label Text="X * 2" BackgroundColor="Gray" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</d:Column.HeaderView>
<d:Column.Template>
<DataTemplate>
<Label Text="{Binding DoubleX}" BackgroundColor="White" TextColor="Black" XAlign="Center" YAlign="Center"></Label>
</DataTemplate>
</d:Column.Template>
</d:Column>
</d:DataGrid.Columns>
</d:DataGrid>
<!-- </Grid>-->
</StackLayout>
</ContentPage>
<d:DataGrid Rows="{Binding FeatureAttributes, Mode=TwoWay}" BackgroundColor="Black" HeaderHeight="25" RowHeight="Auto">
The RowHeight property when set to Auto, crashes the application. If given an integer, it works fine. I need the data grid to be resized based on the content. Could you please suggest a solution or fix the issue?
The scrolling works on IPad, IPod touch and the IPhone 6 simulator, in Xamarin. However, on an IPhone 6 device, the grid does not scroll both, left and right and up and down.
The DataGrid does not work when there are multiple controls on a ContentPage.
The headers show, but the bound data does not. The data shows when the DataGrid is the only control on the page
I am using Xamarin Studio on a Mac and am running the App on a simulator.
Xamairn.Forms version 1.5.0.6447
The page is set up like this:
A StackLayout with two StackLayouts inside it. Inside the first StackLayout is a label with some text. Inside the second StackLayout is the DataGrid.
latest version xamarin 5.0 android version 11 not working. please let me know new update of data grid
Is there enough implemented in the Windows Platform for this to be usable?
Hi, by following the Getting Started document i succeed in using the grid, however the scroll it terribly slow (100 rows, 5 cols with only a label inside). In the ouput log i can see that an exception is raized for each cells:
Binding: 'MYPROPERTY' property not found on 'Myapp.ViewModels.ViewModelTest', target property: 'Xamarin.Forms.Label.Text'
any clue ?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.