XAML 代码如下:
<Helper:BooleanVisibilityValueConverter x:Key="BoolToVisible" />
<Control x:Name="ResizeDecorator" MouseMove="ResizeDecorator_MouseMove" Template=" {StaticResource ResizeDecoratorTemplate}" Visibility="{Binding IsButtonVisible,Converter= {StaticResource ResourceKey=BoolToVisible},RelativeSource={RelativeSource TemplatedParent}}" />
<Helper:BooleanVisibilityValueConverter x:Key="BoolToVisible" />
<Control x:Name="ResizeDecorator" MouseMove="ResizeDecorator_MouseMove" Template="{StaticResource ResizeDecoratorTemplate}" Visibility="{Binding IsButtonVisible,Converter={StaticResource ResourceKey=BoolToVisible},RelativeSource={RelativeSource TemplatedParent}}" />
视图模型代码:
private bool _IsButtonVisible;
public bool IsButtonVisible
{
get { return _IsButtonVisible; }
set
{
_IsButtonVisible = value;
NotifyPropertyChanged("IsButtonVisible");
}
}
IsButtonVisible =false;
谁能告诉我我哪里出错了?