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

SlideView

2 Answers 85 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
Nethra
Top achievements
Rank 1
Nethra asked on 14 Jan 2019, 03:20 PM
Button clicked event  property doesn't work inside Slideview.

2 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 14 Jan 2019, 09:01 PM
Hello Nethra,

This is expected because ContentViews are not in the same scope as that page's code behind.  So that you can understand the infrastructure of the RadSlideView and not get stuck with the issue in the future, Let me explain further.


All the ContentViews in a SlideView.ItemsSource do not share any BindingContext or scope with that page it is defined on. If you need event handler, then you'll want to redefine the ContentView in a separate file and use the event handler in the ContentView's code-behind.

For example

<ContentView x:Class="myApp.Views.MyContentView" .... >
    <Grid>
        <Button Cliecked="OnClicked" />
    </Grid>
<ContentView>
using Xamarin.Forms;
 
namespace MyApp.Views
{
    public partial class MyContentView : ContentView
    {
        public MyContentView()
        {
        }
 
        public void Onclicked(object sender, EventArgs e)
        {
 
        }
    }
}


Then you can use an instance of that ContentView in the SlideView

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

If you need interaction between the SlideView and the page's binding context, you could create a global static helper class that both the ContentView and the Page have access to.

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
Nethra
Top achievements
Rank 1
answered on 15 Jan 2019, 03:47 PM
Thank You!! It works as expected.
Tags
SlideView
Asked by
Nethra
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Nethra
Top achievements
Rank 1
Share this question
or