SlideView

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

    Posted 14 Jan 2019 Link to this post

    Button clicked event  property doesn't work inside Slideview.
  2. Lance | Manager Technical Support
    Admin
    Lance | Manager Technical Support avatar
    1186 posts

    Posted 14 Jan 2019 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 2019 in reply to Lance | Manager Technical Support Link to this post

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