如何让 AppBarButton 的 Label 显示在右边?

CodingNinja 2016-01-26 02:50:15
默认的 AppBarButton 都是这样的:
(*)
Label

但是,我希望是这样的:
(*) Label
如何做到?
...全文
1156 2 打赏 收藏 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangyi_2009 2016-01-27
  • 打赏
  • 举报
回复


这是 Windows 8.1 的,UWP 的也类似。
把默认 Template 中的 StackPanel 设置为 Orientation="Horizontal"
设置 TextBlock 的 VerticalAlignment="Center"
再调整合适的 Height 和 Width

<Page.Resources>
<Style x:Key="AppBarButtonStyle" TargetType="AppBarButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="AppBarButton">
<Grid x:Name="RootGrid" Width="100" Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ApplicationViewStates">
<!-- FullSize is used when we are in landscape or filled mode -->
<VisualState x:Name="FullSize"/>
<!-- Compact is used when we are in portrait or snapped mode -->
<VisualState x:Name="Compact">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Width">
<DiscreteObjectKeyFrame KeyTime="0" Value="60"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse" Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPointerOverForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="OutlineEllipse" Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse" Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemPressedForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="OutlineEllipse" Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0"/>
<DoubleAnimation
Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>

<StackPanel Orientation="Horizontal"
VerticalAlignment="Top" Margin="0,14,0,13">
<Grid Width="40" Height="40" Margin="0,0,0,5" HorizontalAlignment="Center">
<Ellipse
x:Name="BackgroundEllipse"
UseLayoutRounding="False"
Width="40"
Height="40"
Fill="{ThemeResource AppBarItemBackgroundThemeBrush}"/>
<Ellipse
x:Name="OutlineEllipse"
UseLayoutRounding="False"
Width="40"
Height="40"
Stroke="{ThemeResource AppBarItemForegroundThemeBrush}"
StrokeThickness="2" />
<ContentPresenter
x:Name="Content"
Content="{TemplateBinding Icon}"
Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AutomationProperties.AccessibilityView="Raw"/>
</Grid>
<TextBlock VerticalAlignment="Center"
x:Name="TextLabel"
Text="{TemplateBinding Label}"
Foreground="{ThemeResource AppBarItemForegroundThemeBrush}"
FontSize="12"
FontFamily="{TemplateBinding FontFamily}"
TextAlignment="Center"
Width="58"
TextWrapping="Wrap"/>
</StackPanel>
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"/>
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<AppBarButton Icon="Emoji" Label="Label" Style="{StaticResource AppBarButtonStyle}"/>
</Grid>
yangyi_2009 2016-01-27
  • 打赏
  • 举报
回复
在 Blend 中编辑,改 Template 中的布局。
摘 要 针对高校教师教学业绩管理流程复杂、数据填报不规范、多级审核效率低、统计分析滞后等问题,本文设计并实现一套基于SpringBoot+Vue前后端分离架构的高校教师教学业绩综合管理系统。系统后端以SpringBoot处理业务逻辑与接口开发,前端用Vue构建交互界面,MySQL存储数据,MD5加密保障账号安全,具备低耦合、易扩展、易维护特性。 系统按权限划分为教师、学院管理员、学校管理员三级角色,构建闭环式业绩管理体系。教师可完成信息维护、业绩录入、成果申报、审核跟踪、档案导出、智能咨询与社区互动;学院管理员负责教师管理、业绩初审、数据汇总、通知发布与修正申请;学校管理员承担权限分配、数据维护、业绩终审、统计分析、公告发布与日志审计。 系统实现业绩填报、初审、终审、统计归档全流程线上化,支持批量导入、敏感词过滤、数据可视化、7×24小时AI咨询等功能,规范管理流程、减少统计误差、提升审核效率。测试表明,系统满足高校教学业绩精细化、规范化、信息化管理需求,为教师考核、绩效评定、教学评估提供数据支撑,提升高校教学管理智能化水平。 关键词: SpringBoot;Vue;教学业绩管理;三级权限;前后端分离
内容概要:本文围绕“基于雅可比伪逆迭代的双臂协同轨迹规划与跟踪误差收敛性研究”展开,通过Matlab代码实现双机械臂系统的协同运动控制与轨迹跟踪。研究采用雅可比伪逆法求解冗余机械臂的逆运动学问题,实现末端执行器在笛卡尔空间中的精确轨迹规划,并引入迭代优化机制提升双臂协同作业的精度与稳定性。重点分析了轨迹跟踪过程中误差的收敛特性,验证了所提控制算法在多自由度强耦合系统中的有效性和鲁棒性,适用于复杂环境下需要高精度配合的机器人协同操作任务。该研究属于科研仿真复现类工作,融合了机器人运动学理论、数值计算方法与控制算法设计,为多机械臂系统提供了可行的轨迹规划与控制策略参考。; 适合人群:具备扎实的机器人学基础、自动控制理论知识以及良好Matlab编程能力的科研人员或研究生,尤其适合从事多机械臂协同控制、运动规划、逆运动学求解及误差分析等方向的研究者。; 使用场景及目标:①用于多机械臂系统的协同轨迹规划与运动控制算法研究;②深入理解基于雅可比伪逆法的逆运动学求解原理及其在冗余机构中的应用;③分析轨迹跟踪误差的收敛行为,评估控制策略的稳定性与精度;④作为高质量论文复现资源,支撑相关课题的仿真验证、算法对比与改进创新。; 阅读建议:建议结合Matlab代码与机器人运动学经典理论同步学习,重点关注雅可比矩阵的构建、伪逆运算的实现方式、误差反馈机制的设计以及迭代过程中的数值稳定性处理,同时可进一步拓展至非线性优化、避免奇异位形及实时控制策略的改进研究。

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧