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. Adding additional Brushes to the Style of a ContentControl

Adding additional Brushes to the Style of a ContentControl

Scheduled Pinned Locked Moved WPF
help
9 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.
  • A Offline
    A Offline
    Alan Beasley
    wrote on last edited by
    #1

    Hi All, I wondered if someone could help me, to add additional parameters to a Style. I've currently got a ContentControl, which has obviously has a "Background", "BorderBrush", "Foreground" & "Opacity Mask" brushes in the Properties tab. And I would like to specify additional brushes, that are contained within the Style. The reason I want some additional brushes, is to define some Gradient Brushes. That I am using as an overlay for some of the components/parts of my inherited Control. I can't seem to find anything on the web, but maybe I'm not looking in the right places! One last thing, I'm a designer not a developer. - So presume I'm stupid to save time!!! ha ha Thanks in advance! Alan

    A 1 Reply Last reply
    0
    • A Alan Beasley

      Hi All, I wondered if someone could help me, to add additional parameters to a Style. I've currently got a ContentControl, which has obviously has a "Background", "BorderBrush", "Foreground" & "Opacity Mask" brushes in the Properties tab. And I would like to specify additional brushes, that are contained within the Style. The reason I want some additional brushes, is to define some Gradient Brushes. That I am using as an overlay for some of the components/parts of my inherited Control. I can't seem to find anything on the web, but maybe I'm not looking in the right places! One last thing, I'm a designer not a developer. - So presume I'm stupid to save time!!! ha ha Thanks in advance! Alan

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      What you could do is to bind your color to a property of your datacontext - something like - You can then set your color through the code. You could probably talk to a developer to see if this approach is useful to you.

      A 1 Reply Last reply
      0
      • A Abhinav S

        What you could do is to bind your color to a property of your datacontext - something like - You can then set your color through the code. You could probably talk to a developer to see if this approach is useful to you.

        A Offline
        A Offline
        Alan Beasley
        wrote on last edited by
        #3

        Thanks, but I obviously did not make it clear: I want to see this new brush, in the brushes section of the Properties tab of Expression Blend. Something like this: http://www.infragistics.com/uploadedImages/VDG/Blend\_custom\_brushes.jpg Thanks anyway.

        modified on Monday, March 22, 2010 1:33 PM

        A 1 Reply Last reply
        0
        • A Alan Beasley

          Thanks, but I obviously did not make it clear: I want to see this new brush, in the brushes section of the Properties tab of Expression Blend. Something like this: http://www.infragistics.com/uploadedImages/VDG/Blend\_custom\_brushes.jpg Thanks anyway.

          modified on Monday, March 22, 2010 1:33 PM

          A Offline
          A Offline
          Abhinav S
          wrote on last edited by
          #4

          Not sure, but maybe this[^] video may be of some help to you.

          A 1 Reply Last reply
          0
          • A Abhinav S

            Not sure, but maybe this[^] video may be of some help to you.

            A Offline
            A Offline
            Alan Beasley
            wrote on last edited by
            #5

            Thanks, but that still does not address or answer my question.

            K 1 Reply Last reply
            0
            • A Alan Beasley

              Thanks, but that still does not address or answer my question.

              K Offline
              K Offline
              Katka Vaughan
              wrote on last edited by
              #6

              Hi Alan, you have probably figured this out by now. I haven't used Blend much but I think what you are looking for is that once you define your brush in Blend under properties, you can then click that tiny square 'advanced property options' and select 'Convert to new resource' which will then give you options where you want to place the brush. You will then have your new brush available under 'Brush Resources'.

              Katka Vaughan Projects: Calcium SDK | Articles: Silverlight YouTube Jukebox

              A 1 Reply Last reply
              0
              • K Katka Vaughan

                Hi Alan, you have probably figured this out by now. I haven't used Blend much but I think what you are looking for is that once you define your brush in Blend under properties, you can then click that tiny square 'advanced property options' and select 'Convert to new resource' which will then give you options where you want to place the brush. You will then have your new brush available under 'Brush Resources'.

                Katka Vaughan Projects: Calcium SDK | Articles: Silverlight YouTube Jukebox

                A Offline
                A Offline
                Alan Beasley
                wrote on last edited by
                #7

                Hi Katka, Thanks for having a look at this, but it's a coding issue. (I am 99.99% sure!) :laugh: I actually wanted this for my Picture Frame tutorial[^] to make it a bit funkier. And the reason is best explained there. I did drop a few hints, but no developer has taken the bait yet! :-D Cheers, Alan

                K 1 Reply Last reply
                0
                • A Alan Beasley

                  Hi Katka, Thanks for having a look at this, but it's a coding issue. (I am 99.99% sure!) :laugh: I actually wanted this for my Picture Frame tutorial[^] to make it a bit funkier. And the reason is best explained there. I did drop a few hints, but no developer has taken the bait yet! :-D Cheers, Alan

                  K Offline
                  K Offline
                  Katka Vaughan
                  wrote on last edited by
                  #8

                  Hi Alan, I will have another crack at this :) You can add brushes to your style by addig them to your Resource Dictionary. Then you will have them available in Blend under 'Brush Resources'. For example if I were to add the six brushes, shown below, to the resource dictionary (PictureFrames.xaml) of your Picture Frame project, I would have all these brushes available in Blend under Brush Resources as shown here http://prikl.com/brush-resources.gif[^] <!-- Primary Color Brushes --> <SolidColorBrush x:Key="NavigationBackgroundColorBrush" Color="#FF282828"/> <SolidColorBrush x:Key="NavigationForegroundColorBrush" Color="#FF595959"/> <SolidColorBrush x:Key="HighLightColorBrush" Color="#FF747474"/> <SolidColorBrush x:Key="HoverHyperlinkForegroundColorBrush" Color="#FFEBF7FF"/> <SolidColorBrush x:Key="HoverHyperLinkBackgroundColorBrush" Color="#FF0096FF"/> <SolidColorBrush x:Key="BodyTextColorBrush" Color="White"/> Is this what you were after?

                  Katka Vaughan Projects: Calcium SDK | Articles: Silverlight YouTube Jukebox

                  A 1 Reply Last reply
                  0
                  • K Katka Vaughan

                    Hi Alan, I will have another crack at this :) You can add brushes to your style by addig them to your Resource Dictionary. Then you will have them available in Blend under 'Brush Resources'. For example if I were to add the six brushes, shown below, to the resource dictionary (PictureFrames.xaml) of your Picture Frame project, I would have all these brushes available in Blend under Brush Resources as shown here http://prikl.com/brush-resources.gif[^] <!-- Primary Color Brushes --> <SolidColorBrush x:Key="NavigationBackgroundColorBrush" Color="#FF282828"/> <SolidColorBrush x:Key="NavigationForegroundColorBrush" Color="#FF595959"/> <SolidColorBrush x:Key="HighLightColorBrush" Color="#FF747474"/> <SolidColorBrush x:Key="HoverHyperlinkForegroundColorBrush" Color="#FFEBF7FF"/> <SolidColorBrush x:Key="HoverHyperLinkBackgroundColorBrush" Color="#FF0096FF"/> <SolidColorBrush x:Key="BodyTextColorBrush" Color="White"/> Is this what you were after?

                    Katka Vaughan Projects: Calcium SDK | Articles: Silverlight YouTube Jukebox

                    A Offline
                    A Offline
                    Alan Beasley
                    wrote on last edited by
                    #9

                    Thanks Katka, unfortunately not! :(( As what I really want, is an extra Brush built into an inheritied Content Control. And then to convert this brush (on the fly) to 2 different resources (One of them rotated 90 degree) This would allow me to edit the profile of my picture frame control in one spot, for both the Horizontal & Vertical Gradients. As currently, I have 2 resources that I reference. (just as you show) Referencing 2 separate resources, means I have to copy setting from one to another... It would just be really sweet to have this built in, as I'm finding this Control really handy, as you will see in my next tutorial... Thanks for looking at this :-D Alan

                    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