WritableComboBoxControl.xaml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. <local:DocEditorResourceConverter x:Key="DocEditorResourceConverter"></local:DocEditorResourceConverter>
  16. </ResourceDictionary>
  17. </UserControl.Resources>
  18. <Grid>
  19. <Grid.ColumnDefinitions>
  20. <ColumnDefinition/>
  21. <ColumnDefinition Width="20"/>
  22. </Grid.ColumnDefinitions>
  23. <ComboBox
  24. x:Name="ComboBox"
  25. MinHeight="24"
  26. MinWidth="60"
  27. VerticalContentAlignment="Center"
  28. Grid.ColumnSpan="2"
  29. SelectedIndex="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBoxControl}, Path=SelectedIndex}"
  30. SelectionChanged ="ComboBox_SelectionChanged"
  31. Style="{StaticResource ComboBoxStyle1}">
  32. <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_All}" Tag="AllPages"></ComboBoxItem>
  33. <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_Odd}" Tag="OddPages"></ComboBoxItem>
  34. <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_Even}" Tag="EvenPages"></ComboBoxItem>
  35. <ComboBoxItem Content="{Binding Converter={StaticResource DocEditorResourceConverter},ConverterParameter=Range_Custom}" Tag="CustomPages"></ComboBoxItem>
  36. </ComboBox>
  37. <TextBox
  38. x:Name="TextBox"
  39. MinHeight="{Binding ElementName=ComboBox, Path=MinHeight}"
  40. BorderBrush="{x:Null}"
  41. BorderThickness="0"
  42. Panel.ZIndex="1"
  43. Margin="2"
  44. Background="#CCCCCC"
  45. PreviewKeyDown="TextBox_PreviewKeyDown"
  46. InputMethod.IsInputMethodEnabled="False"
  47. PreviewTextInput="TextBox_PreviewTextInput"
  48. TextChanged="TextBox_TextChanged"
  49. VerticalContentAlignment="Center"
  50. Visibility="Hidden"></TextBox>
  51. </Grid>
  52. </UserControl>