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

Initial Return ScrollViewer in RadListBox

1 Answer 54 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 04 Feb 2014, 09:54 AM
Hi, 

I use RadListBox, and RadButtons to change selectedItem of the List.

One of these RadButtons (Button 1)  give me the first item of the List. 

When my selected Item is the last item of my list, and then i click Button1, Selected item is well the first of my list, but the scrollViewer is still at the end of the list.

I hope it's clear...
Do you know how i can do an initial return of my scrollViewer? 

<telerik:RadListBox x:Name="RadListBox" Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Disabled"
                                ItemsSource="{Binding RechercheResident.PagedSyntheseResidents, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                SelectedItem="{Binding RechercheResident.SelectedSyntheseResident, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                   <telerik:RadListBox.Background>
                       <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                           <GradientStop Color="#FF61B003" Offset="0.049"/>
                           <GradientStop Color="#FFC3FD89" Offset="0.854"/>
                           <GradientStop Color="#FFABE475" Offset="0.271"/>
                       </LinearGradientBrush>
                   </telerik:RadListBox.Background>
                   <telerik:RadListBox.ItemsPanel>
                       <ItemsPanelTemplate>
                           <telerik:RadWrapPanel Orientation="Horizontal" />
                       </ItemsPanelTemplate>
                   </telerik:RadListBox.ItemsPanel>
                   <telerik:RadListBox.ItemTemplate>
                       <DataTemplate>
                           <Grid Margin="2" VerticalAlignment="Stretch">
                               <Grid.ColumnDefinitions>
                                   <ColumnDefinition Width="50"/>
                                   <ColumnDefinition Width="80"/>
                               </Grid.ColumnDefinitions>
                               <Image Grid.Column="0" Source="{Binding Photo}" Height="60" Stretch="Fill" />
                               <StackPanel Grid.Column="1" Orientation="Vertical">
                                   <telerik:Label Margin ="0,0,0,0" Content="{Binding Resident.Titre, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource AgmLabelInputStyle}"/>
                                   <telerik:Label Margin ="0,0,0,0" Content="{Binding Resident.Nom, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource AgmLabelInputStyle}"/>
                                   <telerik:Label Margin ="0,0,0,0" Content="{Binding Resident.Prenom, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource AgmLabelInputStyle}"/>
                               </StackPanel>
                           </Grid>
                       </DataTemplate>
                   </telerik:RadListBox.ItemTemplate>
               </telerik:RadListBox>

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 07 Feb 2014, 08:53 AM
Hi Vincent,

I recreated the explained scenario in a sample project, but the ListBox was behaving as expected. When I clicked the button the first item got selected and the ListBox scrolled to the beginning of the items. I'm attaching my project here so you can check it out and let me know if I have missed anything.

Hope this helps.

Regards,
Kalin
Telerik

Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

Tags
ListBox
Asked by
Vincent
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or