In which way the property can be obliged for the user control. When this user control is written in the xaml it should give error as X property should be assigned, and this error should be given during the design or build time.
Share
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.
There is no easy way of doing what you are asking.
It is considered best practice to design your user controls with sensible default values for all the properties, so that the program can run irrespective of whether the developer specifies values. Of course, the control might not do anything useful in this case!
If you really must have errors showing up at build time, you would probably need to create a custom MSBuild step in which you parsed the XAML, checked for instances of your control, and check that the properties are assigned values. System.Xaml might help you here (it is intended for WPF, but for the purposes of parsing and checking XAML it should work fine). Rob Relyea’s BindingFinder example might give you some guidance.