added url search for giphy, install wizard, fixed ui and added minor changes
This commit is contained in:
@@ -152,11 +152,32 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="0" Background="#2B2D31" CornerRadius="8">
|
||||
<TextBox x:Name="SearchBox"
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="Transparent" Foreground="White" BorderThickness="0"
|
||||
Padding="10,7" FontSize="14"
|
||||
CaretBrush="White"/>
|
||||
<Grid>
|
||||
<TextBox x:Name="SearchBox"
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="Transparent" Foreground="White" BorderThickness="0"
|
||||
Padding="10,7" FontSize="14"
|
||||
CaretBrush="White"/>
|
||||
<!-- WPF has no native placeholder, so this sits behind the caret and
|
||||
hides as soon as anything is typed. Not hit-testable, so clicking
|
||||
it still focuses the box underneath. -->
|
||||
<TextBlock Text="{Binding SearchPlaceholder}"
|
||||
Foreground="#6E7078" FontSize="14"
|
||||
Margin="11,0,10,0" VerticalAlignment="Center"
|
||||
IsHitTestVisible="False"
|
||||
TextTrimming="CharacterEllipsis">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SearchText}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Button Grid.Column="1" Content="+" Width="36" Height="36" Margin="8,0,0,0"
|
||||
FontSize="18" Style="{StaticResource FlatButtonStyle}"
|
||||
@@ -165,7 +186,8 @@
|
||||
ToolTip="Add memes"/>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto" Padding="0,0,4,0">
|
||||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto" Padding="0,0,4,0"
|
||||
ScrollChanged="ResultsScrollViewer_OnScrollChanged">
|
||||
<StackPanel>
|
||||
<!-- Favourites for the active source. Scrolls with the content rather than
|
||||
being pinned, so it doesn't permanently eat height in a 520px window. -->
|
||||
|
||||
@@ -99,6 +99,22 @@ public partial class PickerWindow : Window
|
||||
Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the next page of remote results once the user scrolls near the bottom, so Giphy
|
||||
/// browsing continues instead of stopping at the first batch. The view model guards against
|
||||
/// overlapping or unnecessary calls, so firing this on every scroll tick is safe.
|
||||
/// </summary>
|
||||
private void ResultsScrollViewer_OnScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
if (sender is not ScrollViewer viewer || viewer.ScrollableHeight <= 0) return;
|
||||
|
||||
const double triggerDistanceFromBottom = 250;
|
||||
if (viewer.VerticalOffset >= viewer.ScrollableHeight - triggerDistanceFromBottom)
|
||||
{
|
||||
_ = _viewModel.LoadMoreAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private void PickerWindow_OnContextMenuOpening(object sender, ContextMenuEventArgs e) => _isContextMenuOpen = true;
|
||||
|
||||
private void PickerWindow_OnContextMenuClosing(object sender, ContextMenuEventArgs e) => _isContextMenuOpen = false;
|
||||
|
||||
Reference in New Issue
Block a user