protected override void OnAttachedTo(SampleView bindable) { dataGrid = bindable.FindByName <Syncfusion.SfDataGrid.XForms.SfDataGrid>("dataGrid"); dataGrid.GridLongPressed += DataGrid_GridLongPressed; viewModel = bindable.FindByName <SortingViewModel>("viewModel"); popupLayout = bindable.FindByName <Syncfusion.XForms.PopupLayout.SfPopupLayout>("popUpLayout"); popupLayout.PopupView.AnimationMode = AnimationMode.Fade; popupLayout.PopupView.AnimationDuration = 100; popupLayout.PopupView.ShowCloseButton = false; popupLayout.PopupView.ShowFooter = false; popupLayout.PopupView.ShowHeader = false; popupLayout.PopupView.HeightRequest = 195; if (Device.Idiom == TargetIdiom.Phone) { popupLayout.PopupView.WidthRequest = 190; } else { popupLayout.PopupView.WidthRequest = 210; } popupLayout.PopupView.ContentTemplate = new DataTemplate(() => { return(PopupViewInitialization()); }); base.OnAttachedTo(bindable); }
/// <summary> /// You can override this method to subscribe to AssociatedObject events and initialize properties. /// </summary> /// <param name="bindAble">SampleView type of bindAble</param> protected async override void OnAttachedTo(SampleView bindAble) { this.dataGrid = bindAble.FindByName <Syncfusion.SfDataGrid.XForms.SfDataGrid>("dataGrid"); this.dataGrid.GridLongPressed += this.DataGrid_GridLongPressed; this.viewModel = bindAble.FindByName <SortingViewModel>("viewModel"); this.popupLayout = bindAble.FindByName <Syncfusion.XForms.PopupLayout.SfPopupLayout>("popUpLayout"); this.popupLayout.PopupView.AnimationMode = AnimationMode.Fade; this.popupLayout.PopupView.AnimationDuration = 100; this.popupLayout.PopupView.ShowCloseButton = false; this.popupLayout.PopupView.ShowFooter = false; this.popupLayout.PopupView.ShowHeader = false; this.popupLayout.PopupView.HeightRequest = 195; if (Device.Idiom == TargetIdiom.Phone) { this.popupLayout.PopupView.WidthRequest = 190; } else { this.popupLayout.PopupView.WidthRequest = 210; } this.popupLayout.PopupView.ContentTemplate = new DataTemplate(() => { return(PopupViewInitialization()); }); var assembly = Assembly.GetAssembly(Application.Current.GetType()); await Task.Delay(200); this.customView = bindAble.FindByName <Grid>("customLayout"); this.transparent = bindAble.FindByName <Grid>("transparent"); this.myGrid = new Grid(); this.myGrid.VerticalOptions = LayoutOptions.FillAndExpand; this.myGrid.HorizontalOptions = LayoutOptions.FillAndExpand; this.myGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = new GridLength(1.1, GridUnitType.Star) }, new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }, }; this.myGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); this.myGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1.8, GridUnitType.Star) }); this.myGrid.Children.Add( new Image() { Opacity = 1.0, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Source = "ContextMenuIllustration.png" }, 1, 1); this.myGrid.BackgroundColor = Color.Transparent; this.myGrid.GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(this.Collapse) }); this.customView.Children.Add(this.myGrid); base.OnAttachedTo(bindAble); }