Apply an application-level style to all textboxes

前端 未结 1 1304
野趣味
野趣味 2020-12-17 09:04

How do I apply a style defined in my Application.xaml to all the textboxes in a particular window? I don\'t want to type Style=\"{StaticResource MyStyle}\" with

1条回答
  •  一个人的身影
    2020-12-17 09:17

    Then just add the Style to your App.Xaml or your Theme.xaml (if you have one) or even your Window.Resources if you just have 1 Window, just make sure you don't set the x:Key

    Example:

    This will apply to all TextBoxes(no x:Key)

        
    

    TextBoxes will have to use Style="{StaticResource MyStyle}" to use this :

        
    

    0 讨论(0)
提交回复
热议问题