0

I have a user control library and I have many comboboxes contained in many different user controls. I am wondering how, if it's possible to set a global style for the combobox? I don't have an application file, nor a resource dictionary file due to the user control libraries and I can't access the main program as we are making plug ins for the main program which is controlled by someone else.

This is the code for the user control which holds most of the other user controls and also contains a combobox itself

<UserControl.Resources> 
<ResourceDictionary> 
<ResourceDictionary.MergedDictionaries></ResourceDictionary.MergedDictionaries> </ResourceDictionary>
Ryan Archibald
  • 215
  • 2
  • 18
  • I am pretty sure it was asked many times. Check e.g. [this](http://stackoverflow.com/q/19270018/1997232). If you are defining controls in library and simply want all of them inherit basic style, then create `ResourceDictionary` with such styles and include it (merge) into controls resource. – Sinatr Jan 22 '16 at 15:07
  • Yeah I am aware of that, and that's my problem, I can't seem to create a resourceDictionary for some reason I keep getting an error – Ryan Archibald Jan 22 '16 at 15:13
  • Which error? Show all related code/xaml parts too. Or do you mean you want to style *someone else* controls? – Sinatr Jan 22 '16 at 15:19
  • The error is the property resources can only be set once, I am not sure if I understand this completely and this is most likely why I have asked this question again, as I did find the other question very confusing – Ryan Archibald Jan 22 '16 at 15:22
  • This is the code for the user control which holds most of the other user controls and also contains a combobox itself – Ryan Archibald Jan 22 '16 at 15:22
  • 1
    I think [this answer](http://stackoverflow.com/a/18626175/1997232) should help you. – Sinatr Jan 22 '16 at 15:25
  • Thank you, just one quick question then do I need to create a resource dictionary file and if so would it be int he same location as the user control that contains all the other controls? – Ryan Archibald Jan 22 '16 at 15:27
  • If you use fully qualified `Uri` (the one with `pack://` syntax) it can be anywhere in your class library project. – Sinatr Jan 22 '16 at 15:36
  • Thank you for you're help I finally got it working – Ryan Archibald Jan 22 '16 at 15:52

0 Answers0