0
這是我當前的XAML。WPF:展開驗證矩形
<StackPanel Orientation="Horizontal" Grid.Column="3" Grid.Row="1">
<Label Content="Allocated:" FontSize="14"/>
<Label Content="{Binding AllocatedUnits, Mode=OneWay, ValidatesOnDataErrors=True}" ContentStringFormat="N0" FontSize="14"/>
</StackPanel>
我該如何改變這一點,以便紅色驗證矩形圍繞整個文本而不僅僅是數字。 (我會接受完全丟掉堆棧面板並執行其他操作。
由於它是標籤,因此必須使用ContentStringFormat而不是StringFormat。除此之外,它效果很好。 – 2010-10-06 23:52:30
謝謝喬納森 - 我已經改變了我的答案。 – 2010-10-07 08:25:08
哦,不,ContentStringFormat不是Binding上的一個屬性。 (這樣做太有道理了。)相反,它是標籤本身的屬性。 – 2010-10-07 16:49:56