Possible Duplicate:
XAML Conditional Compilation
I am new to WPF. I just need to write a small piece of code in xaml, for which i need to know the if condition equivalent in WPF. Can anybody here help in that?
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.
Are you after something like, “If (x == 1), make the background of this control blue”? If that is what you are after, you could use data triggers. Here is an example that changes the background color of a control conditionally based on some data. In this example, I made it part of a style and used it later in some controls.
If ‘Coloring’ changes values to ‘Red’, ‘Blue’, or ‘White’, it will update the background property of the DockPanel accordingly.