I have a checkbox which is binded to a class variable in the xaml code:
<CheckBox x:Name="cbxUseBubbleNotifications" Margin="20" IsChecked="{Binding Path=pcdLoggerData.UseBubbleNotifications, Mode=TwoWay}" Content="_Use bubble notifications" HorizontalAlignment="Left" VerticalAlignment="Top" Style="{DynamicResource CheckboxSwitchStyle}" />
this should be supposed to be a two way binding but what happen is:
- the checkbox is set to CHECKED ----> the var pcdLoggerData.UseBubbleNotifications is automatically OK
- the class is serialized (through datacontract serialization but I think that doesn't change anything).
- I restart the program and so the pcdLoggerData.UseBubbleNotifications is automatically set to true 4 the checkbox is not set to TRUE <----- ERROR
point 4 is not correct: since two way I expect to do that automatically.
My class is:
[DataContract]
public class PCDLoggerBinSerializableData
{
public PCDLoggerBinSerializableData() { }
public PCDLoggerBinSerializableData(string _languageInUse, bool _useBubbleNotifications)
{
LanguageInUse = _languageInUse;
UseBubbleNotifications = _useBubbleNotifications;
}
[DataMember]
public string LanguageInUse { get; set; }
[DataMember]
public bool UseBubbleNotifications { get; set; }
}
}
Even more important I have to set another variable according to the same value/variations of pcdLogger.UseBubbleNotifications and that is a STATIC var. something like Bubble.NoBubbles = !pcdmisData.UseBubbleNotifications
So two problems:
- databinding not TWO-WAY working (only one way)
- how to databind also another static var?
Thanks
Aucun commentaire:
Enregistrer un commentaire