Case:
public class customer
{
public string Adress { get; set; }
}
Xaml:
<Grid x:Name="LayoutRoot" Background="White" > <StackPanel> <TextBox Text="{Binding Adress}"/> </StackPanel> </Grid>
.cs
public MainPage() { InitializeComponent(); LayoutRoot.DataContext = new customer() { Adress = "Some Adr" }; }
So the Question is... In code behind .. How to i get the property (string) of the bind (Adress). I need it to access the customer.adress as a property, to assign another variable. (in this case when a event occours. e.g. after the this.Loaded occours.)
So i got the UI element (sender) and i can get the customer form it's datacontext.
In short. How do i get the property name of the binding object. (the binding object is easy to find i just use datacontext to get the customer, but where can i get the name of the property? that are in the xaml (eg. name) from the sender)
(I plan to use reflection if it is nessesery to access the "adress" inside customer) but how to get the "name" of the property that text in the textBox is bound to.
Regards Jesper