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. Custom property for user control

Custom property for user control

Scheduled Pinned Locked Moved WPF
tutorial
2 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.
  • K Offline
    K Offline
    krishnan s
    wrote on last edited by
    #1

    Hi, I need some helpyin developing the user control. I have developed a usercontrol for slider( which has a slider and a textbox for displaying the value ) , I need to add a user defined property orientation for my slider , based on which it should be rotated . Can anyone throw some light on how to define userdefined properties for the usercontrol. Thanks

    B 1 Reply Last reply
    0
    • K krishnan s

      Hi, I need some helpyin developing the user control. I have developed a usercontrol for slider( which has a slider and a textbox for displaying the value ) , I need to add a user defined property orientation for my slider , based on which it should be rotated . Can anyone throw some light on how to define userdefined properties for the usercontrol. Thanks

      B Offline
      B Offline
      BillWoodruff
      wrote on last edited by
      #2

      Namaste, or Vanakkum, or Namaskaram (your choice), Sri Krishnan, I think you can get some clear responses if you make what you mean by "rotate" and "orientation" a little more clear. What exactly is it you want to do beyond what setting the Orientation and IsDirectionReverse properties of a WPF Slider at design time do now. If this is the very simple case of you just wanting to let your code at run-time set the Orientation property : well, write a public method in the UserControl you can call:

          public void setSliderOrientation(Orientation whichWay)
          {
              this.slider1.Orientation = whichWay;
          }
      

      If this is the simple case of you wanting to expose the Slider Orientaton property inside a UserControl at Design Time : write a Public Property so that Property will show up in the Property Editor at Design Time :

          public Orientation sliderOrientation
          {
              set { slider1.Orientation = value;  }
              get { return slider1.Orientation; }
          }
      

      If by "rotate" you mean literally rotating the user control itself, or rotating the slider inside the usercontrol : then : just go and take a look at how you can rotate anything in WPF. best, Bill

      "Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844

      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