xaml wpf中的新行 [英] new line in xaml wpf

查看:71
本文介绍了xaml wpf中的新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我正在使用wpf格式.我在设计上遇到了困难,因为我不能使用html普通功能来换行< br/>


这是代码

< pre lang ="xml"> DockPanel& gt;
& lt; TextBlock& gt;
& lt; TextBox Text =& quot;设备清单& quot; VerticalAlignment =&"Center&" FontSize =& quot; 14& quot; FontWeight =&粗体" /& gt;
& lt//TextBlock& gt;
& lt//DockPanel& gt;
& lt; DockPanel& gt;
& lt; TextBlock& gt;
& lt; TextBox MinWidth =& quot; 150& quot; x:Name =& quot; eqitemText& quot;文字="新设备…& quot;保证金=&"2,0,0,0& quot;
Horizo​​ntalAlignment =&左&" VerticalAlignment =&"Center&"/>
& lt//TextBlock& gt;
& lt//DockPanel& gt;

& lt; DockPanel& gt;
< Button Horizo​​ntalAlignment =&"Left&"样式=&"{StaticResource IconButton}& quot; Tag =&"{StaticResource Cancel_Icon}& quot;点击=& quot; RemoveEq& quot;
VerticalAlignment =&拉伸&"宽度=&自动"高度=自动" DockPanel.Dock =&"Right&"保证金=&"0,0,5,0& quot;
工具提示=&删除使用情况配置文件&". ToolTipService.InitialShowDelay =&</& gt;</pre>



按钮和2个文本框将显示在彼此的顶部.

i have a project and i am using wpf format. i have difficulty for the design as i can''t use html normal features to have a new line line <br />


this is the code

<pre lang="xml">DockPanel&gt;
&lt;TextBlock&gt;
&lt;TextBox Text=&quot;Equipment List&quot; VerticalAlignment=&quot;Center&quot; FontSize=&quot;14&quot; FontWeight=&quot;Bold&quot; /&gt;
&lt;/TextBlock&gt;
&lt;/DockPanel&gt;
&lt;DockPanel&gt;
&lt;TextBlock&gt;
&lt;TextBox MinWidth=&quot;150&quot; x:Name=&quot;eqitemText&quot; Text=&quot;New Equipment...&quot; Margin=&quot;2,0,0,0&quot;
HorizontalAlignment=&quot;Left&quot; VerticalAlignment=&quot;Center&quot;/&gt;
&lt;/TextBlock&gt;
&lt;/DockPanel&gt;

&lt;DockPanel&gt;
&lt;Button HorizontalAlignment=&quot;Left&quot; Style=&quot;{StaticResource IconButton}&quot; Tag=&quot;{StaticResource Cancel_Icon}&quot; Click=&quot;RemoveEq&quot;
VerticalAlignment=&quot;Stretch&quot; Width=&quot;Auto&quot; Height=&quot;Auto&quot; DockPanel.Dock=&quot;Right&quot; Margin=&quot;0,0,5,0&quot;
ToolTip=&quot;Remove Usage Profile&quot; ToolTipService.InitialShowDelay=&quot;1&quot;/&gt;</pre>



the button and the 2 textboxes are being displayed on top of each other. any ideas?

推荐答案

代替DockPanel,请使用StackPanel.
否则,您需要使用Dock=Left,Dock=Right等.请参见此处 [
Instead of a DockPanel, use a StackPanel.
Or else you need to use Dock=Left,Dock=Right etc. See here[^].


TextBlock中的新行吗?当然,它不应该是</br>;它应该是文本换行,并以XML格式保留. TextBlock控件与HTML无关,这不是很明显吗?

—SA
Is is a new line in TextBlock? It should not be </br>, of course; it should be a text new line which is preserved as such in XML. The control TextBlock has nothing to do with HTML, isn''t this obvious?

—SA


这篇关于xaml wpf中的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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