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. Customizing Foreground (the moving part) of a progressbar in WPF

Customizing Foreground (the moving part) of a progressbar in WPF

Scheduled Pinned Locked Moved WPF
wpfquestioncsharpwcftutorial
3 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.
  • 2 Offline
    2 Offline
    2hdass
    wrote on last edited by
    #1

    Hi guys, I am really new to WPF. I unerstand the concept of using Templates to create customization of a control, and i have attempted to change the visual behaviour of the Progressbar control and now hitting a brick wall. So there are 3 things i would like to do: 1) Remove the 3d shiny part of the control - i dont like the 3d ness I used control template to modify the foreground, i sucessfully killed the 3d shininesss, but moving part is expanding itself starting at the center point of the entire progress bar, and that it only expends to 100 pixels wide. this is because i set te Width=Value the foreground rectrangle's width attribute. How do i make it so that when the value = 100, the progressbar is fully filled?

    			<Rectangle Fill="{TemplateBinding Foreground}"
    			Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Width}"
    			Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" 
    			Margin="0,0" ></Rectangle>
    
    1. Have a textbox following the top of the moving part to indicate a value - I have no idea how to do this 3) Make the whole control an arc, so that it looks like a fuel gauge - I know i can transform it,skew, size it whatever, but not warp it. thx alot guys
    S 1 Reply Last reply
    0
    • 2 2hdass

      Hi guys, I am really new to WPF. I unerstand the concept of using Templates to create customization of a control, and i have attempted to change the visual behaviour of the Progressbar control and now hitting a brick wall. So there are 3 things i would like to do: 1) Remove the 3d shiny part of the control - i dont like the 3d ness I used control template to modify the foreground, i sucessfully killed the 3d shininesss, but moving part is expanding itself starting at the center point of the entire progress bar, and that it only expends to 100 pixels wide. this is because i set te Width=Value the foreground rectrangle's width attribute. How do i make it so that when the value = 100, the progressbar is fully filled?

      			<Rectangle Fill="{TemplateBinding Foreground}"
      			Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Width}"
      			Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" 
      			Margin="0,0" ></Rectangle>
      
      1. Have a textbox following the top of the moving part to indicate a value - I have no idea how to do this 3) Make the whole control an arc, so that it looks like a fuel gauge - I know i can transform it,skew, size it whatever, but not warp it. thx alot guys
      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #2

      what about a template just a guess, but a "like" that (warning: pseudo xaml code below)

      template
      grid
      background
      viewbox
      grid with 100
      rectangle LeftAlign with=Value

      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

      2 1 Reply Last reply
      0
      • S Super Lloyd

        what about a template just a guess, but a "like" that (warning: pseudo xaml code below)

        template
        grid
        background
        viewbox
        grid with 100
        rectangle LeftAlign with=Value

        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

        2 Offline
        2 Offline
        2hdass
        wrote on last edited by
        #3

        hmm i dont understand?

        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