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

Binding Years and months to slider

9 Answers 227 Views
Slider
This is a migrated thread and some comments may be shown as answers.
vijay
Top achievements
Rank 1
vijay asked on 29 Jul 2011, 06:45 AM

Hi all,

I have to develop year and months scale. when ever user selects the scale automatically chart should be binds basing on the inputs from the scale.

Like 2009 Jan, fib, mar, apr, may ,Jun, July, Aug., sept, oct, nov, dec  2010  jan, feb, mar, apr,may,jun,july,aug,sept,oct,nov,dec  2011 jan, feb, mar, apr,may,jun,july,aug,sept,oct,nov,dec  2012.(exactly as shown in the attached file)

I have tried with RADSLIDER to achieve this functionality but I was not succeed. 

Can you people please help me in which way I can achieve this? 

That is very very important to me and very urgent also.


Thanks in Advance
-Vijay Kommalapati

9 Answers, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 29 Jul 2011, 09:17 AM
Hi Vijay,

Could you please tell us exactly what is that you could not accomplish? How I see it, is that you can calculate the Minimum and Maximum values of the slider based on the Ticks of the DateTime (2009 and 2012 years). The TickFrequency can be also calculated and they would be the Ticks for exactly one month.

For the labels, you can set the TickTemplate and use an IValueConverter, which will convert the Tick values to DateTime objects. You can return the year of the parsed date time, only when the Month is one. This would show only the name of the year ticks and not the months.

Please let us know if you have questions on this or need assistance.

Best wishes,
Alex Fidanov
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
vijay
Top achievements
Rank 1
answered on 30 Jan 2012, 10:47 AM
Alex Fidanov,

Here i want to design the template like below.

Major ticks - 2009 to 2012
minor ticks - jan to dec for evey year.

(My idea is the slider will apper by defalut with years and when user whants to move on minaor ticks will get the month name should apper) please find the attachment.

so finally i required the slider with years and months.

is there any chance to modify the data template like that.

can you please help me with sample solution in MVVM or Normal way or else please give some idea to procced.

Please find the attached image exactly i am looking like that only. 

Thanks
-Vijay


0
Tina Stancheva
Telerik team
answered on 02 Feb 2012, 10:36 AM
Hello Vijay,

I attached a sample project demonstrating how you can implement your scenario. Give it a try and let us know if it works for you or if we can further assist you.

Greetings,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
vijay
Top achievements
Rank 1
answered on 02 Feb 2012, 01:55 PM

Tina Stancheva,

Thanks for your replay.

I am trying to open the attached project i am getting the fallowing error.

C:\Users\admin\Desktop\332526_SilverlightApplication4(1)\SilverlightApplication4\SilverlightApplication4.csproj(104,3): The imported project "C:\Program Files\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

 C:\Users\admin\Desktop\332526_SilverlightApplication4(1)\SilverlightApplication4\SilverlightApplication4.csproj(104,3): The imported project "C:\Program Files\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Please find the attached screen for reference.

thanks
Vijay


0
Tina Stancheva
Telerik team
answered on 02 Feb 2012, 05:30 PM
Hi Vijay,

The project is created for Silverlight 5, this is why you cannot open it. However, I attached the same solution but for Silverlight 4. Let me know if it works for you.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
vijay
Top achievements
Rank 1
answered on 07 Feb 2012, 09:12 AM
Tina Stancheva,

thanks for your solution this is what exactly i am expectiong.But i need some little help from you again

but i tried with selection chnaged even to get the selection start and selection end but i was unable to get those dates.

I given initially selection start is 2008 and selection end is 2011 but it is not working something like given below

 

<telerik:RadSlider Margin="20" SelectionEnd="2011" SelectionStart="2008">

and current build i am getting only selectionstart tik(slide) starts at 2007 like same i need selection end tik(slide).

Please find the attached screen.

thanks
-Vijay
0
vijay
Top achievements
Rank 1
answered on 08 Feb 2012, 02:26 PM
still i am waiting for the solution

this is very much needed to me can you please send it as soon as possible.

thanks
-Vijay
0
Tina Stancheva
Telerik team
answered on 09 Feb 2012, 01:52 PM
Hello Vijay,

In order to enable the selection range you need to set the RadSlider.IsSelectionRangeEnabled property to True. Then in your solution it would be best to bind the Selection property of the slider. It is of type SelectionRange<double> and it allows you to set the start and end of a selection range.

Binding the Selection will allow you to control it through a business property which you can dynamically change and set its initial value before or after the application is loaded, depending on your scenario.

You can also handle the SelectionChanged event to find the current SelectionStart and SelectionEnd values. Please note that in runtime the values of the RadSlider SelectionStart/SelectionEnd and Selection properties are synchronized.

I modified the sample to demonstrate this approach. Please give it a try and let me know if it works for you.

Kind regards,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
vijay
Top achievements
Rank 1
answered on 13 Feb 2012, 07:48 AM

thanks it's working great.

will start to play with this.

thanks
-Veejay kommalapati
Tags
Slider
Asked by
vijay
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
vijay
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or