Reputation: 810
I need some values to bind in c# as they are posted through XML Serialization to the next screen. In the code below ehvalue3
should be posted through XML. It's working fine when binding is specified in XAML but I need to specify binding in c# code.
How to do this?
private void EHSelect_Click(object sender, RoutedEventArgs e)
{
int ehvalue1 = EHMeterSelector.SelectedItem;
int ehvalue2 = EHCentimeterSelector.SelectedItem;
if (ehvalue1 == 0)
{
ehvalue1 = EHMeterSelector.DefaultValue;
}
EHeight_btn.Content = ehvalue1 + " ft " + ehvalue2+ " in";
float ehvalue3 = float.Parse(string.Format("{0}.{1}", ehvalue1.ToString(), ehvalue2.ToString()));
SaveUser();
}
Upvotes: 0
Views: 389
Reputation: 6191
I recommend you look at something like this guide which should help you.
In a nutshell, you need to:
Text="{Binding myProperty,Mode=TwoWay}"
Upvotes: 1