I have a real-world problem in which I need to customize the developer experience inside the WPF visual designer and property window of Visual Studio.
I have three properties A B and C:
-
Each of the three properties must appear in the property window;
-
Property C must be read-only, and its value must be calculated on the basis of the values of properties A and B, which are read-write; and
-
If A or B change, the value for C should be updated without having to reload the designer.
How can I achieve this?
After checking the documentation and struggling on my own, I have to conclude that what I am trying to do is not possible, since
1) read-only attached dependency properties do not appear in the Visual Studio properties pane to begin with
2) Even if you tried to use DesignModeValueProvider to make an editable property behave like a read-only property, a value that is entered in error will be stored in XAML. This means at runtime you will be setting incorrect values.