How to set as "Not Editable"

5 posts, 1 answers
  1. Dario Concilio
    Dario Concilio avatar
    128 posts
    Member since:
    Apr 2016

    Posted 20 Sep Link to this post

    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>

  2. Polya
    Admin
    Polya avatar
    199 posts

    Posted 21 Sep Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dario Concilio
    Dario Concilio avatar
    128 posts
    Member since:
    Apr 2016

    Posted 21 Sep in reply to Polya Link to this post

    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?

  5. Answer
    Polya
    Admin
    Polya avatar
    199 posts

    Posted 21 Sep Link to this post

    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.
  6. Dario Concilio
    Dario Concilio avatar
    128 posts
    Member since:
    Apr 2016

    Posted 21 Sep in reply to Polya Link to this post

    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.

Back to Top
UI for WPF is Visual Studio 2017 Ready