Questions tagged [wpf-style]

Styles are a WPF mechanism to change the appearance and behaviour of WPF controls by modifing properties and attaching event handlers from a central point.

WPF Style as a convenient way to apply a set of property values to multiple FrameworkElements (via Setters, or conditionally via Triggers).

Related styles for different FrameworkElement can be packaged together as a theme.

References:

298 questions
34
votes
4 answers

Error: 'Cannot create unknown type '{clr-namespace:NameSpace.Properties}Settings'.'

I define my settings and styles in a ResourceDictionary:
amiry jd
  • 27,021
  • 30
  • 116
  • 215
14
votes
2 answers

Finding the default style for a type in code behind

In WPF, you can create a Style that acts as the default for a control type in XAML: Then, when WPF goes to display that control, it looks up that Style from the resources based on the…
Tony Vitabile
  • 8,298
  • 15
  • 67
  • 123
10
votes
1 answer

Reset inherited WPF style?

In the App.xaml portion of my application I have a ResourceDictionary element that targets things like DataGridColumnHeader and DataGridCell and applies custom styling to them. These definitions are global (in that they don't use a x:key - they…
maxp
  • 24,209
  • 39
  • 123
  • 201
8
votes
1 answer

Type reference cannot find type named '{clr-namespace:xxx}ClassName on MergedDictionary

I'm received the exception Type reference cannot find type named '{clr-namespace:Dashboard.View}DashBoardColors at runtime. I have a static class with my colors: namespace Dashboard.View { public static class DashBoardColors { public…
MattC
  • 3,984
  • 1
  • 33
  • 49
8
votes
1 answer

Set WPF Binding.StringFormat Property on TextBox via Style

I have an WPF application contains many TextBoxes having different kind of Bindings which all share the same StringFormat property (its a technical application, the Textboxes should display values with units "xxx mm"...) I want to set up the Binding…
MartinStettner
  • 28,719
  • 15
  • 79
  • 106
7
votes
1 answer

Cursor not blinking in templated TextBox

I have the following TextBox in one of my views:
Dawid
  • 763
  • 1
  • 8
  • 17
7
votes
3 answers

TemplatedParent is null when used inside a ControlTemplate's DataTrigger

Consider this (edited-down) Style, designed for a Button whose Content is a String: