|
8 | 8 | xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
|
9 | 9 | xmlns:utils="clr-namespace:CurvaLauncher.Utilities"
|
10 | 10 | xmlns:models="clr-namespace:CurvaLauncher.Models"
|
11 |
| - xmlns:wpfproxy="clr-namespace:EleCho.WpfUtilities;assembly=EleCho.WpfUtilities.BindingProxy" |
12 |
| - xmlns:condition="clr-namespace:EleCho.WpfUtilities.ConditionControls;assembly=EleCho.WpfUtilities.ConditionControls" |
| 11 | + xmlns:ws="https://schemas.elecho.dev/wpfsuite" |
13 | 12 | xmlns:tb="http://www.hardcodet.net/taskbar"
|
14 | 13 | xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
15 | 14 | mc:Ignorable="d"
|
|
105 | 104 | </ui:ProgressRing.LayoutTransform>
|
106 | 105 | </ui:ProgressRing>
|
107 | 106 | </Grid>
|
108 |
| - <condition:IfControl Condition="{Binding ViewModel.HasQueryResult}"> |
109 |
| - <condition:IfControl.Then> |
110 |
| - <ListView Name="resultBox" Margin="0 5 0 0" MinHeight="0" |
111 |
| - Height="Auto" |
112 |
| - MaxHeight="{Binding AppConfig.LauncherResultViewHeight}" |
113 |
| - BorderThickness="0" |
114 |
| - ScrollViewer.HorizontalScrollBarVisibility="Disabled" |
115 |
| - ScrollViewer.VerticalScrollBarVisibility="Auto" |
116 |
| - ItemsSource="{Binding ViewModel.QueryResults}" d:ItemsSource="{d:SampleData ItemCount=5}" |
117 |
| - SelectedItem="{Binding ViewModel.SelectedQueryResult,Mode=OneWayToSource}" |
118 |
| - SelectedIndex="{Binding ViewModel.SelectedQueryResultIndex}"> |
119 |
| - <behaviors:Interaction.Triggers> |
120 |
| - <behaviors:EventTrigger EventName="SelectionChanged"> |
121 |
| - <behaviors:InvokeCommandAction Command="{Binding ScrollToSelectedQueryResultCommand}"/> |
122 |
| - </behaviors:EventTrigger> |
123 |
| - </behaviors:Interaction.Triggers> |
124 |
| - <ListView.ItemTemplate> |
125 |
| - <DataTemplate DataType="models:QueryResultModel"> |
126 |
| - <Border Padding="{DynamicResource QueryResultPaddingThickness}"> |
127 |
| - <Border.Resources> |
128 |
| - <wpfproxy:BindingProxy x:Key="Proxy" Data="{Binding}"/> |
129 |
| - </Border.Resources> |
130 |
| - <Button Command="{Binding InvokeCommand}"> |
131 |
| - <Button.Template> |
132 |
| - <ControlTemplate TargetType="Button"> |
133 |
| - <ContentPresenter Content="{TemplateBinding Content}"/> |
134 |
| - </ControlTemplate> |
135 |
| - </Button.Template> |
| 107 | + <ws:ConditionalControl Condition="{Binding ViewModel.HasQueryResult}"> |
| 108 | + <ListView Name="resultBox" Margin="0 5 0 0" MinHeight="0" |
| 109 | + Height="Auto" |
| 110 | + MaxHeight="{Binding AppConfig.LauncherResultViewHeight}" |
| 111 | + BorderThickness="0" |
| 112 | + ScrollViewer.HorizontalScrollBarVisibility="Disabled" |
| 113 | + ScrollViewer.VerticalScrollBarVisibility="Auto" |
| 114 | + ItemsSource="{Binding ViewModel.QueryResults}" d:ItemsSource="{d:SampleData ItemCount=5}" |
| 115 | + SelectedItem="{Binding ViewModel.SelectedQueryResult,Mode=OneWayToSource}" |
| 116 | + SelectedIndex="{Binding ViewModel.SelectedQueryResultIndex}"> |
| 117 | + <behaviors:Interaction.Triggers> |
| 118 | + <behaviors:EventTrigger EventName="SelectionChanged"> |
| 119 | + <behaviors:InvokeCommandAction Command="{Binding ScrollToSelectedQueryResultCommand}"/> |
| 120 | + </behaviors:EventTrigger> |
| 121 | + </behaviors:Interaction.Triggers> |
| 122 | + <ListView.ItemTemplate> |
| 123 | + <DataTemplate DataType="models:QueryResultModel"> |
| 124 | + <Border Padding="{DynamicResource QueryResultPaddingThickness}"> |
| 125 | + <Border.Resources> |
| 126 | + <ws:BindingProxy x:Key="Proxy" Data="{Binding}"/> |
| 127 | + </Border.Resources> |
| 128 | + <Button Command="{Binding InvokeCommand}"> |
| 129 | + <Button.Template> |
| 130 | + <ControlTemplate TargetType="Button"> |
| 131 | + <ContentPresenter Content="{TemplateBinding Content}"/> |
| 132 | + </ControlTemplate> |
| 133 | + </Button.Template> |
136 | 134 |
|
137 |
| - <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> |
138 |
| - <Grid.ColumnDefinitions> |
139 |
| - <ColumnDefinition Width="Auto"/> |
140 |
| - <ColumnDefinition Width="8"/> |
141 |
| - <ColumnDefinition/> |
142 |
| - </Grid.ColumnDefinitions> |
| 135 | + <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> |
| 136 | + <Grid.ColumnDefinitions> |
| 137 | + <ColumnDefinition Width="Auto"/> |
| 138 | + <ColumnDefinition Width="8"/> |
| 139 | + <ColumnDefinition/> |
| 140 | + </Grid.ColumnDefinitions> |
143 | 141 |
|
144 |
| - <Border Width="{DynamicResource QueryResultIconSize}" |
145 |
| - Height="{DynamicResource QueryResultIconSize}" |
146 |
| - CornerRadius="{DynamicResource QueryResultIconCornerRadius}"> |
147 |
| - <Border.Background> |
148 |
| - <ImageBrush Stretch="Uniform" |
149 |
| - ImageSource="{Binding Source={StaticResource Proxy}, Path=Data.Icon}"/> |
150 |
| - </Border.Background> |
151 |
| - </Border> |
| 142 | + <Border Width="{DynamicResource QueryResultIconSize}" |
| 143 | + Height="{DynamicResource QueryResultIconSize}" |
| 144 | + CornerRadius="{DynamicResource QueryResultIconCornerRadius}"> |
| 145 | + <Border.Background> |
| 146 | + <ImageBrush Stretch="Uniform" |
| 147 | + ImageSource="{Binding Source={StaticResource Proxy}, Path=Data.Icon}"/> |
| 148 | + </Border.Background> |
| 149 | + </Border> |
152 | 150 |
|
153 |
| - <Grid Grid.Column="2"> |
154 |
| - <Grid.RowDefinitions> |
155 |
| - <RowDefinition/> |
156 |
| - <RowDefinition/> |
157 |
| - </Grid.RowDefinitions> |
158 |
| - <TextBlock Text="{Binding Title}" |
159 |
| - FontSize="{DynamicResource QueryResultTitleTextSize}" |
160 |
| - Foreground="{DynamicResource TextFillColorPrimaryBrush}"/> |
161 |
| - <TextBlock Grid.Row="1" |
162 |
| - TextTrimming="WordEllipsis" |
163 |
| - Text="{Binding Description}" |
164 |
| - FontSize="{DynamicResource QueryResultDescriptionTextSize}" |
165 |
| - Foreground="{DynamicResource TextFillColorSecondaryBrush}"/> |
166 |
| - </Grid> |
| 151 | + <Grid Grid.Column="2"> |
| 152 | + <Grid.RowDefinitions> |
| 153 | + <RowDefinition/> |
| 154 | + <RowDefinition/> |
| 155 | + </Grid.RowDefinitions> |
| 156 | + <TextBlock Text="{Binding Title}" |
| 157 | + FontSize="{DynamicResource QueryResultTitleTextSize}" |
| 158 | + Foreground="{DynamicResource TextFillColorPrimaryBrush}"/> |
| 159 | + <TextBlock Grid.Row="1" |
| 160 | + TextTrimming="WordEllipsis" |
| 161 | + Text="{Binding Description}" |
| 162 | + FontSize="{DynamicResource QueryResultDescriptionTextSize}" |
| 163 | + Foreground="{DynamicResource TextFillColorSecondaryBrush}"/> |
167 | 164 | </Grid>
|
168 |
| - </Button> |
169 |
| - </Border> |
170 |
| - </DataTemplate> |
171 |
| - </ListView.ItemTemplate> |
172 |
| - <ListView.ItemContainerStyle> |
173 |
| - <Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource {x:Type ListViewItem}}"> |
174 |
| - <Setter Property="BorderThickness" Value="0" /> |
175 |
| - <Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
176 |
| - </Style> |
177 |
| - </ListView.ItemContainerStyle> |
178 |
| - </ListView> |
179 |
| - </condition:IfControl.Then> |
180 |
| - </condition:IfControl> |
| 165 | + </Grid> |
| 166 | + </Button> |
| 167 | + </Border> |
| 168 | + </DataTemplate> |
| 169 | + </ListView.ItemTemplate> |
| 170 | + <ListView.ItemContainerStyle> |
| 171 | + <Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource {x:Type ListViewItem}}"> |
| 172 | + <Setter Property="BorderThickness" Value="0" /> |
| 173 | + <Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
| 174 | + </Style> |
| 175 | + </ListView.ItemContainerStyle> |
| 176 | + </ListView> |
| 177 | + </ws:ConditionalControl> |
181 | 178 | </StackPanel>
|
182 | 179 | </Border>
|
183 | 180 |
|
|
0 commit comments