Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5124
Tickmark intervals in the XamDateTimeRangeSlider
posted

I recently helped a customer who was using the XamDateTimeRangeSlider, whereby he wanted the tickmarks to be spaced at the start of each week of a month (e.g., "For the month of January, I want the tick marks to be placed as start of every week. So the first four tick intervals will have the same length, and the last interval will only be 3 days."):

The customer noted that by using the following settings:

      timeSlider.TickMarks[0].NumberOfTickMarks = 3;
      and setting UseFrequency="False"...

"...The tickmarks are are drawn in regular intervals based on the number of tickmarks."

In this situation, the best approach is to add the TickMarkValues manually in code, as follows:

XAML markup:
<ig:XamDateTimeRangeSlider Name="xamDateTimeRangeSlider1"
                           MinValue="1/1/2011" 
                           MaxValue="1/31/2011"/>

with the Loaded event handled below:

SliderTickMarks<DateTime> stm = new SliderTickMarks<DateTime>();
stm.TickMarksValues.Add(
new DateTime(2011, 1, 2));
stm.TickMarksValues.Add(
new DateTime(2011, 1, 9));
stm.TickMarksValues.Add(
new DateTime(2011, 1, 16));
stm.TickMarksValues.Add(
new DateTime(2011, 1, 23));
stm.TickMarksValues.Add(
new DateTime(2011, 1, 30));
xamDateTimeRangeSlider1.TickMarks.Add(stm);

 

 



 

Parents
No Data
Reply Children
No Data