WritableComboBox.xaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <UserControl
  2. x:Class="PDF_Office.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_Office.CustomControl"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. d:DesignHeight="24"
  9. d:DesignWidth="200"
  10. mc:Ignorable="d">
  11. <Grid>
  12. <ComboBox
  13. x:Name="writableComboBox"
  14. Grid.Column="1"
  15. MinWidth="58"
  16. MinHeight="24"
  17. VerticalContentAlignment="Center"
  18. SelectionChanged="writableComboBox_SelectionChanged"
  19. SelectedIndex="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=SelectedIndex}"
  20. Visibility="Visible">
  21. <ComboBoxItem Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=IsAllPageVisible}">全部页面</ComboBoxItem>
  22. <ComboBoxItem>奇数页</ComboBoxItem>
  23. <ComboBoxItem IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=EvenPageIsEnabled}">偶数页</ComboBoxItem>
  24. <ComboBoxItem>自定义页面</ComboBoxItem>
  25. </ComboBox>
  26. <TextBox
  27. x:Name="writableTextBox"
  28. Grid.Column="0"
  29. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:WritableComboBox}, Path=Text}"
  30. MinHeight="{Binding ElementName=writableComboBox, Path=MinHeight}"
  31. HorizontalAlignment="Left"
  32. VerticalContentAlignment="Center"
  33. TextChanged="writableTextBox_TextChange"
  34. Visibility="Hidden"
  35. Panel.ZIndex="1"
  36. />
  37. </Grid>
  38. </UserControl>