Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem trying to bind a property of a control to it's hosting window

HTML
<Label Content="{Binding ElementName=window,Path=Title}"/>


The binding works at runtime but never at designe-time

I think that the title property of the window is Set After the initialization of the lable and in design-time the text property of the lable is not evaluated again after the Title of the window gots its value.

This lead me to big problem when designing a custom window that have some dependency properties, when creating a controlteamplate for my custom window, the controls inside that teamplate do not get coorect values using teamplated binding in designe time.
Posted
Comments
Sergey Alexandrovich Kryukov 17-Nov-14 14:30pm    
The question looks quite legitimate, but my question is: who cares what a label shows at design time, if during runtime it shows what you wanted? This is a general design consideration: the design-time text in most controls changing their content is used during design time just for some placeholders. In many aspects, though, design-time behavior is very important; say, realistic layout helps to keep the project maintainable... Not an answer, just a note...
—SA
Member 10692289 17-Nov-14 17:18pm    
Its not just about Text lable, I provided that as an exmaple to help fast problem reproduction.
I have controls that need to retrive informations such as icon, background, font siz etc from the hosting control, if the binding is not working as expected at designe-time this wil affect my UI design and i have to run the application just to see how the UI will look like.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900