I have a simple Question.. Is it possible to use binding like this:
<my:{Binding Path=Foo} />
The reason why I want to do this is I need the foo to change by using conditional compilation, for Example:
#if BAR
var foo = "FooBar"
#endif
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know having dynamic changes to the XAML markup itself is not possible in WPF.
If you do need to have something like this I would suggest that you use one of your possible classes in XAML to keep design support and to have a valid XAML file and then write a little tool that runs through all your xaml files before compilation and exchanges
FoowithBarif a certain condition is met. Obviously you would need to make sure thatFooandBarare interchangeable too.Effectively your XAML would look like this
and your tool would check a condition and then exchange
FoowithBarin all your xaml files.