I'd like to be able to maintain the width of controls globally throughout my WPF application.
Previously in winforms world I'd override onload in a base form and iterate through all controls and containers and determine the type of controls and set开发者_开发问答 the dimensions accordingly.
I guess I could do the same in WPF but is there any better way to do this?
Set a Style for TextBox at the highest level in your Visual Hierarchy.
Define TextBox style in the resource dictionary and put a setter to set the desired width
<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
<Setter Property="Width" Value="200" />
..........
</Style>
精彩评论