WritableComboBox.xaml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <UserControl
  2. x:Class="PDF_Master.CustomControl.WritableComboBox"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PDF_Master.CustomControl"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. d:DesignHeight="24"
  9. d:DesignWidth="200"
  10. Loaded="UserControl_Loaded"
  11. mc:Ignorable="d">
  12. <Grid>
  13. <ComboBox
  14. x:Name="writableComboBox"
  15. Grid.Column="1"
  16. MinWidth="58"
  17. MinHeight="24"
  18. VerticalContentAlignment="Center"
  19. SelectedIndex="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=SelectedIndex}"
  20. SelectionChanged="writableComboBox_SelectionChanged"
  21. Visibility="Visible">
  22. <ComboBoxItem x:Name="AllPageItem" Tag="AllPage" Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=IsAllPageVisible}"/>
  23. <ComboBoxItem x:Name="OddPageItem" Tag="OddPage"/>
  24. <ComboBoxItem x:Name="EvenPageItem" IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=EvenPageIsEnabled}" Tag="EvenPage"/>
  25. <ComboBoxItem x:Name="CustomPageItem" Tag="CustomPage"/>
  26. </ComboBox>
  27. <TextBox
  28. x:Name="writableTextBox"
  29. Grid.Column="0"
  30. MinHeight="{Binding ElementName=writableComboBox, Path=MinHeight}"
  31. BorderBrush="{x:Null}"
  32. BorderThickness="0"
  33. Margin="2"
  34. HorizontalAlignment="Left"
  35. VerticalContentAlignment="Center"
  36. Panel.ZIndex="1"
  37. LostFocus="writableTextBox_LostFocus"
  38. PreviewKeyDown="writableTextBox_PreviewKeyDown"
  39. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=Text}"
  40. TextChanged="writableTextBox_TextChange"
  41. Visibility="Hidden" />
  42. </Grid>
  43. </UserControl>