WritableComboBoxControl.xaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <UserControl x:Class="Compdfkit_Tools.Common.WritableComboBoxControl"
  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.Common"
  7. mc:Ignorable="d"
  8. d:DesignHeight="24"
  9. d:DesignWidth="200">
  10. <UserControl.Resources>
  11. <ResourceDictionary>
  12. <ResourceDictionary.MergedDictionaries>
  13. <ResourceDictionary Source="../../Asset/Styles/ComboBoxStyle.xaml"></ResourceDictionary>
  14. </ResourceDictionary.MergedDictionaries>
  15. </ResourceDictionary>
  16. </UserControl.Resources>
  17. <Grid>
  18. <Grid.ColumnDefinitions>
  19. <ColumnDefinition/>
  20. <ColumnDefinition Width="20"/>
  21. </Grid.ColumnDefinitions>
  22. <ComboBox
  23. x:Name="ComboBox"
  24. MinHeight="24"
  25. MinWidth="60"
  26. VerticalContentAlignment="Center"
  27. Grid.ColumnSpan="2"
  28. SelectedIndex="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBoxControl}, Path=SelectedIndex}"
  29. SelectionChanged ="ComboBox_SelectionChanged"
  30. Style="{StaticResource ComboBoxStyle1}">
  31. <ComboBoxItem Content="All Pages" Tag="AllPages"></ComboBoxItem>
  32. <ComboBoxItem Content="Odd Pages" Tag="OddPages"></ComboBoxItem>
  33. <ComboBoxItem Content="Even Pages" Tag="EvenPages"></ComboBoxItem>
  34. <ComboBoxItem Content="Custom Pages" Tag="CustomPages"></ComboBoxItem>
  35. </ComboBox>
  36. <TextBox
  37. x:Name="TextBox"
  38. MinHeight="{Binding ElementName=ComboBox, Path=MinHeight}"
  39. BorderBrush="{x:Null}"
  40. BorderThickness="0"
  41. Panel.ZIndex="1"
  42. Margin="2"
  43. Background="#CCCCCC"
  44. PreviewKeyDown="TextBox_PreviewKeyDown"
  45. InputMethod.IsInputMethodEnabled="False"
  46. PreviewTextInput="TextBox_PreviewTextInput"
  47. TextChanged="TextBox_TextChanged"
  48. VerticalContentAlignment="Center"
  49. Visibility="Hidden"></TextBox>
  50. </Grid>
  51. </UserControl>