SlideView

3 posts, 0 answers
  1. Nethra
    Nethra avatar
    7 posts
    Member since:
    Jan 2019

    Posted 14 Jan Link to this post

    Button clicked event  property doesn't work inside Slideview.
  2. Lance | Technical Support Engineer, Principal
    Admin
    Lance | Technical Support Engineer, Principal avatar
    1021 posts

    Posted 14 Jan Link to this post

    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
  3. Nethra
    Nethra avatar
    7 posts
    Member since:
    Jan 2019

    Posted 15 Jan in reply to Lance | Technical Support Engineer, Principal Link to this post

    Thank You!! It works as expected.
Back to Top