0

我为 TimeUpDown 编写了一个小的 MouseEnter-Event 来设置焦点。

xml:

<toolkit:TimeUpDown MouseEnter="TimeUpDown_MouseEnter" KeyDown="time_KeyDown" ValueChanged="time_Value_Changed" Value="{Binding Endtime, Mode=TwoWay,BindsDirectlyToSource=True}"/>

xml.cs:

private void TimeUpDown_MouseEnter(object sender, MouseEventArgs e)
{
    TimeUpDown picker = sender as TimeUpDown;
    picker.Focus();
}

使用此代码,我关注(突出显示)TimeUpDown 的完整时间(例如10:15 ... 小时和分钟)。

我怎样才能只关注TimeUpDown的分钟数(例如 10: 15 )???

4

2 回答 2

0

如果您有短格式 (hh:MM AM/PM),解决方案将是这样的:

int startIndex = picker.Text.Text.IndexOf(':');
picker.Text.SelectionStart = startIndex + 1;
picker.Text.SelectionLength = 2; // minutes have two digits

如果您有其他日期格式,则查找分钟之前的冒号索引。

于 2014-12-03T11:48:13.220 回答
0

TimeUpDown 模板中的 TextBox 不可访问,因此我建议使用自定义 TextBox 创建样式。

在 Expression Blend 中编辑复杂的模板。我复制了下面 TimeUpDown 样式的基本模板。如您所见,它不仅非常复杂,而且 TextBox 实际上是在模板中的模板中:

XAML(仅限样式部分)

    <UserControl.Resources>
        <Style x:Key="TimeUpDownStyle1" TargetType="toolkit:TimeUpDown">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Height" Value="22"/>
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="MinWidth" Value="100"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                        <GradientStop Color="#FF718597" Offset="0.375"/>
                        <GradientStop Color="#FF617584" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="toolkit:TimeUpDown">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed"/>
                                    <VisualState x:Name="Disabled"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused"/>
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="TimeHintStates">
                                    <VisualState x:Name="TimeHintOpenedUp">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TimeHintVisualElement">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="TimeHintVisualElement">
                                                <SplineDoubleKeyFrame KeySpline="0,0,0,1" KeyTime="00:00:00.200" Value="-23"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Height" Storyboard.TargetName="TimeHintVisualElement">
                                                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                                <SplineDoubleKeyFrame KeySpline="0,0,0,1" KeyTime="00:00:00.200" Value="22"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="TimeHintOpenedDown">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TimeHintVisualElement">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="TimeHintVisualElement">
                                                <SplineDoubleKeyFrame KeySpline="0,0,0,1" KeyTime="00:00:00.200" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Height" Storyboard.TargetName="TimeHintVisualElement">
                                                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                                <SplineDoubleKeyFrame KeySpline="0,0,0,1" KeyTime="00:00:00.200" Value="22"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="TimeHintClosed">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TimeHintVisualElement">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:20" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="TimeHintVisualElement">
                                                <SplineDoubleKeyFrame KeySpline="0,0,0,1" KeyTime="00:00:00.200" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Height" Storyboard.TargetName="TimeHintVisualElement">
                                                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="22"/>
                                                <SplineDoubleKeyFrame KeySpline="0,0,0,1" KeyTime="00:00:00.200" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ParsingStates">
                                    <VisualState x:Name="ValidTime">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="validicon">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="InvalidTime">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="invalidicon">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="EmptyTime">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="emptyicon">
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Popup x:Name="TimeHintPopup" VerticalOffset="0">
                                <Border x:Name="TimeHintVisualElement" BorderBrush="Gray" BorderThickness="1" Background="White" HorizontalAlignment="Left" IsHitTestVisible="True" Visibility="Collapsed">
                                    <Border.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform/>
                                            <SkewTransform/>
                                            <RotateTransform/>
                                            <TranslateTransform/>
                                        </TransformGroup>
                                    </Border.RenderTransform>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition/>
                                            <ColumnDefinition MinWidth="15" Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <ContentControl Content="{TemplateBinding TimeHintContent}" Grid.Column="0" Foreground="#FF4A4A4A" FontSize="10" HorizontalAlignment="Right" IsHitTestVisible="False" IsTabStop="False" Margin="3" VerticalAlignment="Center"/>
                                        <ContentControl x:Name="emptyicon" Grid.Column="1" IsHitTestVisible="False" IsTabStop="False" Margin="3" Visibility="Collapsed"/>
                                        <ContentControl x:Name="validicon" Grid.Column="1" IsHitTestVisible="False" IsTabStop="False" Margin="3" Visibility="Collapsed"/>
                                        <ContentControl x:Name="invalidicon" Grid.Column="1" IsHitTestVisible="False" IsTabStop="False" Visibility="Collapsed" VerticalAlignment="Center">
                                            <Grid Height="13" VerticalAlignment="Bottom" Width="10">
                                                <Path Data="F1 M 28.1143,29.4857L 28.1143,27.4286L 20.7612,13.0286L 19.3898,13.0286L 12.3429,27.4286L 12.3429,29.4857L 28.1143,29.4857 Z " HorizontalAlignment="Stretch" Height="11.833" StrokeStartLineCap="Round" Stretch="Fill" StrokeEndLineCap="Round" StrokeLineJoin="Bevel" VerticalAlignment="Top">
                                                    <Path.Fill>
                                                        <LinearGradientBrush EndPoint="-0.140331,0.460318" StartPoint="1.13883,0.460318">
                                                            <GradientStop Color="#FFF7F79F" Offset="0.123636"/>
                                                            <GradientStop Color="#FBFBFB7D" Offset="0.177662"/>
                                                            <GradientStop Color="#F6FFFF5B" Offset="0.24"/>
                                                            <GradientStop Color="#E7CAA709" Offset="0.52"/>
                                                            <GradientStop Color="#9ADABE0C" Offset="0.941376"/>
                                                            <GradientStop Color="#4DEBD60F" Offset="0.941818"/>
                                                            <GradientStop Color="#FBF6EC20" Offset="0.956364"/>
                                                            <GradientStop Color="#FFFFFF2F" Offset="0.963636"/>
                                                        </LinearGradientBrush>
                                                    </Path.Fill>
                                                    <Path.Stroke>
                                                        <LinearGradientBrush EndPoint="-0.102151,0.462591" StartPoint="1.10074,0.462591">
                                                            <GradientStop Color="#F6CAA709" Offset="0.0436364"/>
                                                            <GradientStop Color="#F3F7F34F" Offset="0.149091"/>
                                                            <GradientStop Color="#E7CAA709" Offset="0.825455"/>
                                                            <GradientStop Color="#E7967C07" Offset="0.967124"/>
                                                            <GradientStop Color="#E7625106" Offset="0.967273"/>
                                                        </LinearGradientBrush>
                                                    </Path.Stroke>
                                                </Path>
                                                <Path Data="F1 M 18.6937,17.3004L 22.2563,17.3004L 21.1313,23.6937L 19.8563,23.6937L 18.6937,17.3004 Z " Height="4.683" Margin="4.25,2.25,3.75,0" StrokeStartLineCap="Round" Stretch="Fill" StrokeEndLineCap="Round" Stroke="#FF1B1B54" StrokeThickness="0.3" StrokeLineJoin="Bevel" VerticalAlignment="Top">
                                                    <Path.Fill>
                                                        <LinearGradientBrush EndPoint="1.4,0.50126" StartPoint="-0.400002,0.50126">
                                                            <GradientStop Color="#FFF7F79F" Offset="0.123636"/>
                                                            <GradientStop Color="#FB8F8873" Offset="0.175974"/>
                                                            <GradientStop Color="#F6271A47" Offset="0.236364"/>
                                                            <GradientStop Color="#E7271A47" Offset="0.534545"/>
                                                            <GradientStop Color="#9A89782B" Offset="0.941391"/>
                                                            <GradientStop Color="#4DEBD60F" Offset="0.941818"/>
                                                            <GradientStop Color="#FBF6EC20" Offset="0.956364"/>
                                                            <GradientStop Color="#FFFFFF2F" Offset="0.963636"/>
                                                        </LinearGradientBrush>
                                                    </Path.Fill>
                                                </Path>
                                                <Path Data="F1 M 20.225,25.122L 20.725,25.122C 21.2773,25.122 21.725,25.5697 21.725,26.122L 21.725,26.872C 21.725,27.4243 21.2773,27.872 20.725,27.872L 20.225,27.872C 19.6727,27.872 19.225,27.4243 19.225,26.872L 19.225,26.122C 19.225,25.5697 19.6727,25.122 20.225,25.122 Z " Height="3.11" Margin="3.833,0,4.167,0.833" StrokeStartLineCap="Round" Stretch="Fill" StrokeEndLineCap="Round" Stroke="#FF1C1C50" StrokeThickness="0.3" StrokeLineJoin="Round" VerticalAlignment="Bottom">
                                                    <Path.Fill>
                                                        <LinearGradientBrush EndPoint="1.06,0.5" StartPoint="-0.0599991,0.5">
                                                            <GradientStop Color="#F6271A47" Offset="0.236364"/>
                                                            <GradientStop Color="#E7271A47" Offset="0.534545"/>
                                                            <GradientStop Color="#9A89782B" Offset="0.98135"/>
                                                            <GradientStop Color="#4DEBD60F" Offset="0.981818"/>
                                                        </LinearGradientBrush>
                                                    </Path.Fill>
                                                </Path>
                                            </Grid>
                                        </ContentControl>
                                    </Grid>
                                </Border>
                            </Popup>
                            <toolkit:ButtonSpinner x:Name="Spinner" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalContentAlignment="Stretch" IsTabStop="False" MinWidth="35" Padding="{TemplateBinding Padding}" Style="{TemplateBinding SpinnerStyle}" VerticalContentAlignment="Stretch">
                                <TextBox x:Name="Text" AcceptsReturn="False" BorderThickness="0" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" MinWidth="20" TextAlignment="Right" TextWrapping="NoWrap" Text="{TemplateBinding Value}">
                                    <TextBox.Style>
                                        <Style TargetType="TextBox">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="TextBox">
                                                        <ScrollViewer x:Name="ContentElement" BorderThickness="0" Padding="0"/>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </TextBox.Style>
                                </TextBox>
                            </toolkit:ButtonSpinner>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="TimePickerStyle1" TargetType="toolkit:TimePicker">
            <Setter Property="IsTabStop" Value="False"/>
            <Setter Property="MinWidth" Value="125"/>
            <Setter Property="Height" Value="22"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                        <GradientStop Color="#FF718597" Offset="0.375"/>
                        <GradientStop Color="#FF617584" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
            <Setter Property="PopupTemplate">
                <Setter.Value>
                    <toolkit:TimePickerPopupTemplate>
                        <toolkit:ListTimePickerPopup/>
                    </toolkit:TimePickerPopupTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="toolkit:TimePicker">
                        <Grid x:Name="RootElement">
                            <Grid.Resources>
                                <ControlTemplate x:Key="PopupButtonTemplate" TargetType="ToggleButton">
                                    <Grid FlowDirection="LeftToRight" Height="20" Width="20">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualStateGroup.Transitions>
                                                    <VisualTransition GeneratedDuration="00:00:00.1000000"/>
                                                </VisualStateGroup.Transitions>
                                                <VisualState x:Name="Normal"/>
                                                <VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Highlight">
                                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Pressed">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Highlight">
                                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.8"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement">
                                                            <SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="CheckStates">
                                                <VisualState x:Name="Checked">
                                                    <Storyboard>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="ellipse">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="1.016,0.377"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="ellipse">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="-0.01,0.687"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="ellipse">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="0.556,0.035"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="ellipse">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="0.441,0.979"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="ellipse1">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="0.984,0.328"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="ellipse1">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="0.031,0.719"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="ellipse2">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="-0.047,0.516"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="ellipse2">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="1.016,0.422"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="ellipse3">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="1.062,0.375"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="ellipse3">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="0.031,0.688"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="ellipse4">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="1.031,0.281"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="ellipse4">
                                                            <SplinePointKeyFrame KeyTime="00:00:00" Value="-0.188,0.656"/>
                                                        </PointAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Unchecked"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStates">
                                                <VisualState x:Name="Focused"/>
                                                <VisualState x:Name="Unfocused"/>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Grid>
                                            <Grid.Resources>
                                                <LinearGradientBrush x:Key="Dot" EndPoint="1.025,0.434" StartPoint="-0.025,0.566">
                                                    <GradientStop Color="#FFC8C8C8"/>
                                                    <GradientStop Color="#FF19191A" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Grid.Resources>
                                            <Ellipse x:Name="Highlight" Margin="0,0,0,0" Opacity="0" Stroke="#FF0052CA" StrokeThickness="1"/>
                                            <Ellipse x:Name="ellipse" Margin="1,1,1,1" Stroke="{StaticResource Dot}" StrokeThickness="0.75">
                                                <Ellipse.Fill>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FFFFFFFF"/>
                                                        <GradientStop Color="#FFD7E3EC" Offset="0.80400002002716064"/>
                                                        <GradientStop Color="#FFFBFBFB" Offset="0.37099999189376831"/>
                                                    </LinearGradientBrush>
                                                </Ellipse.Fill>
                                            </Ellipse>
                                            <Ellipse x:Name="ellipse1" Height="2" Margin="8,2,8,0" Stroke="{StaticResource Dot}" VerticalAlignment="Top" Width="2">
                                                <Ellipse.Fill>
                                                    <RadialGradientBrush>
                                                        <RadialGradientBrush.RelativeTransform>
                                                            <TransformGroup>
                                                                <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="1.817" ScaleX="2.381"/>
                                                                <SkewTransform CenterY="0.5" CenterX="0.5"/>
                                                                <RotateTransform Angle="0.966" CenterY="0.5" CenterX="0.5"/>
                                                                <TranslateTransform X="-0.2" Y="0.087"/>
                                                            </TransformGroup>
                                                        </RadialGradientBrush.RelativeTransform>
                                                        <GradientStop Color="#FF000000"/>
                                                        <GradientStop Color="#FFFB6A05" Offset="1"/>
                                                        <GradientStop Color="#FF4E4E4F" Offset="0.446"/>
                                                    </RadialGradientBrush>
                                                </Ellipse.Fill>
                                            </Ellipse>
                                            <Ellipse x:Name="ellipse2" Height="2" Margin="8,0,8,2" Stroke="{StaticResource Dot}" VerticalAlignment="Bottom" Width="2">
                                                <Ellipse.Fill>
                                                    <RadialGradientBrush>
                                                        <RadialGradientBrush.RelativeTransform>
                                                            <TransformGroup>
                                                                <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="1.817" ScaleX="2.381"/>
                                                                <SkewTransform CenterY="0.5" CenterX="0.5"/>
                                                                <RotateTransform Angle="0.966" CenterY="0.5" CenterX="0.5"/>
                                                                <TranslateTransform X="-0.2" Y="0.087"/>
                                                            </TransformGroup>
                                                        </RadialGradientBrush.RelativeTransform>
                                                        <GradientStop Color="#FF000000"/>
                                                        <GradientStop Color="#FFFB6A05" Offset="1"/>
                                                        <GradientStop Color="#FF4E4E4F" Offset="0.446"/>
                                                    </RadialGradientBrush>
                                                </Ellipse.Fill>
                                            </Ellipse>
                                            <Ellipse x:Name="ellipse3" HorizontalAlignment="Left" Height="1" Margin="2,10,0,0" Stroke="{StaticResource Dot}" VerticalAlignment="Top" Width="1">
                                                <Ellipse.Fill>
                                                    <RadialGradientBrush>
                                                        <RadialGradientBrush.RelativeTransform>
                                                            <TransformGroup>
                                                                <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="1.817" ScaleX="2.381"/>
                                                                <SkewTransform CenterY="0.5" CenterX="0.5"/>
                                                                <RotateTransform Angle="0.966" CenterY="0.5" CenterX="0.5"/>
                                                                <TranslateTransform X="-0.2" Y="0.087"/>
                                                            </TransformGroup>
                                                        </RadialGradientBrush.RelativeTransform>
                                                        <GradientStop Color="#FF000000"/>
                                                        <GradientStop Color="#FFFB6A05" Offset="1"/>
                                                        <GradientStop Color="#FF4E4E4F" Offset="0.446"/>
                                                    </RadialGradientBrush>
                                                </Ellipse.Fill>
                                            </Ellipse>
                                            <Ellipse x:Name="ellipse4" HorizontalAlignment="Right" Height="1.421" Margin="0,10,2,0" Stroke="{StaticResource Dot}" VerticalAlignment="Top" Width="1.05">
                                                <Ellipse.Fill>
                                                    <RadialGradientBrush>
                                                        <RadialGradientBrush.RelativeTransform>
                                                            <TransformGroup>
                                                                <ScaleTransform CenterY="0.5" CenterX="0.5" ScaleY="1.817" ScaleX="2.381"/>
                                                                <SkewTransform CenterY="0.5" CenterX="0.5"/>
                                                                <RotateTransform Angle="0.966" CenterY="0.5" CenterX="0.5"/>
                                                                <TranslateTransform X="-0.2" Y="0.087"/>
                                                            </TransformGroup>
                                                        </RadialGradientBrush.RelativeTransform>
                                                        <GradientStop Color="#FF000000"/>
                                                        <GradientStop Color="#FFFB6A05" Offset="1"/>
                                                        <GradientStop Color="#FF4E4E4F" Offset="0.446"/>
                                                    </RadialGradientBrush>
                                                </Ellipse.Fill>
                                            </Ellipse>
                                            <Path Data="M10.108397,6.5404582 L10.108397,10.415268 L13.538931,13.738435" Fill="{x:Null}" HorizontalAlignment="Left" Height="8.258" Margin="9,6,5,0" Stretch="Fill" VerticalAlignment="Top">
                                                <Path.Stroke>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FF5B91D2"/>
                                                        <GradientStop Color="#FFC1570E" Offset="0.996"/>
                                                    </LinearGradientBrush>
                                                </Path.Stroke>
                                            </Path>
                                            <Rectangle x:Name="DisabledVisualElement" Fill="#FFFFFFFF" IsHitTestVisible="false" Opacity="0" RadiusY="3" RadiusX="3"/>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Disabled"/>
                                    <VisualState x:Name="Pressed"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused"/>
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="PopupStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0:0:0.1" To="PopupOpened"/>
                                        <VisualTransition GeneratedDuration="0:0:0.2" To="PopupClosed"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="PopupOpened">
                                        <Storyboard>
                                            <DoubleAnimation To="1.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PopupRoot"/>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="PopupClosed">
                                        <Storyboard>
                                            <DoubleAnimation To="0.0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PopupRoot"/>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <toolkit:TimeUpDown x:Name="TimeUpDown" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Culture="{TemplateBinding Culture}" Grid.Column="0" Format="{TemplateBinding Format}" Height="Auto" Maximum="{TemplateBinding Maximum}" Minimum="{TemplateBinding Minimum}" Padding="{TemplateBinding Padding}" Style="{StaticResource TimeUpDownStyle1}" SpinnerStyle="{TemplateBinding SpinnerStyle}" TimeParsers="{TemplateBinding TimeParsers}" TimeGlobalizationInfo="{TemplateBinding TimeGlobalizationInfo}"/>
                            <ToggleButton x:Name="DropDownToggle" Grid.Column="1" HorizontalAlignment="Center" Margin="3,0,0,0" Template="{StaticResource PopupButtonTemplate}" VerticalAlignment="Center"/>
                            <Popup x:Name="Popup">
                                <Border x:Name="PopupRoot" BorderBrush="#FF8d8b8b" BorderThickness="1">
                                    <ContentControl x:Name="PopupPlaceHolder" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalContentAlignment="Stretch"/>
                                </Border>
                            </Popup>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
于 2012-08-09T13:12:39.653 回答