我需要显示一些ToolTip
s 并有一个CheckBox
显示和隐藏它。我有数据绑定,但不会更新。bool 值似乎总是正确的,这意味着ToolTip
即使CheckBox
未选中 也不会消失。
WPF 代码
<Button Name="btnCancel" Content="Cancel"
ToolTipService.IsEnabled="{Binding GeneralDisplayTooltipsForPreferencesAndSearchOptions}"
ToolTip="Discard Changes On All Tabs and Close Dialog"
Height="25" Width="80" Margin="0,5,2,5"
VerticalAlignment="Center" Click="btnCancel_Click"/>
C#
public class General : INotifyPropertyChanged, IPreferencesGeneral
{
private bool generalDisplayTooltipsForPreferencesAndSearchOptions = false;
[field: NonSerializedAttribute()]
public event PropertyChangedEventHandler PropertyChanged = delegate
{
};
public bool GeneralDisplayTooltipsForPreferencesAndSearchOptions
{
get { return generalDisplayTooltipsForPreferencesAndSearchOptions; }
set
{
if (!Equals(generalDisplayTooltipsForPreferencesAndSearchOptions, value))
{
generalDisplayTooltipsForPreferencesAndSearchOptions = value;
OnPropertyChanged("GeneralDisplayTooltipsForPreferencesAndSearchOptions");
}
}
}
}