wpf ToggleButton实现控制UI组件宽度,展开或收缩

📅 发布时间:2026/7/17 14:19:00 👁️ 浏览次数:
wpf ToggleButton实现控制UI组件宽度,展开或收缩
点击按钮控制左侧版块宽度展开或收缩样式设置UserControl.ResourcesPathGeometry x:KeyPathGeometry_RightFiguresM514 114.3c-219.9 0-398.8 178.9-398.8 398.8 0 220 178.9 398.9 398.8 398.9s398.8-178.9 398.8-398.9c0-219.8-178.9-398.8-398.8-398.8z m152.9 440.4L502.8 718.8c-22.9 22.9-60.2 22.9-83.1 0-11.5-11.5-17.2-26.5-17.2-41.5s5.7-30.1 17.2-41.5l122.6-122.6-122.6-122.6c-22.9-22.9-22.9-60.2 0-83.1 22.9-22.9 60.2-22.9 83.1 0l164.1 164.1c23 23 23 60.2 0 83.1z/ControlTemplate x:KeyToggleButton_expandTargetTypeToggleButtonGridBackgroundTransparentCursorHandRenderTransformOrigin0.5,0.5Grid.RenderTransformRotateTransform x:NameRotateAngle180//Grid.RenderTransformPathData{StaticResource PathGeometry_Right}Fill{StaticResource DefaultButtonMouseDown}StretchUniform//GridControlTemplate.TriggersTriggerPropertyIsCheckedValueTrueTrigger.EnterActionsBeginStoryboardStoryboardDoubleAnimationUsingKeyFramesStoryboard.TargetNameRotateStoryboard.TargetPropertyAngleDoubleAnimationUsingKeyFrames.KeyFramesLinearDoubleKeyFrameKeyTime0:0:0.1Value180//DoubleAnimationUsingKeyFrames.KeyFrames/DoubleAnimationUsingKeyFrames/Storyboard/BeginStoryboard/Trigger.EnterActionsTrigger.ExitActionsBeginStoryboardStoryboardDoubleAnimationUsingKeyFramesStoryboard.TargetNameRotateStoryboard.TargetPropertyAngleDoubleAnimationUsingKeyFrames.KeyFramesLinearDoubleKeyFrameKeyTime0:0:0.1Value0//DoubleAnimationUsingKeyFrames.KeyFrames/DoubleAnimationUsingKeyFrames/Storyboard/BeginStoryboard/Trigger.ExitActions/Trigger/ControlTemplate.Triggers/ControlTemplateStoryboard x:KeyStoryboard_ShowDoubleAnimationUsingKeyFramesStoryboard.TargetNameleftContentStoryboard.TargetPropertyWidthDoubleAnimationUsingKeyFrames.KeyFramesLinearDoubleKeyFrameKeyTime0:0:0.1ValueNaN//DoubleAnimationUsingKeyFrames.KeyFrames/DoubleAnimationUsingKeyFrames/StoryboardStoryboard x:KeyStoryboard_HiddenDoubleAnimationUsingKeyFramesStoryboard.TargetNameleftContentStoryboard.TargetPropertyWidthDoubleAnimationUsingKeyFrames.KeyFramesLinearDoubleKeyFrameKeyTime0:0:0.1Value60//DoubleAnimationUsingKeyFrames.KeyFrames/DoubleAnimationUsingKeyFrames/Storyboard/UserControl.Resources控制宽度按钮ToggleButtonWidth25Height35Margin-5,7,0,0HorizontalAlignmentLeftVerticalAlignmentTopPanel.ZIndex77BackgroundRedCommand{Binding QueryPersonnelCommand}CommandParameter{Binding IsChecked, RelativeSource{RelativeSource ModeSelf}}IsCheckedTrueTemplate{StaticResource ToggleButton_expand}ToggleButton.TriggersEventTriggerRoutedEventToggleButton.CheckedBeginStoryboardStoryboard{StaticResource Storyboard_Show}//EventTriggerEventTriggerRoutedEventToggleButton.UncheckedBeginStoryboardStoryboard{StaticResource Storyboard_Hidden}//EventTrigger/ToggleButton.Triggers/ToggleButton