Localization

2 posts, 0 answers
  1. JULIA
    JULIA avatar
    62 posts
    Member since:
    Jun 2011

    Posted 09 Sep 2010 Link to this post

    Hi,

    I'm using a RadTimePicker in a ControlTemplate and would like to set "DateTimeWatermarkContent" to another value. Unfortunately the value is not used and shows still "Enter time". Also I would like to change the Header on the drop down clock which has value "Clock".

    Here the code:

    <ContentControl Grid.Row="1" Grid.Column="1" Width="80" Style="{StaticResource styleContentControlTime}" Content="{Binding OfficeHour.MondayOpen, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></ContentControl>

    here the style:

     <Style x:Key="styleContentControlTime" TargetType="ContentControl">
            <Setter Property="IsTabStop" Value="false"></Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding  Path=InEditMode}" Value="true">
                    <Setter Property="ContentControl.Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                    <telerik:RadTimePicker SelectedValue="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}, Path=Content, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                                                           Margin="10,3" DateTimeWatermarkContent="" >
                                    </telerik:RadTimePicker>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>

                <DataTrigger Binding="{Binding  Path=InEditMode}" Value="false">
                    <Setter Property="ContentControl.Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Grid >
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}, Path=Content, Converter={StaticResource dateTimeToTimeStringConverter}}"
                                               Style="{StaticResource styleTextBlock}" VerticalAlignment="Center"></TextBlock>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>

    regrads,
    Timo
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 13 Sep 2010 Link to this post

    Hello Timo,

    Find the code snippet bellow as a recommended approach to set a WatermarkContnet and custom clock header property(you need to expose the ClockStyle property of the picker control).

    <Style x:Key="styleContentControlTime" TargetType="ContentControl">
        <Setter Property="IsTabStop" Value="false"></Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding  Path=InEditMode}" Value="true">
                <Setter Property="ContentControl.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <telerik:RadDateTimePicker InputMode="TimePicker"
                                        SelectedValue="{Binding Content,RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
                                        Margin="10,3"
                                        DateTimeWatermarkContent="test watermark content">
                                    <telerik:RadDateTimePicker.ClockStyle>
                                        <Style TargetType="telerik:RadClock">
                                            <Setter Property="Header" Value="Some Custom Header" />
                                        </Style>
                                    </telerik:RadDateTimePicker.ClockStyle>
                                </telerik:RadDateTimePicker>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
            <DataTrigger Binding="{Binding  Path=InEditMode}" Value="false">
                <Setter Property="ContentControl.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid>
                                <TextBlock
                                        Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}, Path=Content, Converter={StaticResource dateTimeToTimeStringConverter}}"
                                        Style="{StaticResource styleTextBlock}"
                                        VerticalAlignment="Center"></TextBlock>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>


    Kind regards,
    Kaloyan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top