• 2018-8-10-win10-UWP-修改密码框文字水平


    title author date CreateTime categories
    win10 UWP 修改密码框文字水平
    lindexi
    2018-08-10 19:17:19 +0800
    2018-2-13 17:23:3 +0800
    Win10 UWP

    一般的密码框输入左对齐,如何让他不左对齐

    设置了HorizontalContentAlignment没有变化

    于是找了很久,有一个方法可以设置,下面将会说这个方法

    新建一个 PasswordBox 控件,编辑模板,可以看到 vs 自动写出很多代码

    可以看到这样代码,需要自己去找一下

        
        
        <ScrollViewer x:Name="ContentElement" AutomationProperties.AccessibilityView="Raw" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsTabStop="False" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" Margin="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" Grid.Row="1" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="Disabled"/>

    但是需要修改的只有HorizontalAlignment, 修改这句就好,使用下面代码 代替上面的代码

                                    <ScrollViewer x:Name="ContentElement" VerticalAlignment="Center" HorizontalAlignment="Stretch" AutomationProperties.AccessibilityView="Raw" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" 
                                              IsTabStop="False" 
                                              IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" Margin="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" Grid.Row="1" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="Disabled"/>
    

    修改他的 HorizontalAlignment 修改为 Center ,密码控件就是上面的图,密码中间。

    https://stackoverflow.com/questions/42805582/setting-the-alignment-of-a-passwordbox-in-uwp

  • 相关阅读:
    Hibernate之二级缓存
    Hibernate之HQL
    Hibernate 一对多自关联 多对多
    hibernate关联关系(一对多)
    Hibernate之主键生成策略
    Hibernate01
    struts的图片上传
    HashMap和HashTable本质性的区别
    集合03
    集合
  • 原文地址:https://www.cnblogs.com/lindexi/p/12085959.html
Copyright © 2020-2023  润新知