protected override void OnDetachingFrom(SampleView bindable) { optionsList.SelectedIndexChanged -= OnFilterOptionsChanged; columnsList.SelectedIndexChanged -= OnColumnsSelectionChanged; filterText.TextChanged -= OnFilterTextChanged; dataGrid = null; optionsList = null; columnsList = null; filterText = null; base.OnDetachingFrom(bindable); }
/// <summary> /// You can override this method while View was detached from window /// </summary> /// <param name="bindAble">SampleView type of bindAble parameter</param> protected override void OnDetachingFrom(SampleView bindAble) { this.optionsList.SelectedIndexChanged -= this.OnFilterOptionsChanged; this.columnsList.SelectedIndexChanged -= this.OnColumnsSelectionChanged; this.filterText.TextChanged -= this.OnFilterTextChanged; this.dataGrid = null; this.optionsList = null; this.columnsList = null; this.filterText = null; base.OnDetachingFrom(bindAble); }
protected override void OnAttachedTo(SampleView bindable) { viewModel = new FilteringViewModel(); dataGrid = bindable.FindByName <Syncfusion.SfDataGrid.XForms.SfDataGrid>("dataGrid"); bindable.BindingContext = viewModel; optionsList = bindable.FindByName <PickerExt>("OptionsList"); columnsList = bindable.FindByName <PickerExt>("ColumnsList"); filterText = bindable.FindByName <SearchBarExt>("filterText"); optionsList.Items.Add("Equals"); optionsList.Items.Add("NotEquals"); optionsList.Items.Add("Contains"); columnsList.Items.Add("All Columns"); columnsList.Items.Add("CustomerID"); columnsList.Items.Add("BookID"); columnsList.Items.Add("FirstName"); columnsList.Items.Add("LastName"); columnsList.Items.Add("BookName"); columnsList.SelectedIndex = 0; viewModel.filtertextchanged = OnFilterChanged; filterText.TextChanged += OnFilterTextChanged; columnsList.SelectedIndexChanged += OnColumnsSelectionChanged; optionsList.SelectedIndexChanged += OnFilterOptionsChanged; base.OnAttachedTo(bindable); }