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