CPDFSearchInputUI.xaml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <UserControl x:Class="Compdfkit_Tools.PDFControlUI.CPDFSearchInputUI"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:Compdfkit_Tools.PDFControlUI"
  7. xmlns:common="clr-namespace:Compdfkit_Tools.Common"
  8. mc:Ignorable="d">
  9. <UserControl.Resources>
  10. <ResourceDictionary>
  11. <common:TextLengthToVisibilityConverter x:Key="TextLengthToVisibilityConverter"/>
  12. <common:InvertTextLengthToVisibilityConverter x:Key="InvertTextLengthToVisibilityConverter"/>
  13. <common:TextLengthToBoolConverter x:Key="TextLengthToBoolConverter"/>
  14. <ResourceDictionary.MergedDictionaries>
  15. <ResourceDictionary Source="../../../Asset/Styles/ButtonStyle.xaml"></ResourceDictionary>
  16. </ResourceDictionary.MergedDictionaries>
  17. </ResourceDictionary>
  18. </UserControl.Resources>
  19. <Grid Margin="5">
  20. <Grid.ColumnDefinitions>
  21. <ColumnDefinition Width="*"></ColumnDefinition>
  22. <ColumnDefinition Width="auto"></ColumnDefinition>
  23. </Grid.ColumnDefinitions>
  24. <Grid Margin="0,0,8,0">
  25. <TextBox Name="SearchTextBox" VerticalContentAlignment="Center" TextChanged="SearchTextBox_TextChanged" Height="30" KeyDown="SearchTextBox_KeyDown" Padding="5,0,30,0"></TextBox>
  26. <TextBlock VerticalAlignment="Center" IsHitTestVisible="False" Margin="10,0,0,0"
  27. Visibility="{Binding ElementName=SearchTextBox,Path=Text,Converter={StaticResource TextLengthToVisibilityConverter}}">Search</TextBlock>
  28. <Border Visibility="{Binding ElementName=SearchTextBox,Path=Text,Converter={StaticResource InvertTextLengthToVisibilityConverter}}"
  29. HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"
  30. Background="#01000000" MouseLeftButtonDown="TextClear_MouseLeftButtonDown">
  31. <Path Fill="Black" IsHitTestVisible="False">
  32. <Path.Data>
  33. M12.5762 3.95117L8.5332 8L12.5762 12.0488L12.0488 12.5762L8 8.5332L3.95117 12.5762L3.42383 12.0488L7.4668 8L3.42383 3.95117L3.95117 3.42383L8 7.4668L12.0488 3.42383L12.5762 3.95117Z
  34. </Path.Data>
  35. </Path>
  36. </Border>
  37. </Grid>
  38. <Button Name="SearchBtn" Style="{StaticResource ButtonStyle}" Grid.Column="1" Width="56" Height="30" FontSize="14" Click="SearchBtn_Click"
  39. IsEnabled="{Binding ElementName=SearchTextBox,Path=Text,Converter={StaticResource TextLengthToBoolConverter}}">
  40. Done
  41. </Button>
  42. </Grid>
  43. </UserControl>