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

How to set the different RadListViewto each RadSegmentedControl Segment

1 Answer 124 Views
SegmentedControl
This is a migrated thread and some comments may be shown as answers.
Ganesh
Top achievements
Rank 1
Ganesh asked on 09 Aug 2017, 09:22 AM

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

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 11 Aug 2017, 01:21 PM
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
Tags
SegmentedControl
Asked by
Ganesh
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or