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

Content Page in SlideView?

3 Answers 154 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 1
Rodney asked on 06 Nov 2018, 06:09 PM

Is it possible to have a Content Page inside a SlideView?

I have a SlideView with three ContentViews. each has Xamarin Forms controls on them. I need to reuse the code on one of the content views. What's the best way to do that? I have a page which lists items. Some of the items need to go to this ContentView and other items need to go to a new page with a copy of this ContentView. How do I make the best reuse of this code? 

3 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 06 Nov 2018, 06:37 PM
Hello Rodney,

It is not possible to use a ContentPage in the place where a ContentView type is required.

Ultimately, to answer your question, the best way to reuse a ContentView content is to just define that ContentView as a File (Visual Studio  > Add > New Item > ContentView). Then, you can even use multiple instances of that ContentView in the same SlideView. 

For example, let's say you named the ContentView file "MyView", you can define the SlideView as:

<telerikPrimitives:RadSlideView x:Name="slideView">
    <telerikPrimitives:RadSlideView.ItemsSource>
        <x:Array Type="{x:Type ContentView}">
            <local:MyView/>
            <local:MyView/>
            <local:MyView/>
        </x:Array>
    </telerikPrimitives:RadSlideView.ItemsSource>
</telerikPrimitives:RadSlideView>

For a runnable demo project that takes this approach, see my forum post reply from earlier today.

Regards,
Lance | Tech Support Engineer, Sr.
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
0
Rodney
Top achievements
Rank 1
answered on 08 Nov 2018, 05:52 PM

How would you pass data to a child Content View? 

Let say that this page has an particular ID you want to pass into the child content view. 

how would you do something like this:

<local:MyView Channel="{Binding channelId} />

or any other properties? (May be a dumb questions but I"m new to Xamarin and Telerik)

is it possible?

 

 

0
Lance | Manager Technical Support
Telerik team
answered on 08 Nov 2018, 07:19 PM
Hello Rodeny,

You can't do this because the control is not in a databound mode. Those  ContentViews do not have any scope to the ContentPage instance. If you follow the approach I've shared with you in this forum post, then you can use data binding in the Datatemplate's element.

You would "pass" the ID to the content via the bound object, in this case the MySlideViewItem object.

Regards,
Lance | Tech Support Engineer, Sr.
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
SlideView
Asked by
Rodney
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Rodney
Top achievements
Rank 1
Share this question
or