I created a user control and an associated view model. The properties “DisplayName” and “TimeIntervalLength” of the view model are displayed in the user control view DataBinding. Depending on those properties of the view model I want to update the width of my control.
The width should be “TimeIntervalLength” but at least “DisplayName”. I tried to override “OnPropertyChanged” but this does not work. Further I could not find an appropriated event to override.
Thanks in advance.
You may try just not specifying a Width/Height on your UserControl. It should fit to the controls hosted within.
Another option is to use an IValueConverter to do some heavier lifting:
Heavy lifting in your MaxValueConverter: