This is a migrated thread and some comments may be shown as answers.

how to stop applying disable style ?

3 Answers 1222 Views
WatermarkTextBox
This is a migrated thread and some comments may be shown as answers.
Ragavan
Top achievements
Rank 1
Ragavan asked on 01 Feb 2016, 04:07 PM

i don't want to apply default disable style  while IsEnabled="False" .

after this i get unwanted gray background . how to disable this styles 

3 Answers, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 03 Feb 2016, 08:46 AM
Hello Ragavan,

In order to achieve the desired approach, you need to modify the control template of RadWatermarkTextBox. Inside it look for the VisualState named "Disabled" and remove its content. This way you will have no style for RadWatermarkTextBox in its disabled state.

I've created a sample demo where the approach is demonstrated.

Regards,
Masha
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ragavan
Top achievements
Rank 1
answered on 03 Feb 2016, 03:41 PM

i'm using RadAutocompleteBox inside the template RadWaterMarkTextBox was rendered , style was not applied for RadWaterMarkTextbox 

 How to apply style for inside AutoCompleteBoxesWrapPanel -> RadWaterMarkTextBox  control ?

             

<telerik:AutoCompleteBoxesItemsControl x:Name="PART_Boxes"<br>                                                                   Height="{TemplateBinding Height}"<br>                                                                   Margin="{TemplateBinding Padding}"<br>                                                                   BoxesItemTemplate="{TemplateBinding BoxesItemTemplate}"<br>                                                                   DisplayMemberPath="{TemplateBinding DisplayMemberPath}"<br>                                                                   Foreground="{TemplateBinding Foreground}"<br>                                                                   IsTabStop="False"<br>                                                                   ScrollViewer.HorizontalScrollBarVisibility="Disabled"<br>                                                                   ScrollViewer.VerticalScrollBarVisibility="Disabled"><br>                                <telerik:AutoCompleteBoxesItemsControl.ItemsPanel><br>                                    <ItemsPanelTemplate><br>                                        <telerik:AutoCompleteBoxesWrapPanel Width="{Binding ActualWidth, ElementName=WatermarkTextBox}" /><br>                                    </ItemsPanelTemplate><br>                                </telerik:AutoCompleteBoxesItemsControl.ItemsPanel><br>                            </telerik:AutoCompleteBoxesItemsControl>

 

0
Masha
Telerik team
answered on 05 Feb 2016, 08:48 AM
Hello Ragavan,

In order to removed the gray background when RadAutocompleteBox is disabled, you need to modify the control template of RadAutocompleteBox not for RadWatermarkTextBox. Please check the code snippet below:

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/System.Windows.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.xaml"/>
            <ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
        </ResourceDictionary.MergedDictionaries>
 
        <ControlTemplate x:Key="RadAutoCompleteBoxTemplate" TargetType="telerik:RadAutoCompleteBox">
            <Grid>
                <VisualStateManager.VisualStateGroups>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal"/>
                        <VisualState x:Name="MouseOver">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual"/>
                            </Storyboard>
                        </VisualState>
                        <VisualState x:Name="Disabled">
                            <Storyboard>
                                <!--<DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity" To="0.6"/>-->
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                    <VisualStateGroup x:Name="FocusStates">
                        <VisualState x:Name="Unfocused"/>
                        <VisualState x:Name="Focused">
                            <Storyboard>
                                <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
                            </Storyboard>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateManager.VisualStateGroups>
                <Border x:Name="Border"
                BorderBrush="{TemplateBinding BorderBrush}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Background="{TemplateBinding Background}"
                CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"/>
                <Border x:Name="MouseOverVisual"
                BorderBrush="{StaticResource ControlOuterBorder_MouseOver}"
                CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Opacity="0"/>
                <Border x:Name="FocusVisual"
                Opacity="0"
                IsHitTestVisible="False"
                CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
                Background="{TemplateBinding Background}"
                BorderThickness="{TemplateBinding BorderThickness}"
                BorderBrush="{StaticResource ControlOuterBorder_Focused}">
                    <Border BorderBrush="{StaticResource ControlInnerBorder_Focused}" CornerRadius="{StaticResource SplitButton_SpanInnerCornerRadius}" BorderThickness="{TemplateBinding BorderThickness}"/>
                </Border>
                <Border x:Name="DisabledVisualElement"
                BorderBrush="{StaticResource ControlOuterBorder_Disabled}"
                BorderThickness="{TemplateBinding BorderThickness}"
                Background="{StaticResource ControlBackground_Disabled}"
                CornerRadius="{StaticResource ControlOuterBorder_CornerRadius}"
                IsHitTestVisible="False"
                Opacity="0"/>
                <ScrollViewer x:Name="PART_ScrollViewer"
                Height="{TemplateBinding Height}"
                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                BorderThickness="0"
                Background="Transparent"
                Padding="0"
                IsTabStop="False"
                HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                Margin="{TemplateBinding BorderThickness}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                    <telerik:AutoCompleteBoxesItemsControl x:Name="PART_Boxes"
                    DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
                    BoxesItemTemplate="{TemplateBinding BoxesItemTemplate}"
                    BoxesItemTemplateSelector="{TemplateBinding BoxesItemTemplateSelector}"
                    BoxesItemStyle="{TemplateBinding BoxesItemStyle}"
                    BoxesItemStyleSelector="{TemplateBinding BoxesItemStyleSelector}"
                    IsTabStop="False"
                    Foreground="{TemplateBinding Foreground}"
                    Margin="{TemplateBinding Padding}">
                        <telerik:AutoCompleteBoxesItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <telerik:AutoCompleteBoxesWrapPanel Width="{Binding ActualWidth, ElementName=WatermarkTextBox}"/>
                            </ItemsPanelTemplate>
                        </telerik:AutoCompleteBoxesItemsControl.ItemsPanel>
                    </telerik:AutoCompleteBoxesItemsControl>
                </ScrollViewer>
                <Popup x:Name="PART_Popup">
                    <Grid x:Name="PopupRoot">
                        <telerik:RadListBox x:Name="PART_ListBox"
                        ItemsSource="{TemplateBinding FilteredItems}"
                        ItemTemplate="{TemplateBinding DropDownItemTemplate}"
                        MinWidth="{TemplateBinding MinDropDownWidth}"
                        MaxHeight="{TemplateBinding MaxDropDownHeight}"
                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Grid>
                </Popup>
            </Grid>
        </ControlTemplate>
 
        <Style TargetType="telerik:RadAutoCompleteBox" BasedOn="{StaticResource RadAutoCompleteBoxStyle}">
            <Setter Property="Template" Value="{StaticResource RadAutoCompleteBoxTemplate}" />
        </Style>
    </ResourceDictionary>
</Application.Resources>

I hope it helps.

Regards,
Masha
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
WatermarkTextBox
Asked by
Ragavan
Top achievements
Rank 1
Answers by
Masha
Telerik team
Ragavan
Top achievements
Rank 1
Share this question
or