У меня есть панель инструментов, которая связывает ее ItemsSource с моей виртуальной машиной, это список ToolBarItem
public class ToolbarItem : ObservableObject
{
public string ToolTip { get; set; }
public ICommand Command { get; set; }
public BitmapImage Icon { get; set; }
private bool _isPressed;
public bool IsPressed
{
get { return _isPressed; }
set { _isPressed = value; RaisePropertyChanged("IsPressed"); }
}
public ToolbarItem(string tooltip, ICommand command, BitmapImage icon)
{
this.Icon = icon;
this.Command = command;
this.ToolTip = tooltip;
}
}
}
это мой шаблон элемента панели инструментов:
<DataTemplate x:Key="toolBarItemTemplate">
<Button x:Name="toolBarButton"
ToolTip="{Binding Path=ToolTip}"
Command="{Binding Path=Command}"
Cursor="Hand"
Style="{StaticResource toolBarButtonItemStyle}">
<ContentControl Content="{Binding}" ContentTemplate="{StaticResource toolBarButtonItemTemplate}" />
</Button>
</DataTemplate>
<DataTemplate x:Key="toolBarButtonItemTemplate">
<Image Width="16"
Height="16"
Source="{Binding Path=Icon}"
Style="{StaticResource toolBarButtonImageStyle}" />
</DataTemplate>
То, что я хочу сделать, - это когда пользователь нажимает на конкретную кнопку панели инструментов, чтобы изменить поведение этой кнопки, например, иметь рамку вокруг нее.