javad_r_85
پنج شنبه 12 اردیبهشت 1392, 09:35 صبح
سلام
دو تا کمبو باکس دارم که یکی گروه و دیگری زیر گروه می باشد و با تغییر اولی مقادیر موجود در کمبو باکس دومی نیز باید تغییر نماید . زمان لود اولیه نرم افزار در کمبو باکس دومی زیر مجموعه ها به خوبی نمایش داده می شود اما زمانی که کمبو باکس اولی را تغییر می دم دومی هیچ تغییری نمی کند.
دوستان لطفا کمک کنید.
<ComboBox Canvas.Left="82" Canvas.Top="18" Height="23"
Name="cmbCat" Width="120"
ItemsSource="{Binding Path= Categores }"
DisplayMemberPath="CategoryName"
SelectedValuePath="CategoryID_FK"
SelectedItem="{Binding SelectedCategory}"
SelectedIndex="0" />
<ComboBox Canvas.Left="251" Canvas.Top="21" Height="23" Name="cmbGroup" Width="120"
ItemsSource="{Binding Groups, Mode=OneWay}"
DisplayMemberPath="GroupName"
SelectedValuePath="GroupID_FK"
SelectedIndex="0"
/>
public ObservableCollection<Models.Categores> Categores { get; set; }
public ObservableCollection<Models.Groups> Groups { get; set; }
Models.Categores selectedCategory;
public Models.Categores SelectedCategory
{
get { return this.selectedCategory; }
set
{
this.selectedCategory = value;
if(this.Groups.Count > 0)
this.Groups.Clear();
if (value != null)
{
Groups = new ObservableCollection<Models.Groups>(Models.Groups.GetGroups(value.CategoryID_FK));
}
this.NotifyPropertyChanged("SelectedCategory");
this.NotifyPropertyChanged("SelectedCategroryID");
//this.NotifyPropertyChanged("AllowShippingCarrierSelection");
}
}
public MainViewModel()
{
Groups = new ObservableCollection<Models.Groups>();
GetCustomerCollection();
}
private void GetCustomerCollection()
{
Categores = new ObservableCollection<Models.Categores>(Models.Categores.GetCategores());
}
دو تا کمبو باکس دارم که یکی گروه و دیگری زیر گروه می باشد و با تغییر اولی مقادیر موجود در کمبو باکس دومی نیز باید تغییر نماید . زمان لود اولیه نرم افزار در کمبو باکس دومی زیر مجموعه ها به خوبی نمایش داده می شود اما زمانی که کمبو باکس اولی را تغییر می دم دومی هیچ تغییری نمی کند.
دوستان لطفا کمک کنید.
<ComboBox Canvas.Left="82" Canvas.Top="18" Height="23"
Name="cmbCat" Width="120"
ItemsSource="{Binding Path= Categores }"
DisplayMemberPath="CategoryName"
SelectedValuePath="CategoryID_FK"
SelectedItem="{Binding SelectedCategory}"
SelectedIndex="0" />
<ComboBox Canvas.Left="251" Canvas.Top="21" Height="23" Name="cmbGroup" Width="120"
ItemsSource="{Binding Groups, Mode=OneWay}"
DisplayMemberPath="GroupName"
SelectedValuePath="GroupID_FK"
SelectedIndex="0"
/>
public ObservableCollection<Models.Categores> Categores { get; set; }
public ObservableCollection<Models.Groups> Groups { get; set; }
Models.Categores selectedCategory;
public Models.Categores SelectedCategory
{
get { return this.selectedCategory; }
set
{
this.selectedCategory = value;
if(this.Groups.Count > 0)
this.Groups.Clear();
if (value != null)
{
Groups = new ObservableCollection<Models.Groups>(Models.Groups.GetGroups(value.CategoryID_FK));
}
this.NotifyPropertyChanged("SelectedCategory");
this.NotifyPropertyChanged("SelectedCategroryID");
//this.NotifyPropertyChanged("AllowShippingCarrierSelection");
}
}
public MainViewModel()
{
Groups = new ObservableCollection<Models.Groups>();
GetCustomerCollection();
}
private void GetCustomerCollection()
{
Categores = new ObservableCollection<Models.Categores>(Models.Categores.GetCategores());
}