更改TextBox标头位置 [英] Changing TextBox header location

查看:82
本文介绍了更改TextBox标头位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 - 如何更改文本框的标题位置?它似乎默认排在最前面,我想把它放在文本框的左侧。

Hi - How can I change the textbox's header location? It seems to be on top by default and I'd like to have it on the left side of the textbox.

Thx!

推荐答案

我认为可以通过更改< Grid.Row>在文本框的默认样式模板中完成。和< Grid.Column>

I think it can be done in the default Style Template for Textbox by changing the <Grid.Row> and <Grid.Column>

<ContentPresenter x:Name="HeaderContentPresenter"
                          x:DeferLoadStrategy="Lazy"
                          Visibility="Collapsed"
                          Grid.Row="0"
                          Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
                          Margin="0,0,0,8"
                          Grid.ColumnSpan="2"
                          Content="{TemplateBinding Header}"
                          ContentTemplate="{TemplateBinding HeaderTemplate}"
                          FontWeight="Normal" />

最简单的可能是不使用标题并使用TextBlock而不是像这样

The easiest may be not to use the header and use a TextBlock instead like this

<StackPanel Orientation="Horizontal" >
<TextBlock Text= "MyTextBlock" />
<Textbox />
</StackPanel>


这篇关于更改TextBox标头位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆