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

RadSideDrawer Events not fired on UWP

1 Answer 126 Views
SideDrawer
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 31 Dec 2017, 07:20 AM

I have noticed what appears to be a bug on the RadSideDrawer on UWP. Basically only the DrawerOpened and DrawerClosed events fire, and they do not do so in a predictable manner. I have not been able to get the DrawerOpening or DrawerClosing events to fire at all. Also the binding for IsOpen is deficult to predict, if I close the draw by swiping to close it then IsClosed does not appear to be updated to reflect the fact that the draw is closed, none of the closed/closing events fire either. 

Behavior: Swiping to open or close does not fire DrawerOpening,DrawerClosing,DrawerOpened,DrawerClosed events. IsOpen() does not get updated

Expected Behavior: Swiping to open or close would fire all events like android and iOS(tested and working with code below). IsOpen() should also be updated to reflect correct state.

 

My project setup and steps to reproduce are as follows:

Xamarin Forms Netstandard 2.0 project.

IDE:Visual studio 15.5.1

Xamarin.Forms(2.5.0.121934)

Prism.DryIoC.Forms(7.0.0.340-ci)

Telerik.UI.for.Xamarin.Common.Trial(2017.3.913.3)

Telerik.UI.for.Xamarin.Primitives.Trial(2017.3.913.3)

XAML Code:

 <telerikPrimitives:RadSideDrawer DrawerLength="275" DrawerLocation="Right" IsOpen="{Binding MenuOpen, Mode=TwoWay}">

        <telerikPrimitives:RadSideDrawer.Behaviors>
            <b:EventToCommandBehavior Command="{Binding DrawerClosedCommand}" EventName="DrawerClosed" />
            <b:EventToCommandBehavior Command="{Binding DrawerClosingCommand}" EventName="DrawerClosing" />
            <b:EventToCommandBehavior Command="{Binding DrawerOpenedCommand}" EventName="DrawerOpened" />
            <b:EventToCommandBehavior Command="{Binding DrawerOpeningCommand}" EventName="DrawerOpening" />
        </telerikPrimitives:RadSideDrawer.Behaviors>

        <telerikPrimitives:RadSideDrawer.MainContent>

            <StackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
                <Label TextColor="Black" HorizontalOptions="Center" Text="Welcome to Training wheels." />
                <Label TextColor="Black" HorizontalOptions="Center" Text="Minervex Software" />
                <Button Text="IClipBoardService" Command="{Binding NavigateToPageCommand}" CommandParameter="IClipboardServicePage"/>
                <Button Text="IManagePictureService" Command="{Binding NavigateToPageCommand}" CommandParameter="IManagePictureServicePage"/>
                <Button Text="CreateUserPage" Command="{Binding NavigateToPageCommand}" CommandParameter="CreateUserPage"/>
                <Button Text="UserProfilePage" Command="{Binding NavigateToPageCommand}" CommandParameter="UserProfilePage"/>
            </StackLayout>

        </telerikPrimitives:RadSideDrawer.MainContent>
        <telerikPrimitives:RadSideDrawer.DrawerContent>
            <StackLayout>
                <Button Text="Mail" />
                <Button Text="Calendar" />
                <Button Text="People" />
                <Button Text="Tasks" />
            </StackLayout>
        </telerikPrimitives:RadSideDrawer.DrawerContent>
    </telerikPrimitives:RadSideDrawer>

View model code

{

private bool _menuOpen;
 public class MainPageViewModel : BaseViewModel
    {
        public bool MenuOpen
        {
            get { return _menuOpen; }
            set { SetProperty(ref _menuOpen, value); }
        }

        public Command DrawerOpeningCommand { get; set; }
        public Command DrawerOpenedCommand { get; set; }
        public Command DrawerClosingCommand { get; set; }
        public Command DrawerClosedCommand { get; set; }

        public MainPageViewModel(INavigationService NavigationService, IEventAggregator EventAggregator, IDependencyService DependencyService, IPageDialogService PageDialogService, IContainer Container) 
            : base(NavigationService, EventAggregator, DependencyService, PageDialogService, Container)
        {
            Title = "Main Page";
            MenuItemClickedCommand = new DelegateCommand(MenuItemClicked);
            DrawerClosedCommand = new Command(DrawClosed);
            DrawerClosingCommand = new Command(DrawClosing);
            DrawerOpeningCommand = new Command(DrawOpening);
            DrawerOpenedCommand = new Command(DrawOpened);

        }

        private void MenuItemClicked()
        {
            if (MenuOpen)
            {
                MenuOpen = false;
            }
            else
            {
                MenuOpen = true;
            }
        }

        private void DrawOpening()
        {
        }

        private void DrawOpened()
        {
        }

        private void DrawClosing()
        {
        }
        private void DrawClosed()
        {
        }

}

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 03 Jan 2018, 03:06 PM
Hello, Bryan,

Thank you for the detailed explanation of your scenario and the behavior of the control. We have previously fixed an issue where the events related to opening/closure are not thrown, however, the fix affected only the DrawerOpened and DrawerClosed events. We have the task of exposing the Closing/Opening events as well so that users can use this functionality too. Here is the public item - SideDrawer[UWP]: Add Opening/Closing events. You can subscribe to the item in order to receive automatic notifications when an update is available.

In the meantime, I will need some more time to have a look at the unpredictable behavior of the DrawerOpened and DrawerClosed events which you have reported. I will update the thread once we have more information on the matter.

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
SideDrawer
Asked by
Bryan
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or