I think you need to add PropertyChangedCallback to your ItemTypeIdCodeProperty dependency property. In this callback you are to call GetDropDownValues().
Up vote 1 down vote favorite share g+ share fb share tw.
Here is my code: XAML: Code-Behind: using System. Windows; using System. ComponentModel; namespace TestDepenProp { public partial class Window1 : Window, INotifyPropertyChanged { #region ViewModelProperty: ItemTypeIdCode private string _itemTypeIdCode; public string ItemTypeIdCode { get { return _itemTypeIdCode; } set { _itemTypeIdCode = value; OnPropertyChanged("ItemTypeIdCode"); } } #endregion public Window1() { InitializeComponent(); DataContext = this; ItemTypeIdCode = "addresses"; } #region INotifiedProperty Block public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler!
= null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } } DropDown. Xaml: DropDown.xaml. Cs: using System.
Windows; using System.Windows. Controls; using System. ComponentModel; using System.Collections.
ObjectModel; using System.Collections. Generic; namespace TestDepenProp. Controls { public partial class DropDown : UserControl, INotifyPropertyChanged { public static readonly DependencyProperty ItemTypeIdCodeProperty = DependencyProperty.
Register("ItemTypeIdCode", typeof(string), typeof(DropDown)); public string ItemTypeIdCode { get { return (string)GetValue(ItemTypeIdCodeProperty); } set { SetValue(ItemTypeIdCodeProperty, value); } } #region ViewModelProperty: DropDownValues private ObservableCollection> _dropDownValues = new ObservableCollection>(); public ObservableCollection> DropDownValues { get { return _dropDownValues; } set { _dropDownValues = value; OnPropertyChanged("DropDownValues"); } } #endregion #region ViewModelProperty: SelectedValue private string _selectedValue; public string SelectedValue { get { return _selectedValue; } set { _selectedValue = value; OnPropertyChanged("SelectedValue"); } } #endregion public DropDown() { InitializeComponent(); DataContext = this; Loaded += new RoutedEventHandler(DropDown_Loaded); } void DropDown_Loaded(object sender, RoutedEventArgs e) { GetDropDownValues(); } void GetDropDownValues() { switch (ItemTypeIdCode) { case "addresses": DropDownValues. Add(new KeyValuePair("111", "762 Main St.")); DropDownValues. Add(new KeyValuePair("222", "7384 First Ave.
")); DropDownValues. Add(new KeyValuePair("333", "8728 Second St.")); break; case "customers": DropDownValues. Add(new KeyValuePair("672", "Jim Smith")); DropDownValues.
Add(new KeyValuePair("281", "James Anders")); DropDownValues. Add(new KeyValuePair("321", "Angie Wonderson")); DropDownValues. Add(new KeyValuePair("221", "Hal Cloud")); DropDownValues.
Add(new KeyValuePair("123", "Hugh Brandley")); break; default: break; } } #region INotifiedProperty Block public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler! = null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } } c# wpf data-binding xaml dependency-properties link|improve this question asked Nov 27 '09 at 11:29Edward Tanguay21.9k42228507 80% accept rate.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.