Ask Your Question
1

How can the white background be removed from Telerik Wpf RadMultiColumnComboBox when it is IsKeyboardFocusWithin?

asked 2021-07-31 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-04-25 14:00:00 +0000

djk gravatar image

To remove the white background from Telerik Wpf RadMultiColumnComboBox when it is IsKeyboardFocusWithin, you can modify its control template by removing the Background property of the PART_EditableTextBox element. Here's an example of how to do it:

  1. Define a new style for the RadMultiColumnComboBox control:
<Style TargetType="telerik:RadMultiColumnComboBox">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="telerik:RadMultiColumnComboBox">
                <Grid x:Name="TemplateRoot">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <telerik:RadDropDownButton x:Name="PART_Button" />
                    <TextBox x:Name="PART_EditableTextBox" Grid.Row="1" />
                    <Popup x:Name="PART_Popup" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
  1. Modify the control template by removing the Background property of the PART_EditableTextBox element:
<ControlTemplate TargetType="telerik:RadMultiColumnComboBox">
    <Grid x:Name="TemplateRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <telerik:RadDropDownButton x:Name="PART_Button" />
        <TextBox x:Name="PART_EditableTextBox" Grid.Row="1"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}"
                 FocusVisualStyle="{x:Null}" />
        <Popup x:Name="PART_Popup" />
    </Grid>
    <ControlTemplate.Triggers>
        <Trigger Property="IsKeyboardFocusWithin" Value="True">
            <Setter TargetName="PART_EditableTextBox" Property="Background" Value="Transparent" />
        </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate>
  1. Set the new style for the RadMultiColumnComboBox control:
<telerik:RadMultiColumnComboBox Style="{StaticResource MyRadMultiColumnComboBoxStyle}" />
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-31 11:00:00 +0000

Seen: 13 times

Last updated: Apr 25 '22