Hi, I try binding command, but it doesn't work.
xaml:
But it works when I indicates the specific component:
everything works fine.
Why doesnot work in the first case and how to fix it?
private
readonly
EmployeeContextViewModel _ucvm;
public
MainWindow() // RadWindow
{
InitializeComponent();
_ucvm =
new
EmployeeContextViewModel();
DataContext = _ucvm; // <<<<<<<<<
}
<
t:RadButton
Content
=
"Exit"
x:Name
=
"LoginButton"
Command
=
"{Binding LogoutCommand}"
/>
But it works when I indicates the specific component:
public
MainWindow()
{
InitializeComponent();
_ucvm =
new
EmployeeContextViewModel();
LoginButton.
DataContext = _ucvm; // <<<<<<<<<<<<<<
}
Why doesnot work in the first case and how to fix it?