Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

datagrid, datatable updating values in celltemplate

$
0
0

Hi,

I've made this control that basically creates dynamic columns in a datagrid each time it is loaded. 

The itemssource is a datatable. The reason its a datatable is because depending on an object selected the number of columns being reloaded are different.

It grid basically dispalys an object name and a bunch of checkbox columns.

The checkbox column is a celltemplate column because I needed to use a 3 state checkbox.

Now I can bind up the checkboxes correctly but I cannot capture changes in the datatable when a user changes the value in a checkbox.

Can someone help me with how to push the changes back into the datatable?

If you need some code I can provide but basically my custom threestate checkbox is binding to the DataContext of the cell template to get its value.

Heres the template 

<DataTemplate x:Key="threeStateCheckBoxTemplate"><controls:ThreeStateCheckedBox IsChecked="{Binding Path=DataContext, RelativeSource={RelativeSource Self}, Mode=TwoWay, Converter={StaticResource intToBoolConverter}, UpdateSourceTrigger=PropertyChanged}"></controls:ThreeStateCheckedBox></DataTemplate>

I can change the value but I cannot get that value to change in the datatable.

Thanks and if you want more information just ask.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>