private void DiscardButton_Click(object sender, RoutedEventArgs e) { BrandComboBox.GetBindingExpression(Selector.SelectedItemProperty)?.UpdateTarget(); ModelTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); Property1ComboBox.GetBindingExpression(Selector.SelectedItemProperty)?.UpdateTarget(); Property2ComboBox.GetBindingExpression(Selector.SelectedItemProperty)?.UpdateTarget(); PriceTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); StockTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); UpdatePropertyComboBoxProperties(); }
private void RefreshComboBoxItemsSources() { Property1Label?.GetBindingExpression(ContentProperty)?.UpdateTarget(); Property2Label?.GetBindingExpression(ContentProperty)?.UpdateTarget(); BrandComboBox?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); Property1ComboBox?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); Property2ComboBox?.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); UpdateControlVisibility(); }
private void UpdatePropertyComboBoxProperties() { var battery = InventoryDataGrid.SelectedItem as Battery; Property1ComboBox.IsEditable = (battery != null); Property2ComboBox.IsEditable = (battery != null); if (battery == null) { return; } _batteryCapacitySource = new[] { battery.Capacity }; _batteryVoltageSource = new[] { battery.Voltage }; Property1ComboBox.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); Property2ComboBox.GetBindingExpression(ItemsControl.ItemsSourceProperty)?.UpdateTarget(); Property1ComboBox.GetBindingExpression(Selector.SelectedItemProperty)?.UpdateTarget(); Property2ComboBox.GetBindingExpression(Selector.SelectedItemProperty)?.UpdateTarget(); }