This is a migrated thread and some comments may be shown as answers.

Radslider left right event

11 Answers 84 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Vivek
Top achievements
Rank 1
Vivek asked on 16 Jun 2011, 12:13 PM
Hi Telerik team,

I have added rad slider  into a window. now i want to open the rad slider on a button click after open a image into the canvas.


When the image open into the canvas then i am opening the rad slider, now i want to do a click event when slider go left-right then its zoom-in the image and when slider go right to left then its zoom-out the image.

But i am not able to get the event handler for that functionality.  i got valuechanged,mouseleftbuttondown etc.....

But i am not getting sliderdraglefttoright or sliderdragrighttoleft.

If you help me with an example then its very helpfull for me.

Wright now i m able to do only one function for both side left as well as right. But i want two diff function has to be done when we change the slider a/c to left and right.

Plese help me.

Thanks,
Raina

11 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 21 Jun 2011, 03:18 PM
Hello Vivek,

Could something like this fit in your scenario:
private void RadSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            if (e.NewValue > e.OldValue)
            {
                LeftToRightMethod();
            }
            else
            {
                RightToLeftMethod();
            }
        }
Please let us know if you need further assistance.

Kind regards,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vivek
Top achievements
Rank 1
answered on 21 Jun 2011, 03:28 PM
Thanks for the  reply
0
Vivek
Top achievements
Rank 1
answered on 29 Jun 2011, 03:40 PM
Hi Team,

Thanks for your help and support. I did the slider left right zoom in ,zoom out But now i am facing another problem, While clicking the slider button the slider is doing zoom in zoom out but when i close the slider and open once again then again the slider is open from the start , The slider should be start from the previous place where i left the slider and close it.

I want the solution for this how i will open the slider again for the same position where i left the slider .

Please help me.

Here is my code.
private void Zoom_slider_Click(object sender, RoutedEventArgs e)
        {
 
            RadWindow Zoom_slider_window = new RadWindow();
            Zoom_slider_window.Header = "Zoom Slider";
            Zoom_slider_window.Height = 100;
            Zoom_slider_window.Width = 300;
            Zoom_slider_window.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterOwner;
            Zoom_slider_window.ResizeMode = ResizeMode.NoResize;          
            Pre_grid.Children.Add(Zoom_slider_window);
            Zoom_slider_window.Show();
 
 
 
            //Now add a slider to window
            Zoomslider = new RadSlider();           
            Zoomslider.VerticalAlignment = System.Windows.VerticalAlignment.Center;          
            Zoomslider.TickPlacement = TickPlacement.Both;
            Zoomslider.TickFrequency = 2;       
            Zoomslider.HandlesVisibility = System.Windows.Visibility.Visible;
            Zoom_slider_window.Content = Zoomslider;
            Zoomslider.Maximum = 10;
            Zoomslider.Minimum = 1;
            Zoomslider.SmallChange = 0.3;
 
            if (Zoomslider.Value != null)
            {
                Zoomslider.SelectionStart = oldZoomValue;
 
            }
            Zoomslider.Value = 1;
 
            
 
            
 
            //Event handling                     
            Zoomslider.ValueChanged+=new RoutedPropertyChangedEventHandler<double>(Zoomslider_ValueChanged);
            
         
         
        }
 
        private static double oldZoomValue=0;
 
        private void Zoomslider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
 
                        
            if (Zoomslider.Value < oldZoomValue)
            {
                ZoomOut();
            }
 
            else
            {
                if (Zoomslider.Value > Zoomslider.Minimum)
                {
 
 
                    ZoomIn();
 
                }
            }
            oldZoomValue = Zoomslider.Value;
        }




0
Petar Mladenov
Telerik team
answered on 04 Jul 2011, 02:25 PM
Hello Vivek,

The RadWindow re-loads its content every time it has been clicked or has been shown. So if you place a new RadSlider in it the RadSlider will also be reloaded every time and its ValueChanged event will be fired with Value=0.
Could you please check this out by using a Debug breakpoint in the ValueChanged event. However, the solution you have made is more like a winforms than a Silverlight one. In Silverlight, you can take a full advantage of using ViewModels (MVVM design pattern) bound to your controls. These ViewModels could have properties that are two-way bound and will reflect the changes that you make in the UI.Could this fit in your case ?
Furthermore, you can examine this demos showing our new PersistenceFramework that could be used for saving the current state of a RadControl.
Please let us know if this helped you.

Greetings,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vivek
Top achievements
Rank 1
answered on 04 Jul 2011, 04:58 PM
Hi Petar,

I have downloaded the RadControls_for_Silverlight_4_2011_1_0419_Trial .msi. I want to use PersistenceFramework, but I am not able to find the Telerik.Windows.PersistenceFramework this dll.

Can you please tell me where it is so that I can use this in my current project?

Thanks for idea and reply.

Regards,
Vivek


0
Petar Mladenov
Telerik team
answered on 05 Jul 2011, 08:17 AM
Hello Vivek,

The persistence framework is introduced in the Q2 2011 Beta dlls and you can download them from your account page at www.telerik.com (Download Free Trials / Q2 2011 Beta). Let us know if you need further assistance.

All the best,
Petar Mladenov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vivek
Top achievements
Rank 1
answered on 05 Jul 2011, 08:23 AM
Hi Team,

Thanks for the reply.

thanks for the help I got it now.

Thanks,
Vivek



0
Vivek
Top achievements
Rank 1
answered on 05 Jul 2011, 09:28 AM
Hi Team,

I have tried all possible way to do persistence for zoom slider.

Can you please send me a demo code for zoomslider value change with persistence without any save or load button click.

I don't want any another button event for zoom slider persistence.

How i can do this.

Please help me.

Thanks.
0
Petar Mladenov
Telerik team
answered on 07 Jul 2011, 01:56 PM
Hi Vivek,

Could you please elaborate more on the ways you have tried to persist the Slider without Buttons ?
As I managed to understand your RadSlider is inside RadWindow and after close/reopen operation you want the previous Slider Value to be  reloaded. So have you tried using the Closed event of the RadWindow to save the Slider state and Opened event of the RadWindow to load it ?

Kind regards,
Petar Mladenov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Vivek
Top achievements
Rank 1
answered on 07 Jul 2011, 03:17 PM
Hi Team,

I am getting the exception . Please see the screenshot.

Thanks,
0
Petar Mladenov
Telerik team
answered on 08 Jul 2011, 08:24 AM
Hello Vivek,

Can you confirm that your Telerik.Windows.Controls and Telerik.Windows.PersistenceFramework have equal version? If so, you could also try to clean and rebuild the solution. If this doesn't help, you can send us the InnerExpcetion, the stackTrace or a runnable sample so that we would be better able to help you.

All the best,
Petar Mladenov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Slider
Asked by
Vivek
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Vivek
Top achievements
Rank 1
Share this question
or