samedi 4 juin 2016

How do I make my BooleanFlag IsReadOnly False DependencyProperty

I am not able to change my BooleanFlag using a DependencyProperty to IsReadOnly False. Every time I check my checkbox or uncheck it, the program always returns with the same bool. Meaning if I set my checkbox as false and then I start the program, once I have checked the checkbox the program will still read the checkbox as being false instead of true. The code is bellow:

 <DataGridTemplateColumn IsReadOnly="False">
      <DataGridTemplateColumn.Header>
           <CheckBox Checked="CraigslistCitiesCheckBox_Checked" Unchecked="CraigslistCitiesUnheckBox_Checked"></CheckBox>
      </DataGridTemplateColumn.Header>
      <DataGridTemplateColumn.CellTemplate>
           <DataTemplate>
                <CheckBox IsChecked="{Binding BooleanFlag}"/>
           </DataTemplate>
      </DataGridTemplateColumn.CellTemplate>
 </DataGridTemplateColumn>

 public bool BooleanFlag
 {
      get { return (bool)GetValue(BooleanFlagProperty); }
      set { SetValue(BooleanFlagProperty, value); }
 }
 public static readonly DependencyProperty BooleanFlagProperty =
            DependencyProperty.Register("BooleanFlag", typeof(bool), typeof(CraigslistCities), new UIPropertyMetadata(false));

How can I be able to rewrite my bool value every time? I am guessing what is preventing me from accessing the rewrite function is the following code public static readonly. How can I change that code so I will be able to rewrite my checkbox value?




Aucun commentaire:

Enregistrer un commentaire