protected override void OnElementChanged(ElementChangedEventArgs<Slider> e) { base.OnElementChanged(e); formsSlider = (CustomSlider)this.Element; formsSlider.Value = 1; formsSlider.CurrentValue = 1; FeelingNowPage.sliderValue = 1; winSlider = (System.Windows.Controls.Slider)Control; winSlider.Style = (System.Windows.Style)App.Current.Resources["newtheme"]; winSlider.LostMouseCapture += slider_LostMouseCapture; }
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e) { base.OnElementChanged(e); control = (SeekBar)Control; //control.ScaleY = 3; //control.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.drag_bg)); formsSlider = (CustomSlider)this.Element; formsSlider.Value = 1; formsSlider.CurrentValue = 1; FeelingNowPage.sliderValue = 1; Android.Graphics.Drawables.Drawable drawable = Resources.GetDrawable(Resource.Drawable.drag_btn); control.SetThumb(drawable); control.ProgressChanged += control_ProgressChanged; control.StopTrackingTouch += control_StopTrackingTouch; control.StartTrackingTouch += control_StartTrackingTouch; }
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e) { base.OnElementChanged(e); formsSlider = (CustomSlider)this.Element; if (formsSlider != null) { formsSlider.Value = 1; formsSlider.CurrentValue = 1; } FeelingNowPage.sliderValue = 1; UISlider control = (UISlider)Control; control.Value = 1.0f; control.SetThumbImage(new UIImage("drag_btn.png"), UIControlState.Normal); control.ValueChanged += (object sender, EventArgs evnt) => { if( control.Value > 0 ) { control.SetThumbImage(new UIImage("drag_btn.png"), UIControlState.Normal); } else { control.SetThumbImage(new UIImage("drag_btn_no.png"), UIControlState.Normal); } }; control.TouchUpInside += (object sender, EventArgs be) => { if( formsSlider.StopGesture != null ) { formsSlider.CurrentValue = (int)formsSlider.Value; formsSlider.StopGesture(false); } }; }
public void Dispose() { this.mainTitleBar.imageAreaTapGestureRecognizer.Tapped -= imageAreaTapGestureRecognizer_Tapped; this.mainTitleBar = null; this.subTitleBar.BackButtonTapRecognizer.Tapped -= OnBackButtonTapRecognizerTapped; this.subTitleBar.NextButtonTapRecognizer.Tapped -= NextButtonTapRecognizer_Tapped; this.Appearing -= FeelingNowPage_Appearing; this.goalsAndDreamsPickerButton.Clicked -= OnGoalsPickerButtonClicked; this.goalsAndDreamsPickerButton = null; this.actionPickerButton.Clicked -= OnActionPickerButtonClicked; this.actionPickerButton = null; this.subTitleBar = null; this.masterLayout = null; // this.deviceSpec = null; actionPreviewListSource.Clear(); actionPreviewListSource = null; this.actionPreviewListView = null; this.listContainer = null; this.slider = null; this.selectedGoal = null; this.selectedActions = null; GC.Collect(); }
public FeelingsSecondPage() { progressBar = DependencyService.Get<IProgressBar>(); NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); //deviceSpec = DependencyService.Get<IDeviceSpec>(); AddEventsSituationsOrThoughts.feelingSecondPage = this; this.Appearing += FeelingsSecondPage_Appearing; actionPreviewListSource = new ObservableCollection<PreviewItem>(); mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped; subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Emotional Awareness"); subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped; subTitleBar.NextButtonTapRecognizer.Tapped += NextButtonTapRecognizer_Tapped; screenHeight = App.screenHeight; screenWidth = App.screenWidth; aePicker = null; actionlist = null; Label firstLine = new Label(); firstLine.Text = "Does being"; firstLine.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; firstLine.TextColor = Color.FromRgb(40, 47, 50); firstLine.HeightRequest = screenHeight * 15 / 100; firstLine.HorizontalOptions = LayoutOptions.Center; firstLine.WidthRequest = screenWidth; firstLine.XAlign = TextAlignment.Center; Label secondLine = new Label(); secondLine.Text = App.SelectedEmotion; secondLine.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; secondLine.FontAttributes = FontAttributes.Italic; secondLine.TextColor = Constants.BLUE_BG_COLOR;//Color.FromRgb(40, 47, 50); secondLine.HeightRequest = screenHeight * 15 / 100; secondLine.HorizontalOptions = LayoutOptions.Center; secondLine.WidthRequest = screenWidth; secondLine.XAlign = TextAlignment.Center; Label thirdLine = new Label(); thirdLine.Text = "support your goals and dreams?"; thirdLine.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; thirdLine.TextColor = Color.FromRgb(40, 50, 50); thirdLine.HeightRequest = screenHeight * 11 / 100; thirdLine.HorizontalOptions = LayoutOptions.Center; thirdLine.WidthRequest = screenWidth; thirdLine.XAlign = TextAlignment.Center; goalsAndDreamsPickerButton = new PurposeColor.interfaces.CustomImageButton(); goalsAndDreamsPickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", @"/Assets/select_box_whitebg.png"); goalsAndDreamsPickerButton.Text = "Goals & Dreams"; goalsAndDreamsPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; goalsAndDreamsPickerButton.TextOrientation = interfaces.TextOrientation.Left; goalsAndDreamsPickerButton.FontSize = 17; goalsAndDreamsPickerButton.TextColor = Color.Gray; goalsAndDreamsPickerButton.WidthRequest = screenWidth * 90 / 100; goalsAndDreamsPickerButton.Clicked += OnGoalsPickerButtonClicked; actionPickerButton = new CustomImageButton(); actionPickerButton.IsVisible = false; actionPickerButton.BackgroundColor = Color.FromRgb(30, 126, 210); actionPickerButton.Text = "Add Supporting Actions"; actionPickerButton.TextColor = Color.White; actionPickerButton.TextOrientation = TextOrientation.Middle; actionPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; // actionPickerButton.TextOrientation = interfaces.TextOrientation.Left; actionPickerButton.WidthRequest = screenWidth * 90 / 100; actionPickerButton.Clicked += OnActionPickerButtonClicked; if (App.screenDensity > 1.5) { firstLine.FontSize = Device.OnPlatform(20, 20, 30); secondLine.FontSize = Device.OnPlatform(20, 22, 30); thirdLine.FontSize = Device.OnPlatform(20, 20, 30); actionPickerButton.FontSize = 17; actionPickerButton.HeightRequest = screenHeight * 6 / 100; goalsAndDreamsPickerButton.HeightRequest = screenHeight * 6 / 100; } else { firstLine.FontSize = Device.OnPlatform(16, 18, 26); secondLine.FontSize = Device.OnPlatform(16, 20, 26); thirdLine.FontSize = Device.OnPlatform(16, 18, 26); actionPickerButton.FontSize = 15; actionPickerButton.HeightRequest = screenHeight * 9 / 100; goalsAndDreamsPickerButton.HeightRequest = screenHeight * 9 / 100; } slider = new CustomSlider { Minimum = -2, Maximum = 2, WidthRequest = screenWidth * 90 / 100 }; slider.StopGesture = GetstopGetsture; //Image sliderDivider1 = new Image(); //sliderDivider1.Source = "drag_sepeate.png"; //Image sliderDivider2 = new Image(); //sliderDivider2.Source = "drag_sepeate.png"; //Image sliderDivider3 = new Image(); //sliderDivider3.Source = "drag_sepeate.png"; //Image sliderBG = new Image(); //sliderBG.Source = "drag_bg.png"; this.Appearing += FeelingNowPage_Appearing; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 9)); masterLayout.AddChildToLayout(firstLine, 0, 20); masterLayout.AddChildToLayout(secondLine, 0, 25); masterLayout.AddChildToLayout(thirdLine, 0, 30); //masterLayout.AddChildToLayout(sliderBG, 7, 45); masterLayout.AddChildToLayout(slider, 5, Device.OnPlatform(37, 35, 34)); /* masterLayout.AddChildToLayout(sliderDivider1, 30, 45.5f); masterLayout.AddChildToLayout(sliderDivider2, 50, 45.5f); masterLayout.AddChildToLayout(sliderDivider3, 70, 45.5f);*/ masterLayout.AddChildToLayout(goalsAndDreamsPickerButton, 5, Device.OnPlatform(50, 50, 45)); masterLayout.AddChildToLayout(actionPickerButton, 5, Device.OnPlatform(65, 65, 55)); listContainer = new StackLayout(); listContainer.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; listContainer.WidthRequest = screenWidth * 90 / 100; listContainer.HeightRequest = screenHeight * 20 / 100; listContainer.ClassId = "preview"; actionPreviewListView = new ListView(); actionPreviewListView.BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY; actionPreviewListView.ItemTemplate = new DataTemplate(typeof(ActionPreviewCellItem)); ActionPreviewCellItem.mainPage = this; actionPreviewListView.SeparatorVisibility = SeparatorVisibility.None; actionPreviewListView.Opacity = 1; actionPreviewListView.ItemsSource = actionPreviewListSource; listContainer.Children.Add(actionPreviewListView); masterLayout.AddChildToLayout(listContainer, 5, Device.OnPlatform(73, 73, 64)); Content = masterLayout; }
public void Dispose() { this.eventPickerButton = null; this.eventPickerButton.Clicked -= OnEventPickerButtonClicked; this.emotionalPickerButton = null; this.emotionalPickerButton.Clicked -= OnEmotionalPickerButtonClicked; this.slider = null; this.masterLayout = null; this.progressBar = null; this.selectedEmotionItem = null; this.selectedEventItem = null; this.about = null; this.subTitleBar.NextButtonTapRecognizer.Tapped -= OnNextButtonTapRecognizerTapped; this.subTitleBar.BackButtonTapRecognizer.Tapped -= OnBackButtonTapRecognizerTapped; this.subTitleBar = null; this.Appearing -= OnFeelingNowPageAppearing; this.mainTitleBar = null; sliderValLabel = null; emotionTextLabel = null; eventTextLabel = null; imagesContainer = null; feedbackLabelStack = null; sliderFeedbackStack = null; feelingFeedbackStack = null; eventFeedbackStack = null; hLine = null; emotionTextTap = null; GC.Collect(); }
public FeelingNowPage() { NavigationPage.SetHasNavigationBar(this, false); masterLayout = new CustomLayout(); masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244); screenHeight = App.screenHeight; screenWidth = App.screenWidth; progressBar = DependencyService.Get<IProgressBar>(); currentUser = App.Settings.GetUser (); AddEventsSituationsOrThoughts.feelingsPage = this; mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped; subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Emotional Awareness"); subTitleBar.NextButtonTapRecognizer.Tapped += OnNextButtonTapRecognizerTapped; subTitleBar.BackButtonTapRecognizer.Tapped += OnBackButtonTapRecognizerTapped; slider = new CustomSlider { Minimum = -2, Maximum = 2, WidthRequest = screenWidth * 90 / 100 }; slider.StopGesture = GetstopGetsture; Label howYouAreFeeling = new Label(); howYouAreFeeling.Text = Constants.HOW_YOU_ARE_FEELING; howYouAreFeeling.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; howYouAreFeeling.TextColor = Color.FromRgb(40, 47, 50); howYouAreFeeling.HorizontalOptions = LayoutOptions.Center; Label howYouAreFeeling2 = new Label(); howYouAreFeeling2.Text = "feeling now ?"; howYouAreFeeling2.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; howYouAreFeeling2.TextColor = Color.FromRgb(40, 47, 50); howYouAreFeeling2.HorizontalOptions = LayoutOptions.Center; #region Emotion pic button emotionalPickerButton = new PurposeColor.interfaces.CustomImageButton (); emotionalPickerButton.ImageName = Device.OnPlatform ("select_box_whitebg.png", "select_box_whitebg.png", @"/Assets/select_box_whitebg.png"); emotionalPickerButton.Text = "Select Emotion"; emotionalPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; emotionalPickerButton.TextOrientation = interfaces.TextOrientation.Left; emotionalPickerButton.TextColor = Color.Gray; emotionalPickerButton.WidthRequest = screenWidth * 90 / 100; emotionalPickerButton.Clicked += OnEmotionalPickerButtonClicked; eventPickerButton = new PurposeColor.interfaces.CustomImageButton (); eventPickerButton.IsVisible = false; eventPickerButton.ImageName = Device.OnPlatform ("select_box_whitebg.png", "select_box_whitebg.png", "/Assets/select_box_whitebg.png"); eventPickerButton.Text = "Events, Situation & Thoughts"; eventPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; eventPickerButton.TextOrientation = interfaces.TextOrientation.Left; eventPickerButton.TextColor = Color.Gray; eventPickerButton.WidthRequest = screenWidth * 90 / 100; if (!eventsDisplaying) { eventPickerButton.Clicked += OnEventPickerButtonClicked; } #endregion #region About text about = new Label (); about.IsVisible = false; about.Text = "About"; about.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; about.WidthRequest = screenWidth; about.HorizontalOptions = LayoutOptions.Center; about.XAlign = TextAlignment.Center; about.FontFamily = Constants.HELVERTICA_NEUE_LT_STD; about.TextColor = Color.FromRgb (40, 47, 50); int fontSize = 15; if (App.screenDensity > 1.5) { howYouAreFeeling.FontSize = Device.OnPlatform (20, 22, 30); howYouAreFeeling2.FontSize = Device.OnPlatform (20, 22, 30); about.FontSize = Device.OnPlatform (15, 18, 30); emotionalPickerButton.HeightRequest = screenHeight * 6 / 100; fontSize = 17; eventPickerButton.HeightRequest = screenHeight * 6 / 100; } else { howYouAreFeeling.FontSize = Device.OnPlatform (16, 18, 26); howYouAreFeeling2.FontSize = Device.OnPlatform (16, 18, 26); about.FontSize = Device.OnPlatform (16, 18, 26); emotionalPickerButton.HeightRequest = screenHeight * 9 / 100; fontSize = 15; eventPickerButton.HeightRequest = screenHeight * 9 / 100; } emotionalPickerButton.FontSize = Device.OnPlatform (fontSize, fontSize, 22); eventPickerButton.FontSize = Device.OnPlatform (fontSize, fontSize, 22); #endregion this.Appearing += OnFeelingNowPageAppearing; sliderValue = slider.CurrentValue; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10)); sliderValLabel = new Label { TextColor = Constants.BLUE_BG_COLOR, BackgroundColor = Color.Transparent, XAlign = TextAlignment.Start }; sliderValueImage = new Image { Source = "Sliderfeedback0.png", HeightRequest = 30, Aspect = Aspect.Fill, InputTransparent = true, BackgroundColor = Color.Transparent, }; #region SLIDER LABEL TAP TapGestureRecognizer sliderLabelTapRecognizer = new TapGestureRecognizer(); sliderLabelTapRecognizer.Tapped += (s, e) => { /// show a slider as a popup and get its value, RemoveSliderPopup(); popupSlider = new CustomSlider { Minimum = -2, Maximum = 2, WidthRequest = screenWidth * 90 / 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, CurrentValue = sliderValue }; StackLayout sliderBg = new StackLayout { BackgroundColor = Color.Black, Opacity = .95, HeightRequest = App.screenHeight, WidthRequest = App.screenWidth, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Children = { new StackLayout{HeightRequest = 250}, new StackLayout{ Children = { popupSlider }, Padding = 10, BackgroundColor = Color.FromRgb(244, 244, 244), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Opacity = 1 } }, ClassId = "sliderBg" }; TapGestureRecognizer sliderBgTapRecognizer = new TapGestureRecognizer(); sliderBg.GestureRecognizers.Add(sliderBgTapRecognizer); sliderBgTapRecognizer.Tapped += (snd, eve) => { RemoveSliderPopup(); }; popupSlider.CurrentValue = slider.CurrentValue; popupSlider.StopGesture = GetstopGetsture; masterLayout.AddChildToLayout(sliderBg, 0, 0); }; #endregion emotionTextLabel = new Label { TextColor = Constants.BLUE_BG_COLOR, BackgroundColor = Color.Transparent, XAlign = TextAlignment.Start, FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform(12, 14, 26) }; emotionTextTap = new TapGestureRecognizer(); emotionTextTap.Tapped += EmotionTextTap_Tapped; eventTextLabel = new Label { TextColor = Constants.BLUE_BG_COLOR, BackgroundColor = Color.Transparent, XAlign = TextAlignment.Start, FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform(12, 14, 26) }; eventTextTap = new TapGestureRecognizer(); eventTextTap.Tapped += async (s, e) => { if (!eventsDisplaying) { await Task.Delay(100); OnEventPickerButtonClicked(eventPickerButton, EventArgs.Empty); } }; //eventTextLabel.GestureRecognizers.Add(eventTextTap); sliderFeedbackStack = new StackLayout { IsVisible = false, BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, Spacing = 0, Padding = new Thickness (App.screenWidth * .10, 0, 10, 0), Children = { new Label { FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform(12, 14, 26), Text = "Happiness : ", TextColor = Color.Black, VerticalOptions = LayoutOptions.End, }, sliderValueImage } }; sliderFeedbackStack.GestureRecognizers.Add(sliderLabelTapRecognizer); feelingFeedbackStack = new StackLayout { IsVisible = false, Orientation = StackOrientation.Horizontal, Spacing = 0, Padding = new Thickness (App.screenWidth * .10, 0, 10, 0), Children = { new Label { Text = "Feeling : " , TextColor = Color.Black, FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform(12, 14, 26), }, emotionTextLabel } }; feelingFeedbackStack.GestureRecognizers.Add(emotionTextTap); eventFeedbackStack = new StackLayout { IsVisible = false, //BackgroundColor = Color.Red, Orientation = StackOrientation.Horizontal, Spacing = 0, Padding = new Thickness (App.screenWidth * .10, 0, 10, 0), Children = { new Label { Text = "Event : " , TextColor = Color.Black, FontFamily = Constants.HELVERTICA_NEUE_LT_STD, FontSize = Device.OnPlatform(12, 14, 26), }, eventTextLabel } }; eventFeedbackStack.GestureRecognizers.Add(eventTextTap); // add this to a customLayout n a stack with bg transparent. topLabelsContainer = new CustomLayout { WidthRequest = screenWidth, }; topLabelBg = new StackLayout { WidthRequest = screenWidth, BackgroundColor = Color.Gray, Opacity = .2 }; topBgandCloseBtn = new StackLayout { //BackgroundColor = Color.Yellow, // for testing only Orientation = StackOrientation.Vertical, Spacing = 0, Children = {topLabelBg} }; topCloseBtn = new Image { Source = "downarrow.png", IsVisible = false, HeightRequest = 25, WidthRequest = 35, HorizontalOptions = LayoutOptions.End }; topBgandCloseBtn.Children.Add (topCloseBtn); TapGestureRecognizer topCloseBtnTapRecognizer = new TapGestureRecognizer(); topCloseBtnTapRecognizer.Tapped += (s, e) => { AnimateToplabels(0); }; topCloseBtn.GestureRecognizers.Add (topCloseBtnTapRecognizer); feedbackLabelStack = new StackLayout { Orientation = StackOrientation.Vertical, //BackgroundColor = Constants.PAGE_BG_COLOR_LIGHT_GRAY, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Spacing = 2, WidthRequest = App.screenWidth, Children = {sliderFeedbackStack, feelingFeedbackStack, eventFeedbackStack} }; topLabelsContainer.AddChildToLayout (topBgandCloseBtn, 0, 0); topLabelsContainer.AddChildToLayout (feedbackLabelStack, 0, 0); //masterLayout.AddChildToLayout(feedbackLabelStack, 0, Device.OnPlatform(16, 18, 10)); masterLayout.AddChildToLayout(topLabelsContainer, 0, Device.OnPlatform(16, 18, 10)); masterLayout.AddChildToLayout(howYouAreFeeling, 16, Device.OnPlatform(33, 33, 30)); masterLayout.AddChildToLayout(howYouAreFeeling2, 29, Device.OnPlatform(38, 38, 27)); masterLayout.AddChildToLayout(slider, 5, 43); masterLayout.AddChildToLayout(emotionalPickerButton, 5, Device.OnPlatform(50, 57, 47)); masterLayout.AddChildToLayout(about, 0, Device.OnPlatform(62, 66, 59)); masterLayout.AddChildToLayout(eventPickerButton, 5, Device.OnPlatform(70, 73, 67)); //SetFeedBackLablText(); Content = masterLayout; }
public async void GetstopGetsture(bool pressed) { if (popupSlider != null ) { sliderValue = popupSlider.CurrentValue; slider.Value = sliderValue; slider.CurrentValue = sliderValue; if (sliderValue != 0) { popupSlider = null; RemoveSliderPopup(); } } else { sliderValue = slider.CurrentValue; } switch (sliderValue) { case 2: sliderValueImage.Source = "Sliderfeedback2.png"; break; case 1: sliderValueImage.Source = "Sliderfeedback1.png"; break; case -1: sliderValueImage.Source = "SliderfeedbackMinues1.png"; break; case -2: sliderValueImage.Source = "SliderfeedbackMinues2.png"; break; case 0: sliderValueImage.Source = "Sliderfeedback0.png"; break; default: break; }; sliderFeedbackStack.IsVisible = true; sliderFeedbackStack.HeightRequest = 0; if (sliderValue == 0) { progressBar.ShowToast ("slider is in neutral"); } else if (!emotionsDisplaying && sliderValue != 0) { AnimateToplabels(1); await Task.Delay(100); OnEmotionalPickerButtonClicked(emotionalPickerButton, EventArgs.Empty); } }
private void RemoveSliderPopup() { try { if (popupSlider!= null) { sliderValue = popupSlider.CurrentValue; popupSlider = null; } View sliderContainer = masterLayout.Children.FirstOrDefault(pick => pick.ClassId == "sliderBg"); if (sliderContainer != null) { masterLayout.Children.Remove(sliderContainer); sliderContainer = null; GC.Collect(); } } catch (Exception) { } }