c# - WPF binding properties to Datagrid -


I have forced an Observable collection for DataSrid for a Madsource, however, I want to recover the personal properties through a setter (through a setter). See modal

Fine nonsense will be deemed to be frightening by speaking.

In my observation, I have a property called "active", so I want to set this element when a user clicks or closes the checkbox in the datagrid.

XML

  & lt; DataGridTemplateColumn.CellTemplate & gt; & Lt; DataTemplate & gt; & Lt; Checkbox IsChecked = "{Binding Active, Mode = Two}" Horizontal Alignment = "Center" & gt; & Lt; / Checkbox & gt; & Lt; / DataTemplate & gt; & Lt; /DataGridTemplateColumn.CellTemplate>   

And I want to trigger this code in ViewModel, when the box is unchecked or checked

  private bool m_active = false; Public Button Active {get {return m_Active; } Set {m_Active = value; OnPropertyChanged ("Active"); }}   

But on two-way mode, it's not.

Note: I can get selected columns on the SelectedItem property of DataGrid, so basically I want the selected personal property!

Thanks

It seems that you are confused where the datagrid 'active' property Is looking for since the datagrid is bound to an observation archive, so the objects inside the viewable archive require 'active' properties, not the visual model used for the scene. If, however, you really want to pair all the rows of a datagrid for a single property on the visual model, you will need to look at the ancestor's tree and then connect it to the 'active' property to find the data reference of the control:

  & lt; Check box ischhecked = "{binding relative serous = {relative serous FindAncestor, ancestor type = {x: type user control}}, path = data contentbox, active = mode = double}" horizontal alignment = "center" & gt; & Lt; / Check box & gt;   

But, I imagine, you want to bind this observation archive with the 'active' property of the object. When you are running your application, check your output window and you should see the binding error, if it is not present on the property object

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -