How do I clear a RatingControl and make it 0 stars in WinUI 3?
See the question and my original answer on StackOverflowAll dependency properties have associated metadata with it. The public instance's property get/set methods are merely wrappers over dependency properties GetValue
and SetValue
methods.
And you can also reset the value to it's default value using the ClearValue method.
In the case of RatingControl, that would be a code like this:
mainRating.ClearValue(RatingControl.ValueProperty);
Note this can be seen as a shortcut to:
var dp = RatingControl.ValueProperty;
var def = dp.GetMetadata(typeof(RatingControl)).DefaultValue; // -1d
mainRating.SetValue(dp, def);