c# - How to bind boolean to GridViewColumn checkboxes (have code but doesn't work)? -


I am trying to force the check box in a GridViewColumn , but It does not work I also tried to return false, but checkboxes are still capable. It only works when I write "wrong" to xaml.

The property bundled is:

  Public Hair Happiness {Get Return to this.UserPricease == UserPrintilities.Full Eases; }}   

The current value of this value is not UserPrivileges.FullAccess .

Xaml Code:

  & lt; Window x: Class = "Effect window. Manvindo" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http: /ssemas.microsoft.com/winfx/2006 / Xaml "title =" effect manager "width =" 800 "height =" 500 "datacentext =" {binding relative saras = {relative asses}} "& lt; DocPanel VerticalElement = "Stretch" & gt; & Lt; DockPanel.Resources & gt; & Lt; ListView x: name = "EffectsListView" item source = "{Binding AllEffects}" & gt; & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Width = "50" Header = "Override" & gt; & Lt; GridViewColumn.CellTemplate & gt; & Lt; DataTemplate & gt; & Lt; Checkbox margin = "0" horizontal alignment = "center" isEnabled = "{binding isarmation}" /> & Lt; / DataTemplate & gt; & Lt; /GridViewColumn.CellTemplate> & Lt; / GridViewColumn & gt; & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; & Lt; / DockPanel & gt; & Lt; / Window & gt;   

Edit: Current Property Code:

  Get Public Hair Hesparimans. Take it back. UserPrint == UserPermissions.FullAccess; } Set {this.RaisePropertyChanged ("HasPermissions"); Think about the problem in your updated asset: There is no backing field in the property. , Its recipient compares a different property with  UserPermissions.FullAccess . So it can never be set    

It is a matter of note when the UI should be informed that HasPermissions has changed? OK, when can change that value? When the value of this.UserPermissions changes, is not it?

It is believed that this.UserPermissions is a property with its own setter, its setter is the place to call RaisePropertyChanged ("HasPermissions") . It will tell the UI, even if it is not connected directly to userpress , then binding the property does should be re-evaluated.

Update: In relation to your comment, IsChecked is actually a check box property that you should bind to HasPermissions , If you want to indicate the status of the box checked that the user has permission.

Update 2: It seems that you want to use the property of the window's datacontext from the visual child (LISTBOX). You can use the relative source binding to get it, like:

     

It will find the most basic element in some pointy signaling view window, which is in the check box in the type window, and its datacontext is bound to find greatness in the properties.

Comments