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

Disable DropDownButton in readonly mode of the DataForm

4 Answers 138 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Björn
Top achievements
Rank 1
Björn asked on 05 Aug 2011, 01:35 PM
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.

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 Aug 2011, 04:01 PM
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 >>

0
Björn
Top achievements
Rank 1
answered on 09 Sep 2011, 09:33 AM
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.



0
Yana
Telerik team
answered on 15 Sep 2011, 12:20 PM
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 >>

0
Björn
Top achievements
Rank 1
answered on 15 Sep 2011, 12:49 PM
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.
Tags
DateTimePicker
Asked by
Björn
Top achievements
Rank 1
Answers by
Yana
Telerik team
Björn
Top achievements
Rank 1
Share this question
or