.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
WPF, Using the [RelayCommand] in versions lower than .Net6 (.Net 5, .Net core3.1 etc.) will not prompt for the need to set partial for the class, and cause binding error at runtime:
System.Windows.Data Error: 40 : BindingExpression path error: 'ButtonClickCommand' property not found on 'object' ''ViewModel' (HashCode=47044325)'. BindingExpression:Path=ButtonClickCommand; DataItem='ViewModel' (HashCode=47044325); target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')
Regression
No response
Steps to reproduce
ViewModel
public partial class ViewModel
{
[RelayCommand]
public void ButtonClick(object param)
{
Console.WriteLine(param);
}
}
MainWindow.xaml.cs
public MainWindow()
{
InitializeComponent();
this.DataContext = new ViewModel();
}
Describe the bug
WPF, Using the [RelayCommand] in versions lower than .Net6 (.Net 5, .Net core3.1 etc.) will not prompt for the need to set partial for the class, and cause binding error at runtime:
System.Windows.Data Error: 40 : BindingExpression path error: 'ButtonClickCommand' property not found on 'object' ''ViewModel' (HashCode=47044325)'. BindingExpression:Path=ButtonClickCommand; DataItem='ViewModel' (HashCode=47044325); target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')
Regression
No response
Steps to reproduce
Expected behavior
Support lower Net Version
Screenshots
No response
IDE and version
VS 2019
IDE version
No response
Nuget packages
Nuget package version(s)
8.2.2
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item