void TicksRendering(SliderTickEventArgs eventArgs)
{
if (eventArgs.Value == 0)
eventArgs.Text = "K4";
} |
<div style="width:700px">
<SfSlider TValue="int[]" Min="MinValue()" Max="@MaxValue()" Type="SliderType.Range" Value="SliderValues">
<SliderEvents TValue="int[]" OnTooltipChange="@TooltipChange" TicksRendering="@TickesRendering"></SliderEvents>
<SliderTicksData Placement="Placement.Before" LargeStep="7200000" SmallStep="3600000" ShowSmallTicks="true"></SliderTicksData>
<SliderTooltipData Placement="TooltipPlacement.After" IsVisible="true"></SliderTooltipData>
</SfSlider>
</div>
@code{
int[] SliderValues = new int[] { 43200000, 54000000 };
public double MinValue()
{
DateTime dt = new DateTime(2013, 6, 13, 11, 0, 0);
return dt.TimeOfDay.TotalMilliseconds;
}
public double MaxValue()
{
DateTime dt = new DateTime(2013, 6, 13, 23, 0, 0);
return dt.TimeOfDay.TotalMilliseconds;
}
public void TickesRendering(SliderTickEventArgs args)
{
double time = args.Value / 3600000;
if (time > 11)
{
args.Text = time + ".00 PM";
}
else
{
args.Text = time + ".00 AM";
}
}
public void TooltipChange(SliderTooltipEventArgs<int[]> args)
{
double FirstValue = args.Value[0] / 3600000;
double SecondValue = args.Value[1] / 3600000;
if (FirstValue <= 11 && SecondValue < 11)
{
args.Text = FirstValue + ".00 AM -" + SecondValue + ".00 AM";
}
else if (FirstValue <= 11 && SecondValue > 11)
{
args.Text = FirstValue + ".00 AM -" + SecondValue + ".00 PM";
}
else if (FirstValue > 11 && SecondValue > 11)
{
args.Text = FirstValue + ".00 PM -" + SecondValue + ".00 PM";
}
}
}
|