Disable DropDownButton in readonly mode of the DataForm

5 posts, 0 answers
  1. Björn
    Björn avatar
    23 posts
    Member since:
    Mar 2011

    Posted 05 Aug 2011 Link to this post

    I use the DateTimePicker in the EditTemplate of the DataForm:
    <toolkit:DataField PropertyPath="Startdate">
        <telerikInput:RadDateTimePicker InputMode="DatePicker"
            SelectedDate="{Binding Startdate, Mode=TwoWay}" DateTimeWatermarkContent=""/>
    </toolkit:DataField>

    In the readonly mode of the DataForm the textbox of the DateTimePicker is disabled, BUT the DropDownButton is still enabled.
    How to disable the DropDownButton?

    Thanks
    Björn.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Aug 2011 Link to this post

    Hi Björn,

    Actually this is the default behavior of RadDateTimePicker in read-only mode -  the calendar is opened, but you cannot select a date. You could edit the ControlTemplate of RadDateTimePicker and add the binding to the DropDownButton IsReadOnly property. Please check here and here for more details.

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Björn
    Björn avatar
    23 posts
    Member since:
    Mar 2011

    Posted 09 Sep 2011 Link to this post

    Hi Yana
    Sorry for the delay. It's not so clear what you mean. I made following:
    1. create in Blend a copy of the style
    2. set in the xaml:
    <telerik:RadDropDownButton x:Name="PART_DropDownButton" IsEnabled="{TemplateBinding IsReadOnly}" 
    => that works in the opposite way
    3. want to use a converter
    IsEnabled="{TemplateBinding IsReadOnly, Converter={StaticResource NotOperatorValueConverter}}"
    
    => but that's not possible!

    What's the best way to bind IsEnabled to the IsReadOnly of the control?

    Thanks
    Björn.



  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 15 Sep 2011 Link to this post

    Hello Björn,

    Please try it like this:

    <telerik:RadDropDownButton x:Name="PART_DropDownButton"
    IsEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsReadOnly, Converter={StaticResource InvertedBooleanConverter}}"
    ...
    </telerik:RadDropDownButton>

    where InvertedBooleanConverter is defined like this:

    <telerik:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />

    Hope this helps.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Björn
    Björn avatar
    23 posts
    Member since:
    Mar 2011

    Posted 15 Sep 2011 Link to this post

    Hi Yana
    I found a solution to set the RadDateTimePicker.IsEnabled=false in the DataForm, when the DataForm is in the readonly mode.
    Regards and thanks for the help
    Björn.
Back to Top
DevCraft banner