Я связываю свойство команды двух гиперссылок в моем xaml с командой в представлении (которое представляет собой текст данных):
<TextBlock>
<Hyperlink x:Name="linkCheckAll" Command="{Binding CheckAllZonesCommand}" CommandParameter="{Binding}">Check All</Hyperlink>
<TextBlock Margin="0,0,20,0"/>
<Hyperlink x:Name="linkUncheckAll" Command="{Binding UncheckAllZonesCommand}" CommandParameter="{Binding}">Uncheck All</Hyperlink>
</TextBlock>
Что выглядит так:

Я получаю следующую ошибку при привязке моих команд:
System.Windows.Data Error: 40 : BindingExpression path error: 'CheckAllZonesCommand' property not found on 'object' ''ZonesView' (HashCode=56756307)'. BindingExpression:Path=CheckAllZonesCommand; DataItem='ZonesView' (HashCode=56756307); target element is 'Hyperlink' (HashCode=50738642); target property is 'Command' (type 'ICommand')
System.Windows.Data Error: 40 : BindingExpression path error: 'UncheckAllZonesCommand' property not found on 'object' ''ZonesView' (HashCode=56756307)'. BindingExpression:Path=UncheckAllZonesCommand; DataItem='ZonesView' (HashCode=56756307); target element is 'Hyperlink' (HashCode=53994596); target property is 'Command' (type 'ICommand')
"ZonesView" - это мой мой dataContext, и я уверен, что он содержит команды, о которых идет речь:
public class ZonesView : BaseViewModel
{
public static ICommand CheckAllZonesCommand = new DelegateCommand()
{
ExecuteMethod = new Action<object>(delegate(object o) { ((ZonesView)o).CheckAllZones(); }),
CanExecuteMethod = new Func<bool>(delegate() { return true; })
};
public void CheckAllZones()
{
foreach( CheckBox cb in ZonesCheckBoxes.Values.Where(cb => (cb.IsChecked != true) && cb.Name.Contains((String)ActiveTab.Header) ))
{
cb.IsChecked = true;
ZoneCheckBoxClicked(cb, null);
}
}
public static ICommand UncheckAllZonesCommand = new DelegateCommand()
{
ExecuteMethod = new Action<object>(delegate(object o) { ((ZonesView)o).UncheckAllZones(); }),
CanExecuteMethod = new Func<bool>(delegate() { return true; })
};
public void UncheckAllZones()
{
foreach( CheckBox cb in ZonesCheckBoxes.Values.Where(cb => (cb.IsChecked != false) && cb.Name.Contains((String)ActiveTab.Header)) )
{
cb.IsChecked = false;
ZoneCheckBoxClicked(cb, null);
}
}
Из того, что я могу сказать, я все сделал правильно. Команды являются общедоступными, они имеют правильный тип, и текст данных гиперссылок является правильным (как вы можете узнать из сообщения об ошибке пути BindingExpression) - так что же происходит не так?
Я пытался сделать команды в классе ZonesView статическими, но это ничего не изменило.