|
15 | 15 | <converters:MathConverter x:Key="DivisionMathConverter" Operation="Divide" />
|
16 | 16 | <converters:BrushRoundConverter x:Key="BrushRoundConverter" />
|
17 | 17 | <converters:BooleanToVisibilityConverter x:Key="InverseBoolToVisConverter" TrueValue="Collapsed" FalseValue="Visible"/>
|
18 |
| - <converters:TextFieldClearButtonVisibilityConverter x:Key="ClearTextConverter" /> |
| 18 | + <converters:TextFieldClearButtonVisibilityConverter x:Key="ClearButtonVisibilityConverter" /> |
19 | 19 | <converters:NotConverter x:Key="NotConverter" />
|
20 | 20 | <converters:FallbackBrushConverter x:Key="FallbackBrushConverter" />
|
21 | 21 | <converters:RemoveAlphaBrushConverter x:Key="RemoveAlphaBrushConverter" />
|
22 | 22 | <converters:FloatingHintOffsetCalculationConverter x:Key="FloatingHintOffsetCalculationConverter" />
|
23 |
| - <converters:FontToLineHeightConverter x:Key="FontToLineHeightConverter" /> |
| 23 | + <converters:ComboBoxClearButtonMarginConverter x:Key="ComboBoxClearButtonMarginConverter" /> |
| 24 | + <converters:DoubleToThicknessConverter x:Key="DoubleToThicknessConverter" /> |
24 | 25 |
|
25 | 26 | <system:Double x:Key="PopupContentPresenterExtend">4</system:Double>
|
26 | 27 | <system:Double x:Key="PopupTopBottomMargin">8</system:Double>
|
|
328 | 329 |
|
329 | 330 | <Style x:Key="MaterialDesignComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
|
330 | 331 | <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />
|
| 332 | + <Setter Property="Background" Value="Transparent" /> |
331 | 333 | <Setter Property="OverridesDefaultStyle" Value="True" />
|
332 | 334 | <Setter Property="IsTabStop" Value="False" />
|
333 | 335 | <Setter Property="Focusable" Value="False" />
|
|
348 | 350 | BorderBrush="Transparent"
|
349 | 351 | BorderThickness="0">
|
350 | 352 | <Path x:Name="arrow"
|
351 |
| - Width="8" Height="8" |
| 353 | + Width="{x:Static wpf:Constants.ComboBoxArrowSize}" |
| 354 | + Height="{x:Static wpf:Constants.ComboBoxArrowSize}" |
352 | 355 | Margin="0"
|
353 | 356 | Stretch="Uniform"
|
354 | 357 | HorizontalAlignment="Right"
|
|
401 | 404 |
|
402 | 405 | <ControlTemplate x:Key="MaterialDesignFloatingHintComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
403 | 406 | <Grid>
|
404 |
| - <ToggleButton |
405 |
| - x:Name="toggleButton" |
406 |
| - Grid.Column="0" |
407 |
| - Panel.ZIndex="1" |
408 |
| - Background="Transparent" |
409 |
| - BorderBrush="{TemplateBinding BorderBrush}" |
410 |
| - IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
411 |
| - Style="{StaticResource MaterialDesignComboBoxToggleButton}" |
412 |
| - Padding="{TemplateBinding Padding}" /> |
413 | 407 | <AdornerDecorator>
|
414 | 408 | <Border
|
415 | 409 | x:Name="templateRoot"
|
|
482 | 476 | Hint="{TemplateBinding wpf:HintAssist.Hint}"
|
483 | 477 | Margin="{TemplateBinding wpf:TextFieldAssist.TextBoxViewMargin}" />
|
484 | 478 |
|
485 |
| - <StackPanel |
486 |
| - Orientation="Horizontal" |
487 |
| - Grid.Column="2"> |
488 |
| - <TextBlock |
489 |
| - FontSize="{TemplateBinding FontSize}" |
490 |
| - Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}" |
491 |
| - Text="{TemplateBinding wpf:TextFieldAssist.SuffixText}" |
492 |
| - IsHitTestVisible="False" /> |
493 |
| - <Button x:Name="PART_ClearButton" Height="Auto" Padding="2 0 0 0" Style="{DynamicResource MaterialDesignToolButton}" Focusable="False"> |
494 |
| - <Button.Visibility> |
495 |
| - <MultiBinding Converter="{StaticResource ClearTextConverter}"> |
496 |
| - <Binding ElementName="Hint" Path="IsContentNullOrEmpty" Converter="{StaticResource NotConverter}" /> |
497 |
| - <Binding Path="(wpf:TextFieldAssist.HasClearButton)" RelativeSource="{RelativeSource TemplatedParent}" /> |
498 |
| - </MultiBinding> |
499 |
| - </Button.Visibility> |
500 |
| - <wpf:PackIcon Margin="0" Kind="CloseCircle" /> |
501 |
| - </Button> |
502 |
| - </StackPanel> |
| 479 | + <TextBlock |
| 480 | + Grid.Column="2" |
| 481 | + FontSize="{TemplateBinding FontSize}" |
| 482 | + Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}" |
| 483 | + Text="{TemplateBinding wpf:TextFieldAssist.SuffixText}" |
| 484 | + IsHitTestVisible="False" |
| 485 | + Margin="{Binding ActualWidth, ElementName=PART_ClearButton, Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter={x:Static Dock.Right}}" /> |
503 | 486 | </Grid>
|
504 | 487 | </Border>
|
505 | 488 | </Grid>
|
|
559 | 542 | </ScrollViewer>
|
560 | 543 | </ContentControl>
|
561 | 544 | </wpf:ComboBoxPopup>
|
| 545 | + <ToggleButton |
| 546 | + x:Name="toggleButton" |
| 547 | + IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
| 548 | + Style="{StaticResource MaterialDesignComboBoxToggleButton}" |
| 549 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 550 | + Padding="{TemplateBinding Padding}" /> |
| 551 | + <Button |
| 552 | + x:Name="PART_ClearButton" |
| 553 | + Style="{DynamicResource MaterialDesignToolButton}" |
| 554 | + Height="Auto" |
| 555 | + VerticalAlignment="Center" |
| 556 | + HorizontalAlignment="Right" |
| 557 | + Padding="0" |
| 558 | + Focusable="False"> |
| 559 | + <Button.Margin> |
| 560 | + <MultiBinding Converter="{StaticResource ComboBoxClearButtonMarginConverter}"> |
| 561 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Padding" /> |
| 562 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="BorderThickness" /> |
| 563 | + </MultiBinding> |
| 564 | + </Button.Margin> |
| 565 | + <Button.Visibility> |
| 566 | + <MultiBinding Converter="{StaticResource ClearButtonVisibilityConverter}"> |
| 567 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="(wpf:TextFieldAssist.HasClearButton)" /> |
| 568 | + <Binding ElementName="Hint" Path="IsContentNullOrEmpty" /> |
| 569 | + </MultiBinding> |
| 570 | + </Button.Visibility> |
| 571 | + <wpf:PackIcon Margin="0" Kind="CloseCircle" /> |
| 572 | + </Button> |
562 | 573 | </Grid>
|
563 | 574 |
|
564 | 575 | <ControlTemplate.Triggers>
|
|
756 | 767 |
|
757 | 768 | <ControlTemplate x:Key="MaterialDesignFilledComboBoxTemplate" TargetType="{x:Type ComboBox}">
|
758 | 769 | <Grid>
|
759 |
| - <ToggleButton |
760 |
| - x:Name="toggleButton" |
761 |
| - Panel.ZIndex="1" |
762 |
| - Background="Transparent" |
763 |
| - BorderBrush="{TemplateBinding BorderBrush}" |
764 |
| - IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
765 |
| - Style="{StaticResource MaterialDesignComboBoxToggleButton}" |
766 |
| - Padding="{TemplateBinding Padding}" /> |
767 | 770 | <AdornerDecorator>
|
768 | 771 | <Border
|
769 | 772 | x:Name="templateRoot"
|
|
834 | 837 | Hint="{TemplateBinding wpf:HintAssist.Hint}"
|
835 | 838 | Margin="{TemplateBinding wpf:TextFieldAssist.TextBoxViewMargin}" />
|
836 | 839 |
|
837 |
| - <StackPanel Orientation="Horizontal" Grid.Column="2"> |
838 |
| - <TextBlock |
839 |
| - x:Name="SuffixTextBlock" |
840 |
| - FontSize="{TemplateBinding FontSize}" |
841 |
| - Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}" |
842 |
| - Text="{TemplateBinding wpf:TextFieldAssist.SuffixText}" |
843 |
| - IsHitTestVisible="False" /> |
844 |
| - <Button x:Name="PART_ClearButton" Height="Auto" Padding="2 0 0 0" Style="{DynamicResource MaterialDesignToolButton}" Focusable="False"> |
845 |
| - <Button.Visibility> |
846 |
| - <MultiBinding Converter="{StaticResource ClearTextConverter}"> |
847 |
| - <Binding ElementName="Hint" Path="IsContentNullOrEmpty" Converter="{StaticResource NotConverter}" /> |
848 |
| - <Binding Path="(wpf:TextFieldAssist.HasClearButton)" RelativeSource="{RelativeSource TemplatedParent}" /> |
849 |
| - </MultiBinding> |
850 |
| - </Button.Visibility> |
851 |
| - <wpf:PackIcon Margin="0" Kind="CloseCircle" /> |
852 |
| - </Button> |
853 |
| - </StackPanel> |
| 840 | + <TextBlock |
| 841 | + Grid.Column="2" |
| 842 | + x:Name="SuffixTextBlock" |
| 843 | + FontSize="{TemplateBinding FontSize}" |
| 844 | + Opacity="{TemplateBinding wpf:HintAssist.HintOpacity}" |
| 845 | + Text="{TemplateBinding wpf:TextFieldAssist.SuffixText}" |
| 846 | + IsHitTestVisible="False" |
| 847 | + Margin="{Binding ActualWidth, ElementName=PART_ClearButton, Converter={StaticResource DoubleToThicknessConverter}, ConverterParameter={x:Static Dock.Right}}" /> |
854 | 848 | </Grid>
|
855 | 849 | </Border>
|
856 | 850 | </Grid>
|
|
908 | 902 | </ScrollViewer>
|
909 | 903 | </ContentControl>
|
910 | 904 | </wpf:ComboBoxPopup>
|
| 905 | + <ToggleButton |
| 906 | + x:Name="toggleButton" |
| 907 | + IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" |
| 908 | + Style="{StaticResource MaterialDesignComboBoxToggleButton}" |
| 909 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 910 | + Padding="{TemplateBinding Padding}" /> |
| 911 | + <Button |
| 912 | + x:Name="PART_ClearButton" |
| 913 | + Style="{DynamicResource MaterialDesignToolButton}" |
| 914 | + Height="Auto" |
| 915 | + VerticalAlignment="Center" |
| 916 | + HorizontalAlignment="Right" |
| 917 | + Padding="0" |
| 918 | + Focusable="False"> |
| 919 | + <Button.Margin> |
| 920 | + <MultiBinding Converter="{StaticResource ComboBoxClearButtonMarginConverter}"> |
| 921 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Padding" /> |
| 922 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="BorderThickness" /> |
| 923 | + </MultiBinding> |
| 924 | + </Button.Margin> |
| 925 | + <Button.Visibility> |
| 926 | + <MultiBinding Converter="{StaticResource ClearButtonVisibilityConverter}"> |
| 927 | + <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="(wpf:TextFieldAssist.HasClearButton)" /> |
| 928 | + <Binding ElementName="Hint" Path="IsContentNullOrEmpty" /> |
| 929 | + </MultiBinding> |
| 930 | + </Button.Visibility> |
| 931 | + <wpf:PackIcon Margin="0" Kind="CloseCircle" /> |
| 932 | + </Button> |
911 | 933 | </Grid>
|
912 | 934 | <ControlTemplate.Triggers>
|
913 | 935 | <Trigger Property="IsEnabled" Value="False">
|
|
0 commit comments