Flow.Launcher/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml
2023-03-05 05:59:49 +09:00

153 lines
No EOL
7 KiB
XML

<UserControl
x:Class="Flow.Launcher.Plugin.WebSearch.SettingsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:Flow.Launcher.Plugin.WebSearch"
d:DataContext="{d:DesignInstance vm:SettingsViewModel}"
d:DesignHeight="300"
d:DesignWidth="500"
mc:Ignorable="d">
<UserControl.Resources>
<Style x:Key="BrowserPathBoxStyle" TargetType="TextBox">
<Setter Property="Height" Value="28" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<DataTemplate x:Key="HeaderTemplateArrowUp">
<DockPanel>
<TextBlock HorizontalAlignment="Center" Text="{Binding}" />
<Path
x:Name="arrow"
Data="M 5,10 L 15,10 L 10,5 L 5,10"
Fill="gray"
StrokeThickness="1" />
</DockPanel>
</DataTemplate>
<DataTemplate x:Key="HeaderTemplateArrowDown">
<DockPanel>
<TextBlock HorizontalAlignment="Center" Text="{Binding}" />
<Path
x:Name="arrow"
Data="M 5,5 L 10,10 L 15,5 L 5,5"
Fill="gray"
StrokeThickness="1" />
</DockPanel>
</DataTemplate>
</UserControl.Resources>
<Grid Margin="0,4,0,0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="56" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<ListView
x:Name="SearchSourcesListView"
Grid.Row="0"
Margin="18,18,18,0"
BorderBrush="DarkGray"
BorderThickness="1"
GridViewColumnHeader.Click="SortByColumn"
ItemsSource="{Binding Settings.SearchSources}"
MouseDoubleClick="MouseDoubleClickItem"
SelectedItem="{Binding Settings.SelectedSearchSource}"
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
<ListView.View>
<GridView>
<GridViewColumn Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image
Width="20"
Height="20"
Margin="6,0,0,0"
Source="{Binding Path=IconPath}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn
Width="130"
DisplayMemberBinding="{Binding ActionKeyword}"
Header="{DynamicResource flowlauncher_plugin_websearch_action_keyword}"/>
<GridViewColumn
Width="350"
DisplayMemberBinding="{Binding Title}"
Header="{DynamicResource flowlauncher_plugin_websearch_title}"/>
<GridViewColumn Width="140" Header="{DynamicResource flowlauncher_plugin_websearch_enable}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_websearch_false}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Status, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_websearch_true}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Width="100"
Margin="10"
Click="OnDeleteSearchSearchClick"
Content="{DynamicResource flowlauncher_plugin_websearch_delete}" />
<Button
Width="100"
Margin="10"
Click="OnEditSearchSourceClick"
Content="{DynamicResource flowlauncher_plugin_websearch_edit}" />
<Button
Width="100"
Margin="10,10,18,10"
Click="OnAddSearchSearchClick"
Content="{DynamicResource flowlauncher_plugin_websearch_add}" />
</StackPanel>
<Border
Grid.Row="2"
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="0,1,0,0">
<DockPanel HorizontalAlignment="Right">
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Label
Margin="14,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" />
<ComboBox
Height="30"
Margin="0,0,20,0"
VerticalAlignment="Center"
FontSize="11"
IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}"
ItemsSource="{Binding Settings.Suggestions}"
SelectedItem="{Binding Settings.SelectedSuggestion}" />
<Label
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}" />
<CheckBox
Name="EnableSuggestion"
Margin="0,0,8,0"
IsChecked="{Binding Settings.EnableSuggestion}" />
</StackPanel>
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSearchSuggestion is not working -->
</DockPanel>
</Border>
</Grid>
</UserControl>