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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. WPF Style Question

WPF Style Question

Scheduled Pinned Locked Moved WPF
wpfquestioncsharphelp
5 Posts 3 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.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I am creating a user control. I will be using this user control in a few different apps. Once it's done I'll include its assembly in my project, reference it, and use it in my XAML somewhere. Pretty standard. The question is... How do I apply a different set of styles to it based on the app I'm in? Thanks

    If it's not broken, fix it until it is

    P P 2 Replies Last reply
    0
    • K Kevin Marois

      I am creating a user control. I will be using this user control in a few different apps. Once it's done I'll include its assembly in my project, reference it, and use it in my XAML somewhere. Pretty standard. The question is... How do I apply a different set of styles to it based on the app I'm in? Thanks

      If it's not broken, fix it until it is

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      The simplest way to achieve this is to have application level themes. In other words, in App A - you would set the styles for your control to be the ones you want in App A; in App B you set the styles for the control based on the ones you want in App B, and so on. Make sure you have a default theme for your control in place as well.

      K 1 Reply Last reply
      0
      • P Pete OHanlon

        The simplest way to achieve this is to have application level themes. In other words, in App A - you would set the styles for your control to be the ones you want in App A; in App B you set the styles for the control based on the ones you want in App B, and so on. Make sure you have a default theme for your control in place as well.

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        Ok, so create a theme. Isn't a theme just a collection of styles?

        If it's not broken, fix it until it is

        P 1 Reply Last reply
        0
        • K Kevin Marois

          Ok, so create a theme. Isn't a theme just a collection of styles?

          If it's not broken, fix it until it is

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Yes.

          1 Reply Last reply
          0
          • K Kevin Marois

            I am creating a user control. I will be using this user control in a few different apps. Once it's done I'll include its assembly in my project, reference it, and use it in my XAML somewhere. Pretty standard. The question is... How do I apply a different set of styles to it based on the app I'm in? Thanks

            If it's not broken, fix it until it is

            P Offline
            P Offline
            pradeep surya
            wrote on last edited by
            #5

            Hi Kevin, Sorry for late reply to your post. 1.You can create a seperate styles for appA, Appb... and apply the theme accordingly as a staticresource. 2.Suppose in same application you want different theme based on some action then just use the above mentioned idea and apply themes using Dynamicresource. Thanks.

            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