Questions tagged [generic.xaml]

For issues relating to the generic.xaml file which is used to define default styles of custom WPF controls.

When the system looks for a resource at the themes level, it first looks for it in the theme-specific file and then looks for it in generic.xaml.

Themes\generic.xaml is the resource file that the WPF will load auto matically for Custom controls.

generic.xaml is special because WPF makes it a special case for any custom controls with generic themes WPF's style lookup mechanism will automatically pick up the styles defined in the generic.xaml file

43 questions
25
votes
5 answers

Styles from generic.xaml are not applied

I made a class library assembly in which I created custom controls, and I defined the default styles in the generic.xaml file. It seems this is a quite common problem, as long as many people are posting about it. However I couldn't find any useful…
Sebastien ROBERT
  • 596
  • 1
  • 5
  • 10
16
votes
2 answers

WPF - Resource not loading from Generic.xaml

Themes\Generic.xaml:
michael
  • 14,844
  • 28
  • 89
  • 177
9
votes
3 answers

Using MergedDictionaries in generic.xaml in Silverlight 3

In WPF it was possible to organise the XAML for multiple user controls by keeping the markup in separate XAML files in the themes folder and then using MergedDictionaries to import them into generic.xaml:
7
votes
1 answer

Splitting Generic.Xaml - problem loading MergedDictionaries

working on a pretty large library of controls the generic.xaml gets simpy out of control. I want to split it pretty much by control (although once for a namespace which contains only some simple ones for now). For that, i am adding more Resource…
TomTom
  • 61,059
  • 10
  • 88
  • 148
6
votes
2 answers

Loading WPF Style from Resource File

I am trying to load WPF Style from other file actually from WPF Custom Control Library but i am failing to load here is my solution. The solution contains two projects WpfTestControls of Type WPF Custom Control Library WpfTestApp of type WPF…
Robob
  • 329
  • 2
  • 6
  • 19
4
votes
0 answers

please explain what is themes and generic.xaml?

i noticed that when i create a custom control in visual studio it adds generic.xaml into the Themes folder. what is the purpose of this folder, what is special about generic.xaml? why when i try to link to my own dictionaries from generic.xaml they…
akonsu
  • 28,824
  • 33
  • 119
  • 194
3
votes
1 answer

XamlReader throws when loading generic.xaml to merge resource dictionaries

Trying to load generic.xaml in code but it throws a XamlParseException. Code as follows: Uri uri = new Uri("Themes/Generic.xaml", UriKind.Relative); StreamResourceInfo info = Application.GetResourceStream(uri); System.Windows.Markup.XamlReader…
Youp Bernoulli
  • 5,303
  • 5
  • 39
  • 59
3
votes
1 answer

Custom control inconsistency in border brush property?

I have created my own control in WPF. Initially I created it as a usercontrol but found the preferred way to do this is to create a class which inherits from control and then place my respective xaml in a control template inside Generic.xaml. This…
MikeKulls
  • 2,979
  • 2
  • 25
  • 30
3
votes
1 answer

Setting the foreground[text] color of the button in a resource dictionary

I am defining a button style in Buttons.xaml file. Can you please tell me how to set the foreground property of the button? I need to use a gradient as foreground property. Code is as below. Right now i am setting the gradient within the button…
logeeks
  • 4,849
  • 15
  • 62
  • 93
3
votes
1 answer

Overriding styles defined in generic.xaml

I have a custom controls library, in which I defined a control template, that uses some custom styles. My control template is located in the Generic.xaml file, and the styles it uses are also located there, and accessed by the control template with…
Andy
  • 1,153
  • 4
  • 13
  • 33
3
votes
2 answers

Make ListBox size to fit the ItemsPanel used as its ItemsPresenter

I have a custom control ListBox that I would like to adjust its size according to the size of its ItemsPanel. For the items panel, I have a custom control WrapPanel that arranges the items accordingly. As you can see in the screen shot, the…
Jesse Seger
  • 951
  • 1
  • 13
  • 31
3
votes
0 answers

Questions about the Resource look-up system with themes\generic.xaml

I notice that resources defined in generic.xaml cannot be simply resolved via this.TryFindResource("someKey"); And that instead they can only be referenced in the following manner this.TryFindResource(new…
blue18hutthutt
  • 3,191
  • 5
  • 34
  • 57
2
votes
0 answers

Styling a Custom DataGrid with Generic.xaml

Sorry about the lengthy question. I hope it's not as complicated as it was to write it :) I'm trying to style a custom DataGrid via Generic.xaml, and I'm finding some funny behavior. Here's what I've got: I've created a solution with 2 projects: A…
Felix
  • 1,034
  • 1
  • 9
  • 29
2
votes
2 answers

Howto: Applying a Style defined in generic.xaml to a UserControl? (WPF)

I've created a style in generic.xaml that i want to use in my project on several UserControls. In the same way i have defined a style for a custom control and this one works so it seems generic.xaml is loaded, this is the defined style:
Bas Goossen
  • 459
  • 1
  • 7
  • 20
2
votes
0 answers

Invalid Markup Visual Studio 2015 Community

I'm pretty new to C# and .XAML and I'm having some problems being able to see the UI for my .XAML file. I'm getting an "Invalid Markup" error, and in the .XAML code, I get the error The name "DynamicBaseHostedControl" does not exist in the…
1
2 3