fix tab populating in settings (fixes #291)

This commit is contained in:
Ioannis G 2015-09-25 23:43:09 +03:00
parent 6f6393493b
commit a1988f91c1
2 changed files with 22 additions and 36 deletions

View File

@ -20,7 +20,7 @@
</ListBoxItem>
<converters:ImagePathConverter x:Key="ImageConverter" />
</Window.Resources>
<TabControl Height="auto" x:Name="settingTab">
<TabControl Height="auto" x:Name="settingTab" SelectionChanged="settingTab_SelectionChanged">
<TabItem Header="{DynamicResource general}">
<StackPanel Orientation="Vertical" Margin="10">
<CheckBox x:Name="cbStartWithWindows" Unchecked="CbStartWithWindows_OnUnchecked" Checked="CbStartWithWindows_OnChecked" Margin="10">
@ -45,7 +45,7 @@
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Header="{DynamicResource plugin}" x:Name="tabPlugin" PreviewMouseLeftButtonDown="TabPlugin_OnPreviewMouseLeftButtonDown">
<TabItem Header="{DynamicResource plugin}" x:Name="tabPlugin">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
@ -121,7 +121,7 @@
</Grid>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource theme}" PreviewMouseLeftButtonDown="TabTheme_OnPreviewMouseLeftButtonDown" x:Name="tabTheme">
<TabItem Header="{DynamicResource theme}" x:Name="tabTheme">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
@ -201,7 +201,7 @@
</Grid>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource hotkey}" x:Name="tabHotkey" PreviewMouseLeftButtonDown="TabHotkey_OnPreviewMouseLeftButtonDown">
<TabItem Header="{DynamicResource hotkey}" x:Name="tabHotkey">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>

View File

@ -164,6 +164,24 @@ namespace Wox
}
}
private void settingTab_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Update controls inside the selected tab
if (tabPlugin.IsSelected)
{
OnPluginTabSelected();
}
else if (tabTheme.IsSelected)
{
OnThemeTabSelected();
}
else if (tabHotkey.IsSelected)
{
OnHotkeyTabSelected();
}
}
#region General
private void LoadLanguages()
@ -243,17 +261,6 @@ namespace Wox
}
}
private void TabHotkey_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var tabItem = sender as TabItem;
var clickingBody = (tabItem.Content as UIElement).IsMouseOver;
if (!clickingBody)
{
OnHotkeyTabSelected();
}
}
private void OnHotkeyTabSelected()
{
ctlHotkey.HotkeyChanged += ctlHotkey_OnHotkeyChanged;
@ -422,16 +429,6 @@ namespace Wox
}
private void TabTheme_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var tabItem = sender as TabItem;
var clickingBody = (tabItem.Content as UIElement).IsMouseOver;
if (!clickingBody)
{
OnThemeTabSelected();
}
}
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
string themeName = themeComboBox.SelectedItem.ToString();
@ -666,17 +663,6 @@ namespace Wox
lbPlugins.SelectedIndex = 0;
}
private void TabPlugin_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var tabItem = sender as TabItem;
var clickingBody = (tabItem.Content as UIElement).IsMouseOver;
if (!clickingBody)
{
OnPluginTabSelected();
}
}
#endregion
#region Proxy