Resource xaml for RadDatePicker

2 posts, 0 answers
  1. Frank
    Frank avatar
    27 posts
    Member since:
    May 2011

    Posted 06 Jul 2011 Link to this post

    Hello,

    im using Datepicker in RadGridView. Im going to write a Resource .xaml for all RadDatePickers. So that I have to change the property only in one .xaml if necessary. I tried this way:
     
    <Setter Property="ErrorTooltipContent" Value="Error for Example">
               <DataTemplate>
                        <TextBlock Text="{Binding Path=ToolTipConten, ElementName=radDateTimePicker}"
                                   FontWeight="Bold"
                                   Foreground="Red"/>
                    </DataTemplate>
               
            </Setter>


     But it doesnt work...Its the same with Watermarkcontent. How can I solve it?

    Best regards
    Christian
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 11 Jul 2011 Link to this post

    Hello Christian,

    In order to set a DataTemplate to the WaterMark you need to apply it through the DateTimeWatermarkTemplate property, like so:

    <Style x:Key="DatePickerStyle" TargetType="telerik:RadDateTimePicker">
               <Setter Property="DateTimeWatermarkTemplate">
                   <Setter.Value>
                       <DataTemplate>
                           <TextBlock Text="WaterMarkText"
                                  FontWeight="Bold"
                                  Foreground="Red"/>
                       </DataTemplate>
                   </Setter.Value>
               </Setter>
           </Style>

    Also, in the DataTemplate binding with the ElementName set to the control is not supported, as it is in different namescope. Binding with ElementName can exist only if the name is inside the DataTemplate.
    Unfortunately, there is no property to which the ErrorToolTip template can be set. You can only set the Content of the ErrorToolTip.

    Hope this information helps.

    Greetings,
    Konstantina
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft banner
Back to Top