Xamarin.Forms.DataGrid
Xamarin.Forms.DataGrid copied to clipboard
Pickers Won't Display Changes in DataGrid
Not able to get Pickers refresh their display normally while nested inside of a DataGrid. The values can bind with the object model and thus the database but the displayed value turns blank white inside of a DataGrid. If I sort one of the columns the picker display will refresh when the views redraw themselves.
Tried with Xamarin Forms Picker, XLabs Bindable Picker, and the Bindable Picker found here https://forums.xamarin.com/discussion/30801/xamarin-forms-bindable-picker (this one gets the closest to working right).
` <dg:DataGrid x:Name="DgSkills" ItemsSource="{Binding Skills}" SelectedItem="{Binding SelectedItem}"
BorderColor="#CCCCCC" HeaderBackground="#E0E6F8" SelectionEnabled="false"
Grid.Row="0">
<dg:DataGrid.Columns>
<dg:DataGridColumn Title="Skill Name" PropertyName="SkillName" Width="2*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding SkillName}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Ability" Width="*" >
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<views:BindablePicker SelectedIndex="{Binding TargetStat, Mode=TwoWay}" ItemsSource="{StaticResource ModStatStrings}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Total Bonus" PropertyName="TotalBonus" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding TotalBonus}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Ranks" PropertyName="Ranks" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding Ranks}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="Misc." PropertyName="MiscMod" Width="*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding MiscMod}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" />
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>`
As you can see when the item is selected, the display goes blank with a picker (this also applies to normal Xamarin Forms Pickers). I believe the issue is with the grid implementation.
Hello,
I've reproduced the issue and decided its a Xamarin bug. I've opened as an issue in Bugzilla. As soon as they fix, I'll update it.
Note: Untill they fix the issue you can make a workaround such putting a Label
front of PickerView
or bindable one. PickerView
sets SelectedItem
property into ViewModel
anyway.
Thanks for the response and bug submission. I'll try playing around with labels and seeing why the selected item property may not be triggering tomorrow.
Hi @akgulebubekir
I am using picker in DatagridColumn and if i bind the model to ItemSource it is not working .Any help on this is really appreciated