当我有TextBlock的时候。“在页面中运行文本= "(”Run Text={Binding IncomeLoss} Run Text=“),它看起来很好,但是当我在ControlTemplate中应用于从Control派生的类时,在"( 100 )”这样的字符之后会有额外的空间。
我读到ControlTemplate是样式继承的障碍,但是我如何猜测页面上的Textblock所继承的样式参数到底是什么呢?
发布于 2017-02-07 13:28:08
确保已经将所有Run元素放在ControlTemplate中的同一行中。
这两种方法在产出方面存在差异:
<TextBlock><Run Text = "(" /><Run Text="{Binding IncomeLoss}"/><Run Text=")"/></TextBlock>...and这个:
<TextBlock>
<Run Text = "(" />
<Run Text="{Binding IncomeLoss}"/>
<Run Text=")"/>
</TextBlock>如果这不起作用,您应该提供一个最小的、完整的和可验证的问题示例:https://stackoverflow.com/help/mcve
https://stackoverflow.com/questions/42078287
复制相似问题