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
20
XamWebDateTimeRangeSlider doesnot update the minvalue
posted

Hi

I am using the XamWebDateTimeRangeSlider and setting the min and max values of the slider dynamically.For some reason _slider.MinValue doesnot get updated (stores the previous value) with the recent value though I get the value at  minvalue.AddHours(-23) .I am posting my code can somebody please help me with that.

public

 

void SelectedValues(DateTime minvalue, DateTime maxvalue)

{

 

 

if

 

(minvalue == maxvalue)

{

_slider.MinValue = minvalue.AddHours(-23);

_slider.MaxValue = minvalue;

Infragistics.Silverlight.

FrequencyType type = (Infragistics.Silverlight.FrequencyType)Enum.Parse(typeof(Infragistics.Silverlight.FrequencyType), "Hours", true);

tickType = type;

 

 

foreach (DateTimeSliderTickMarks tick in _slider.TickMarks)

{

tick.FrequencyType = type;

}

}

}

xaml

 

 

 

 

 

 

 

 

<

 

 

Grid x:Name="LayoutRoot" Background

="White">

 

 

 

<m:Map Name

="map">

 

 

 

<Grid x:Name="_slidergrid" VerticalAlignment="Bottom" Margin="10,0,10,20" Height="40" HorizontalAlignment

="Stretch" >

 

 

 

<Rectangle Fill="{StaticResource ContainerBgBrush}" StrokeThickness="0" RadiusX="15" RadiusY="15" Grid.ColumnSpan="3" Effect="{StaticResource ShadowEffect

}" />

 

 

 

<Border BorderThickness="1,1,0,0" CornerRadius="15" BorderBrush="{StaticResource ContainerBorderBrush}" Grid.ColumnSpan

="3" />

 

 

 

<igSlider:XamWebDateTimeRangeSlider x:Name="_slider" VerticalAlignment="Center" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" ThumbValueChanged

="_slider_ThumbValueChanged">

 

 

 

<igSlider:XamWebDateTimeRangeSlider.TickMarks

>

 

 

 

<igSlider:DateTimeSliderTickMarks IncludeSliderEnds="True" HorizontalTickMarksTemplate="{StaticResource HorizontalLabels

}" />

 

 

 

</igSlider:XamWebDateTimeRangeSlider.TickMarks

>

 

 

 

 

 

 

<igSlider:XamWebSliderDateTimeThumb IsSnapToTickEnabled="True" InteractionMode="Push" TrackFillBrush

="Transparent" />

 

 

 

<igSlider:XamWebSliderDateTimeThumb IsSnapToTickEnabled="True" InteractionMode="Push" TrackFillBrush="{StaticResource SliderTrackFill

}"/>

 

 

 

</igSlider:XamWebDateTimeRangeSlider

>

 

 

 

</Grid>

<

 

DataTemplate x:Key="HorizontalLabels">

 

 

<StackPanel>

 

 

<Rectangle Width="2" Height="6" Fill="White" VerticalAlignment="Top" Margin="0,6,0,0"/>

 

 

<TextBlock x:Name="Labels" Loaded="TextBlock_Loaded" Tag="{Binding}" TextWrapping="NoWrap" Foreground="White" Margin="0,4,0,0"/>

 

 

</StackPanel>

 

 

</DataTemplate>

Parents
No Data
Reply
  • 4666
    posted

    Hi,

    Did you try with 10.2 version:

    The sample that i did works good:

        <Grid x:Name="LayoutRoot" Background="White">

            <Grid.RowDefinitions>

                <RowDefinition Height="170"/>

                <RowDefinition Height="30"/>

                <RowDefinition Height="30"/>

                <RowDefinition Height="70"/>

            </Grid.RowDefinitions>

            <Grid x:Name="CalendarGrid">

                <Grid.ColumnDefinitions>

                    <ColumnDefinition />

                    <ColumnDefinition/>

     

                </Grid.ColumnDefinitions>

                <basics:Calendar x:Name="startCalendar" SelectedDate="8/1/2010" HorizontalAlignment="Right"/>

                <basics:Calendar Grid.Column="1" x:Name="endCalendar" SelectedDate="8/4/2010" HorizontalAlignment="Right"/>

            </Grid>

            <Grid Grid.Row="1">

                <Grid.ColumnDefinitions>

                    <ColumnDefinition/>

                    <ColumnDefinition/>

                    <ColumnDefinition/>

                    <ColumnDefinition/>

                </Grid.ColumnDefinitions>

                <sdk:Label Content="Min:"/>

                <TextBox x:Name="TxtMin" Grid.Column="1" Text="{Binding MinValue, ElementName=_slider}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

                <sdk:Label Grid.Column="2" Content="Max:"/>

                <TextBox x:Name="TxtMax" Grid.Column="3" Text="{Binding MaxValue, ElementName=_slider}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

            </Grid>

            <Button Grid.Row="2" x:Name="BtnSetMinMax" Content="Set Min Max" Click="BtnSetMinMax_Click"/>

            <Grid x:Name="_slidergrid" Grid.Row="3" VerticalAlignment="Bottom" Margin="10,0,10,20" Height="40" HorizontalAlignment="Stretch" >

                <Rectangle StrokeThickness="0" Fill="Gray" RadiusX="15" RadiusY="15" Grid.ColumnSpan="3" />

                <Border BorderThickness="1,1,0,0" CornerRadius="15" BorderBrush="Red" Grid.ColumnSpan="3" />

     

     

                <igSlider:XamDateTimeRangeSlider MinValue="8/1/2010" MaxValue="8/4/2010" x:Name="_slider" VerticalAlignment="Center" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" ThumbValueChanged ="_slider_ThumbValueChanged">

                    <igSlider:XamDateTimeRangeSlider.TickMarks>

                        <igSlider:DateTimeSliderTickMarks FrequencyType="Hours" TickMarksFrequency="4" IncludeSliderEnds="True"/>

                    </igSlider:XamDateTimeRangeSlider.TickMarks>

                </igSlider:XamDateTimeRangeSlider>

     

     

            </Grid>

        </Grid>

            private void BtnSetMinMax_Click(object sender, RoutedEventArgs e)

            {

                if(startCalendar.SelectedDate == null || endCalendar.SelectedDate == null)

                {

                    return;

                }

     

                DateTime minvalue = (DateTime) startCalendar.SelectedDate;

                DateTime maxvalue = (DateTime) endCalendar.SelectedDate;

     

                DateTime minvalue1 = _slider.MinValue;

                DateTime maxvalue2 = _slider.MaxValue;

     

                if(minvalue == maxvalue)

     

                {

     

                    _slider.MinValue = minvalue.AddHours(-23);

     

                    _slider.MaxValue = minvalue;

                }

     

                else

                {

                    _slider.MinValue = minvalue;

                    _slider.MaxValue = maxvalue;

                }

     

            }

     Best!

    Mihail

Children
No Data