/// <summary> /// Dispose of unmanaged resources. /// </summary> public void Dispose() { this.listBinding = null; this.observableCollectionBinding = null; this.dynamicObjectsBinding = null; this.Resources.Clear(); this.dataBindingComboBox.SelectionChanged -= OnSelectionChanged; if (dataBindArea.Content is ListBinding) { (dataBindArea.Content as ListBinding).Dispose(); ((dataBindArea.Content as ListBinding).Content as Grid).Children.Clear(); } else if (dataBindArea.Content is ObservableCollectionBinding) { (dataBindArea.Content as ObservableCollectionBinding).Dispose(); ((dataBindArea.Content as ObservableCollectionBinding).Content as Grid).Children.Clear(); } else { (dataBindArea.Content as DynamicObjectsBinding).Dispose(); ((dataBindArea.Content as DynamicObjectsBinding).Content as Grid).Children.Clear(); } dataBindArea = null; if (this.dataBindingComboBox != null) { this.dataBindingComboBox = null; } }
public DataBinding() { this.InitializeComponent(); listBinding = new ListBinding(); observableCollectionBinding = new ObservableCollectionBinding(); this.DataContext = new DataBoundViewModel(); this.comboBinding.SelectionChanged += OnSelectionChanged; }
public DataBinding() { this.InitializeComponent(); listBinding = dataBindArea.Content as ListBinding; observableCollectionBinding = new ObservableCollectionBinding(); dynamicObjectsBinding = new DynamicObjectsBinding(); this.DataContext = new DataBindingViewModel(); this.dataBindingComboBox.SelectionChanged += OnSelectionChanged; }
/// <summary> /// Dispose of unmanaged resources. /// </summary> public sealed override void Dispose() { this.listBinding.Dispose(); this.observableCollectionBinding.Dispose(); this.listBinding = null; this.observableCollectionBinding = null; this.Resources.Clear(); this.comboBinding.SelectionChanged -= OnSelectionChanged; if (dataBindArea.Content is ListBinding) { (dataBindArea.Content as ListBinding).Dispose(); ((dataBindArea.Content as ListBinding).Content as Grid).Children.Clear(); } else { (dataBindArea.Content as ObservableCollectionBinding).Dispose(); ((dataBindArea.Content as ObservableCollectionBinding).Content as Grid).Children.Clear(); } dataBindArea = null; base.Dispose(); }