-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It´s not allowed to use combobox with default Maui.DataGrid PropertyName binding definition #127
Comments
Setting the BindingContext to the value of the corresponding PropertyName is the correct behavior that we want, as it allows us to be agnostic to whatever kind of user controls that the user wants. If this results in values not updating, then that would be a MAUI bug. |
I think, that main problem is, that you set Binding on cell to BindingContextProperty, which is default of Grid BindableProperty.
If you want to change the values inside the grid in DataTemplate, you need to specify right BindableProperty of maui component like Entry (Entry.TextProperty), or CheckBox (CheckBox.IsCheckedProperty). So then, you need something like I wrote before:
So this is not the bug of MAUI, but maybe of your code. |
I now see what you mean. I added an inline editing mode to the current main branch, which supports a bunch of data types, and it is binding correctly. I will see what I can do to make it bidirectionally bind correctly with a custom DataTemplate. The new EditCellTemplate feature may not be working, given this issue. Will need to test that. |
Is it working better now, when using the latest main branch? |
Describe the bug
If I use a Combobox/Entry/Picker (or some other user interact control) in a datagrid cell and if I use the default binding (defined as PropertyName and Binding without path), the changes in the model are not reflected.
To Reproduce
Use Maui.DataGrid.Sample project
Add example string test property "TestStr" to model "Team" and define OnPropertyChanged on this property. (e.g. implement INotifyPropertyChanged on model "Team" )
Expected behavior
If I change the value of TestStr property in Entry column, than the changed value will be reflected to model property value and will be in Label Column
Actual behaviour
The changed value is not reflected to model property value and is not reflected to Label column value.
Solution
I can´t use default MAUI.Datagrid binding (propertyName in DataGridColumn definition), but default MAUI/WPF binding with defined Path ({Binding Path=TestStr}).
Additional context
The main problem is, that you create your own binding with default Grid.BindingContextProperty, but than the MAUI don´t know which BindableProperty use to in the child of ContentView (e.g. for Entry TextProperty, for ComboBox IsCheckedProperty).
You would have to define every special binding for every special user interact control.
So, it is not really a bug, but the usage of your Binding is little bit confused, because you rewrite default Binding from MAUI/WPF and you don´t show, how to use user interact controls in your DataGrid and I think, that this sample is needed. So the best solution might be to show how to use this specials controls in your DataGrid in Maui.DataGrid.Sample project, or change the creation of Binding to the better solution prepared for every user interact control (but I think, that this is not possible).
The text was updated successfully, but these errors were encountered: