1

the title isn't really meaningfull... sorry for this.I'll try to explain my issue. I have a bigger project in which i'm trying to implement a new WPF window which contains some custom controls. Going deeper this window should looks like, let's say, a calculator. This calculators has many keys buttons which are "custom controls" inherited from Controls, and their style are defined in Generic.xaml. When i try to debug it, the custom controls (the key buttons) don't appear into the calculator window. I think it's due to something wrong with the Generic.xaml file. Can someone give me a hint ??? Thanks in advance Paolo

rebe21
  • 83
  • 11
  • PS. adding the files into a separate simpler project, the calculator windows works like a charm. – rebe21 Apr 27 '12 at 14:45

2 Answers2

0

A couple of suggestions:

  • download Snoop (it's free), it examines your Visual tree at run time and helps to see if controls are there, if the style making them invisible, etc.

  • remove the styles, run your project - do controls appear? then it's your styles!

  • do you have nameless/key-less styles that target buttons, other simple/out-of-the-box control? Then remove them too, if they are the ones affecting your controls, then consider changing them, or applying styles to your controls so they stop inheriting from those defaults.

denis morozov
  • 6,236
  • 3
  • 30
  • 45
0

I've searched a lot on the net and finally i've got the solution following the answer of this discussion wpf-resource-not-loading-from-generic. The clue is to add into the AssemblyInfo.cs these lines of code:

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, 
    //where theme specific resource dictionaries are located
    //(used if a resource is not found in the page, 
    // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly 
    //where the generic resource dictionary is located
    //(used if a resource is not found in the page, 
    // app, or any theme specific resource dictionaries)
)]

Maybe this could be useful for someone in the future... :-)

Regards, Paolo

Community
  • 1
  • 1
rebe21
  • 83
  • 11