【问题标题】:wpf textblock exact top margin with pxwpf textblock与px的精确上边距
【发布时间】:2018-06-17 03:07:31
【问题描述】:
<TextBlock x:Name="ctTbMain" Text="INITIALIZING THE SYSTEM NEW UI"     Canvas.Left="0" Canvas.Top="190px" Width="{Binding Path=ActualWidth, ElementName=ctPagebody}" Style="{StaticResource styleTextInit1}" />

假设我想将此 TextBox 设置为距上边距 290 像素
我该怎么做?

【问题讨论】:

  • 请提供更多细节。如果它仅将控件从顶部放置到 290 像素。试试 Canvas.Top="290"。它将考虑窗口的高度和宽度。
  • 使用转换器并将像素值转换为双倍

标签: c# wpf margin textblock


【解决方案1】:

如果您想要 290px 的边距,只需设置边距。

<TextBlock 
  x:Name="ctTbMain" 
  Text="INITIALIZING THE SYSTEM NEW UI" 
  Margin="0,290,0,0" 
  Width="{Binding Path=ActualWidth, ElementName=ctPagebody}" 
  Style="{StaticResource styleTextInit1}"
/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-11
    • 2014-03-01
    • 2014-06-18
    • 2017-08-04
    • 2023-04-01
    • 1970-01-01
    相关资源
    最近更新 更多