Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Resource dictionary

Resource dictionary

Scheduled Pinned Locked Moved WPF
questionwpflearning
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    michaelgr1
    wrote on last edited by
    #1

    Hello,

    How do i use ResourceDictionary?

    I created a xaml file with resourceDictionary with ImageSource

    Than in my UserControl i must to mention a key for the resourceDictionary (otherwise it doesn't compile):

    <ResourceDictionary x:Key="resourceDictionary">
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/AQUA.ClientServices.Presentation;component/Images/ImageResources.xaml">
    </ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    But when i am trying to use one of the resources in the dictionary it says the resource key can't be found

    R 1 Reply Last reply
    0
    • M michaelgr1

      Hello,

      How do i use ResourceDictionary?

      I created a xaml file with resourceDictionary with ImageSource

      Than in my UserControl i must to mention a key for the resourceDictionary (otherwise it doesn't compile):

      <ResourceDictionary x:Key="resourceDictionary">
      <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="/AQUA.ClientServices.Presentation;component/Images/ImageResources.xaml">
      </ResourceDictionary>
      </ResourceDictionary.MergedDictionaries>
      </ResourceDictionary>
      But when i am trying to use one of the resources in the dictionary it says the resource key can't be found

      R Offline
      R Offline
      RobCroll
      wrote on last edited by
      #2

      Have you inserted this code within your App.xaml file? If not, place in App.xaml file and remove the key attribute all together

      Hopefully that will help

      "You get that on the big jobs."

      M 1 Reply Last reply
      0
      • R RobCroll

        Have you inserted this code within your App.xaml file? If not, place in App.xaml file and remove the key attribute all together

        Hopefully that will help

        "You get that on the big jobs."

        M Offline
        M Offline
        michaelgr1
        wrote on last edited by
        #3

        I right my application using PRISM and my user control is a module. How can i define to use the resource dictionary in the scope of the userControl ?

        R 1 Reply Last reply
        0
        • M michaelgr1

          I right my application using PRISM and my user control is a module. How can i define to use the resource dictionary in the scope of the userControl ?

          R Offline
          R Offline
          RobCroll
          wrote on last edited by
          #4

          I don't do PRISM but I still think you want to get rid of the x:key. Also the / in front of AQUA doesn't look right either. Try removing that as well.

          "You get that on the big jobs."

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups