相关疑难解决方法(0)

禁用WPF标签加速键(缺少文本下划线)

我将.ContentLabel 的值设置为包含下划线的字符串; 第一个下划线被解释为加速键.

如果没有(更换所有改变基础字符串___),是有办法禁用标签加速器?

wpf user-interface

57
推荐指数
2
解决办法
3万
查看次数

WPF标签在包含下划线时获取TextBlock样式

当我在标签文本中包含下划线时,为了获得访问键功能,标签会突然跳过一定数量的像素.

两个标签彼此相对,一个具有额外的PaddingLeft

当我在Kaxaml尝试了这一点,我意识到这是一个StyleTargetType="TextBlock"施加保证金,只有在它与下划线的标签.

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <UserControl.Resources>

      <Style TargetType="TextBlock">
          <Setter Property="VerticalAlignment" Value="Center"/>
          <Setter Property="HorizontalAlignment" Value="Left"/>
          <Setter Property="Margin" Value="5,2,0,1" />
      </Style>

  </UserControl.Resources>
<Grid>  
  <Grid.ColumnDefinitions>
    <ColumnDefinition></ColumnDefinition>
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto"></RowDefinition>
    <RowDefinition Height="Auto"></RowDefinition>
  </Grid.RowDefinitions>
  <Label Grid.Column="0" Grid.Row="0">Avfallets _Id:</Label>
  <Label Grid.Column="0" Grid.Row="1">Avfallets Id:</Label>
</Grid>
Run Code Online (Sandbox Code Playgroud)

这里的逻辑是什么?在你添加下划线之前,某种标签不是TextBlock吗?

wpf xaml label

5
推荐指数
0
解决办法
212
查看次数

标签 统计

wpf ×2

label ×1

user-interface ×1

xaml ×1