I’ve written a small MouseEnter-Event for a TimeUpDown, to set the focus.
xaml:
<toolkit:TimeUpDown MouseEnter="TimeUpDown_MouseEnter" KeyDown="time_KeyDown" ValueChanged="time_Value_Changed" Value="{Binding Endtime, Mode=TwoWay,BindsDirectlyToSource=True}"/>
xaml.cs:
private void TimeUpDown_MouseEnter(object sender, MouseEventArgs e)
{
TimeUpDown picker = sender as TimeUpDown;
picker.Focus();
}
With this code, I focus (highlight) the complete time (eg 10:15 … hrs and mins) for the TimeUpDown.
How can I only focus the minutes (eg 10:15) for the TimeUpDown???
The TextBox in the template of a TimeUpDown is not accessible, so I would recommend creating a style using a custom TextBox instead.
Edit complex templates in Expression Blend. I have copied the basic template of the TimeUpDown style below. As you can see it is not only very complex, but the TextBox is actually in a Template within a Template:
XAML (style part only)