xaml wpf中的新行 [英] new line in 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;
HorizontalAlignment =&左&" VerticalAlignment =&"Center&"/>
& lt//TextBlock& gt;
& lt//DockPanel& gt;
& lt; DockPanel& gt;
< Button HorizontalAlignment =&"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>
<TextBlock>
<TextBox Text="Equipment List" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
</TextBlock>
</DockPanel>
<DockPanel>
<TextBlock>
<TextBox MinWidth="150" x:Name="eqitemText" Text="New Equipment..." Margin="2,0,0,0"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
</TextBlock>
</DockPanel>
<DockPanel>
<Button HorizontalAlignment="Left" Style="{StaticResource IconButton}" Tag="{StaticResource Cancel_Icon}" Click="RemoveEq"
VerticalAlignment="Stretch" Width="Auto" Height="Auto" DockPanel.Dock="Right" Margin="0,0,5,0"
ToolTip="Remove Usage Profile" ToolTipService.InitialShowDelay="1"/></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 aDockPanel
, use aStackPanel
.
Or else you need to useDock=Left,Dock=Right
etc. See here[^].
是TextBlock
中的新行吗?当然,它不应该是</br>;它应该是文本换行,并以XML格式保留.TextBlock
控件与HTML无关,这不是很明显吗?
—SA
Is is a new line inTextBlock
? It should not be </br>, of course; it should be a text new line which is preserved as such in XML. The controlTextBlock
has nothing to do with HTML, isn''t this obvious?
—SA
这篇关于xaml wpf中的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!