wpf - How do I databind to the control's property rather than the datacontext? -
There is a sub control embedded in my main control, it allows the user to edit an address. Because it is used all over again (sometimes in one control at many places) I bind it very much
& lt; Control: EditDeser User Controller DataContext = "{Binding Path = Home Order}" /> & Lt; Control: Edit User Controller DataContext = "{Binding Path = Task Address}" />
But EditAddressUserControl requires access to the list of main control country listings, so that they can choose which country is from the address.
I have added a Country Dependency Property EditAddressUserControl and added
country = "{binding country}"
so far Everything is recovering, EditAddressUserControl.Countries has the right countries in the property, however, how will I tell my combibox? How do imsmsource in xaml?
I still want everything to bind my Datacentext to my EditAddressUserControl, but ComboBoxCountries.ItemsSource needs to be bound with "this country."
How do I do this?
I have tried to do this
& lt; Combo box itemsource = "{binding relative saras = {relative serous FindAncestor, ancestor type = {x: type control: edit address control}}, path = country}" / & gt;
I did not see any compulsive errors in the outbound box, but I did not see any items in Cambodia.
You can complete this by using one for binding source instead of datacentext.
This probably looks something like this:
and lieutenant; Combo box itemsource = "{binding relative saras = {relative serous FindAncestor, ancestor type = {x: type control: edit address control}}, path = country}" />
Comments
Post a Comment