I've got a RadMaskedDateTimeInput control that I use in a UserControl in my application. My UserControl consists of the RadMaskedDateTimeInput control and two RepeatButtons:
Here is the code that gets executed when the user clicks on either of the two RepeatButtons:
The Mask that I'm using for the control in this application is "HH:mm:ss.fff". The control is used in an application that runs on a laptop with a touch screen. It's intended for use in a police car while the officer is driving, so the controls are all big to make it easy for officers with sausage fingers to use. One button has an arrow pointing up and the other has an arrow pointing down. The idea is that touching either button causes the spin functionality of the RadMaskedTimeDateInput control to fire.
My problem is that if the user clicks on either button without touching on anything in the RadMaskedDateTimeInput control first, the control wants to spin the "HH" part of the DateTime value. I'd prefer it if the control would spin the ".fff" part in this situation instead. But there doesn't seem to be a way to programmatically specify where the input position is in the control.
How can I make this work?
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <telerik:RadMaskedDateTimeInput Focusable="True" Grid.Column="0" FormatString="{Binding Path=Mask, Mode=OneWay}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Right" InputBehavior="Insert" IsClearButtonVisible="False" Margin="5" Mask="{Binding Path=Mask, Mode=OneWay}" Name="ValueBox" SelectionOnFocus="CaretToEnd" SpinMode="PositionAndValue" TextMode="MaskedText" UpdateValueEvent="PropertyChanged" Value="{Binding Converter={StaticResource TimeSpanConverter}, Path=Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" /> <RepeatButton Click="IncrementButton_Click" Focusable="False" Grid.Column="1" IsTabStop="False" Name="IncrementButton"> <Image> <Image.Style> <Style TargetType="{x:Type Image}"> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeUpDay.png" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ElementName=IncrementButton, Path=IsEnabled}" Value="false" /> <Condition Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}" Value="DayTime" /> </MultiDataTrigger.Conditions> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeUpDisabledDay.png" /> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ElementName=IncrementButton, Path=IsEnabled}" Value="true" /> <Condition Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}" Value="NightTime" /> </MultiDataTrigger.Conditions> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeUpNight.png" /> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ElementName=IncrementButton, Path=IsEnabled}" Value="false" /> <Condition Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}" Value="NightTime" /> </MultiDataTrigger.Conditions> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeUpDisabledNight.png" /> </MultiDataTrigger> </Style.Triggers> </Style> </Image.Style> </Image> </RepeatButton> <RepeatButton Click="DecrementButton_Click" Focusable="False" Grid.Column="2" IsTabStop="False" Name="DecrementButton"> <Image> <Image.Style> <Style TargetType="{x:Type Image}"> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeDnDay.png" /> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ElementName=DecrementButton, Path=IsEnabled}" Value="false" /> <Condition Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}" Value="DayTime" /> </MultiDataTrigger.Conditions> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeDnDisabledDay.png" /> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ElementName=DecrementButton, Path=IsEnabled}" Value="true" /> <Condition Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}" Value="NightTime" /> </MultiDataTrigger.Conditions> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeDnNight.png" /> </MultiDataTrigger> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding ElementName=DecrementButton, Path=IsEnabled}" Value="false" /> <Condition Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:TimeSpanSpinner}}}" Value="NightTime" /> </MultiDataTrigger.Conditions> <Setter Property="Source" Value="/CustomControls;component/Resources/VolumeDnDisabledNight.png" /> </MultiDataTrigger> </Style.Triggers> </Style> </Image.Style> </Image> </RepeatButton></Grid>Here is the code that gets executed when the user clicks on either of the two RepeatButtons:
private void DecrementButton_Click( object sender, RoutedEventArgs e ) { ValueBox.CallSpin( false );}private void IncrementButton_Click( object sender, RoutedEventArgs e ) { ValueBox.CallSpin( true );}The Mask that I'm using for the control in this application is "HH:mm:ss.fff". The control is used in an application that runs on a laptop with a touch screen. It's intended for use in a police car while the officer is driving, so the controls are all big to make it easy for officers with sausage fingers to use. One button has an arrow pointing up and the other has an arrow pointing down. The idea is that touching either button causes the spin functionality of the RadMaskedTimeDateInput control to fire.
My problem is that if the user clicks on either button without touching on anything in the RadMaskedDateTimeInput control first, the control wants to spin the "HH" part of the DateTime value. I'd prefer it if the control would spin the ".fff" part in this situation instead. But there doesn't seem to be a way to programmatically specify where the input position is in the control.
How can I make this work?