How to set the different RadListViewto each RadSegmentedControl Segment

2 posts, 0 answers
  1. Ganesh
    Ganesh avatar
    11 posts
    Member since:
    Jun 2017

    Posted 09 Aug Link to this post

    I am using RadSegmentedControl and RadListView

    I need to set the multiple views in each segment like Tabs, I have added the 2 Segment buttons and 2 RadListView. Now I would like to show one RadListView once the segment change.

    So let me know how to show different RadListView content on each segment selection.

    I Used SelectionChanged event but If one Listview is showing. I am changing the IsVisible flag accordingly,

    <telerikDataControls:RadListView x:Name="ListView1" IsVisible="{Binding IsWorkList}" ItemsSource="{Binding WorkListItems}">
                <telerikDataControls:RadListView.ItemTemplate>
                    <DataTemplate>
                        <telerikListView:ListViewTemplateCell>
                            <telerikListView:ListViewTemplateCell.View>
                                <StackLayout Orientation="Vertical">
                                    <Label Text="FormTypeAndDescription: "/>
                                    <Label Text="{Binding FormTypeAndDescription}"/>
                                </StackLayout>
                            </telerikListView:ListViewTemplateCell.View>
                        </telerikListView:ListViewTemplateCell>
                    </DataTemplate>
                </telerikDataControls:RadListView.ItemTemplate>
            </telerikDataControls:RadListView>
            <telerikDataControls:RadListView x:Name="listView2" IsVisible="{Binding IsPendings}" ItemsSource="{Binding PendingListItems}">
                <telerikDataControls:RadListView.ItemTemplate>
                    <DataTemplate>
                        <telerikListView:ListViewTemplateCell>
                            <telerikListView:ListViewTemplateCell.View>
                                <StackLayout Orientation="Vertical">
                                    <Label Text="DepartmentName: "/>
                                    <Label Text="{Binding DepartmentName}"/>
                                </StackLayout>
                            </telerikListView:ListViewTemplateCell.View>
                        </telerikListView:ListViewTemplateCell>
                    </DataTemplate>
                </telerikDataControls:RadListView.ItemTemplate>
            </telerikDataControls:RadListView>

    Thank you

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    503 posts

    Posted 11 Aug Link to this post

    Hello Ganesh,

    I did not face any issues when trying a similar approach where I am changing the visibility of the different RadListViews. Please have a look at the attached sample. There might be an issue with the bindings at your end. Please make sure that the binding mode is set to TwoWay and that property changed notifications are raised.

    Furthermore, instead of using a SegmentedControl, you can consider integrating a TabView where you can directly set the content of each tab and you would not need to utilize the events of the SegmentedControl and manually switch the visibility. There are examples available in the SDK Samples Browser which can be found in the Examples folder of your local Telerik UI for Xamarin installation.

    Have a great weekend.

    Regards,
    Stefan Nenchev
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top