Defining a style as a resource

A style can be defined in two ways: implicit styling and explicit styling. In implicit styling definition, you need to specify a TargetType for that style and all the controls defined by TargetType within that context will automatically use that specified style. The explicit style definition has an x:Key attribute along with the TargetType attribute and will apply it only to that target in the context which has explicitly referenced the resource as its style with the markup extension {StaticResource}.

Here is an implicit style definition of a button:

  <Style TargetType="Button"> 
     . 
     . 
     . 
  </style> 

Here is an explicit style definition of a button, having a key named MyButtonStyle that can be attached to a button ...

Get Mastering Visual Studio 2017 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.