You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this.PropertyChanged += (sender, args) =>
{
if (args.PropertyName == nameof(IsCustomUserControlEnabled))
{
// log, and debugger breakpoint set in here
}
};
Added to constructor of MainViewModel, I can see that IsCustomUserControlEnabled is actually updated
3. Add: <local:CustomUserControl IsEnabled="{Binding IsCustomUserControlEnabled/>
To MainWindow.xaml
4. Create public partial class CustomUserControl : UserControl
5. With:
this.GetObservable(IsEnabledProperty).Subscribe(isEnabled =>
{
// log, and debugger breakpoint set in here
});
Added to constructor CustomUserControl.xaml.cs, I can see that IsCustomUserControlEnabled is not propagated to IsEnabled of CustomUserControl
If this is too confusing to reproduce I can provide you with sample app, but I think it is straight forward enough
Expected behavior
Step 5 - Properties inherited from UserControl, bound using MVVM ObservableProperty, should be propagated to child classes.
Which means, that when I update IsCustomUserControlEnabled, breakpoint inside of subscriber to IsEnabledProperty should be hit
Avalonia version
11.2.1
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered:
UserControl is probably the wrong control type for you. See it as a page, not a control like a custom button. Consider to inherit ContentControl or TemplatedControl for example.
Describe the bug
Property IsEnabled is not propagated to classes inheriting UserControl
I have custom UserControl, and I try to intercept IsEnabledProperty change inside of a class that inherits UserControl.
Above subscriber is never called, even when I properly bind IsEnabled in XAML.
To Reproduce
To MainViewModel.cs
2. With:
Added to constructor of MainViewModel, I can see that IsCustomUserControlEnabled is actually updated
3. Add:
<local:CustomUserControl IsEnabled="{Binding IsCustomUserControlEnabled/>
To MainWindow.xaml
4. Create public partial class CustomUserControl : UserControl
5. With:
Added to constructor CustomUserControl.xaml.cs, I can see that IsCustomUserControlEnabled is not propagated to IsEnabled of CustomUserControl
If this is too confusing to reproduce I can provide you with sample app, but I think it is straight forward enough
Expected behavior
Step 5 - Properties inherited from UserControl, bound using MVVM ObservableProperty, should be propagated to child classes.
Which means, that when I update IsCustomUserControlEnabled, breakpoint inside of subscriber to IsEnabledProperty should be hit
Avalonia version
11.2.1
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: