В MainWindow.xaml У меня есть следующее ...
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
</Window.Resources>
// Tab control
<TabItem x:Name="DebugTab" Header="Debug" Visibility="{Binding Path=DebugTabState, Converter={StaticResource ResourceKey=BooleanToVisibility}}">
// Some content
</TabItem>
В MainWindow.xaml.cs У меня есть следующее ...
public bool DebugTabState
{
get
{
return AppData.EnableDebuggingCheckBox;
}
}
В DebugSettings.xaml У меня есть следующее ...
<CheckBox x:Name="EnableDebuggingCheckBox" Content="Enable Debugging" IsChecked="{Binding Path=EnableDebugging}" />
В DebugSettings.xaml.cs У меня есть следующее...
public bool EnableDebugging
{
get
{
return AppData.EnableDebuggingCheckBox;
}
set
{
AppData.EnableDebuggingCheckBox = value;
}
}
И, наконец, в AppData.cs у меня есть следующее ...
private bool _enableDebuggingCheckBox;
public bool EnableDebuggingCheckBox
{
get
{
return _enableDebuggingCheckBox;
}
set
{
_enableDebuggingCheckBox = value;
OnPropertyChanged("EnableDebuggingCheckBox");
}
}
Проверка и снятие флажка EnableDebuggingCheckBox обновляет значение до true илиfalse, как и ожидалось, но DebugTab не скрывается и не отображается.Я что-то упустил?
Спасибо!