CommonWritableComboBox.xaml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <UserControl x:Class="PDF_Master.CustomControl.CommonWritableComboBox"
  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:PDF_Master.CustomControl"
  7. mc:Ignorable="d"
  8. d:DesignHeight="32" d:DesignWidth="66">
  9. <UserControl.Resources>
  10. <Style x:Key="PagesView_txtContext" TargetType="{x:Type TextBox}">
  11. <Setter Property="Template">
  12. <Setter.Value>
  13. <ControlTemplate TargetType="{x:Type TextBox}">
  14. <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
  15. Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
  16. <ScrollViewer x:Name="PART_ContentHost"/>
  17. </Border>
  18. <ControlTemplate.Triggers>
  19. <Trigger Property="IsEnabled" Value="false">
  20. <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
  21. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  22. </Trigger>
  23. </ControlTemplate.Triggers>
  24. </ControlTemplate>
  25. </Setter.Value>
  26. </Setter>
  27. </Style>
  28. </UserControl.Resources>
  29. <Border CornerRadius="1" BorderBrush="Black" BorderThickness="1,1,1,1" Panel.ZIndex="2">
  30. <Grid>
  31. <Grid.ColumnDefinitions>
  32. <ColumnDefinition Width="*"></ColumnDefinition>
  33. <ColumnDefinition Width="16"></ColumnDefinition>
  34. </Grid.ColumnDefinitions>
  35. <TextBox Name="TextBox_Num"
  36. MinHeight="28"
  37. Grid.Column="0"
  38. Padding="16,0,0,0"
  39. VerticalContentAlignment="Center"
  40. Background="#F3F3F3"
  41. BorderThickness="0"
  42. FontFamily="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CommonWritableComboBox}, Path=FontFamily}"
  43. FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CommonWritableComboBox}, Path=FontSize}"
  44. Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CommonWritableComboBox}, Path=Foreground}"
  45. InputMethod.IsInputMethodEnabled="False"
  46. PreviewTextInput="CountTextBox_PreviewTextInput"
  47. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CommonWritableComboBox}, Path=Text}"
  48. TextAlignment="Left"
  49. KeyDown="CurrentPage_KeyDown"
  50. TextChanged="TextBox_Num_TextChanged"
  51. Panel.ZIndex="1"
  52. Style="{StaticResource PagesView_txtContext}">
  53. </TextBox>
  54. <ComboBox Name="ComboBox_Type" MinHeight="28" MinWidth="64" HorizontalAlignment="Right" BorderThickness="00" Background="#F3F3F3" Grid.Column="0" Grid.ColumnSpan="2" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CommonWritableComboBox}, Path=TypeSouce}" Panel.ZIndex="0"
  55. >
  56. </ComboBox>
  57. </Grid>
  58. </Border>
  59. </UserControl>