I am creating User Control. I created three dependency properties which the user should bind to a viewmodel in XAML.
Is there something I can do so if developer does not bind the property? Ideally, the project would not compile successfully.
I am creating User Control. I created three dependency properties which the user should bind to a viewmodel in XAML.
Is there something I can do so if developer does not bind the property? Ideally, the project would not compile successfully.
This is impossible. Bindings are only checked at run-time, not at compile-time. The reason for this is that the compiler cannot determine what datacontext you wish to set for a view while the application is running since you can always change the datacontext.
If you're interested you can look up the MVVM design pattern to learn more about the reason why the model and view are seperated.