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

How to set as "Not Editable"

4 Answers 881 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 20 Sep 2016, 07:43 AM

Hi to all,

I don't understand wich property I have to set a not-editable combobox.

I've attached view in readonly-mode also. I hope it is clarifier.

I tryed with trigger and set IsReadOnly property, but ComboBox is still editable (I can't edit, but I can selected by dropdown)

 

01.<Style x:Key="FieldLongComboBoxStyle" TargetType="telerik:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}">
02.        <Setter Property="Margin" Value="5"/>
03.        <Setter Property="IsEditable" Value="True"/>
04.        <Setter Property="ClearSelectionButtonVisibility" Value="Visible"/>
05.        <Setter Property="ClearSelectionButtonContent" Value="Cancella selezione"/>
06.        <Setter Property="TextSearchMode" Value="StartsWith"/>
07.        <Setter Property="EmptyText" Value="Valore non selezionato"/>
08.        <Setter Property="Width" Value="200"/>
09.        <Setter Property="HorizontalAlignment" Value="Left"/>
10.        <Style.Triggers>
11.            <DataTrigger Binding="{Binding CantUpdateModel}" Value="True">
12.                <Setter Property="IsReadOnly" Value="True"/>
13.            </DataTrigger>
14.            <DataTrigger Binding="{Binding CantUpdateModel}" Value="False">
15.                <Setter Property="IsReadOnly" Value="False"/>
16.            </DataTrigger>
17.        </Style.Triggers>
18.    </Style>

4 Answers, 1 is accepted

Sort by
0
Polya
Telerik team
answered on 21 Sep 2016, 12:20 PM
Hello Dario,

From what I understand you wish to prevent users from typing and selecting items in the RadComboBox.

If my assumption is correct I suggest that you use IsEnabled="False" instead of IsReadOnly property in order to achieve the desired behavior.

Regards,
Polya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 21 Sep 2016, 01:52 PM

I know.

I was thinking a different approach because I need to keep not-editability style.

If I disable a control, the content changes of style, making it unreadable. I would like this content to be readable.

I have to create a specific style that replaces the one for the disabled control, is it correct?

0
Accepted
Polya
Telerik team
answered on 21 Sep 2016, 02:35 PM
Hi Dario,

So if I understand correctly - you need the RadComboBox to be displayed normally, but behave as if it is not enabled (i.e. as if IsEnabled="False"). 
If so, you can use set the IsHitTestVisible property to False. Thus the control will not respond to user mouse input and disable the selection with click.
Let us know whether this approach works for you. 

Regards,
Polya
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dario Concilio
Top achievements
Rank 2
answered on 21 Sep 2016, 03:21 PM
Ok it's works.

I just apply a style.

I made like appearance's control as Office2013 theme. (In this theme, if control has IsreadOnly = True shows FontWeight = Bold)

Thank you Polya.

Tags
ComboBox
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Polya
Telerik team
Dario Concilio
Top achievements
Rank 2
Share this question
or