Click here to Skip to main content
15,881,173 members

Comments by joey sison (Top 1 by date)

joey sison 6-Mar-23 17:16pm View    
Hello the one showing the error is Combobox2
combobox1 Province XAML -
<combobox materialdesign:hintassist.hint="Province" style="{StaticResource MaterialDesignFloatingHintComboBox}" width="130" itemssource="{Binding ProvinceList}" displaymemberpath="PROVINCENAME" selectedvaluepath="PROVINCEID" selectedvalue="{Binding ProvinceParam, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

Combobox2 Municipality XAML
<combobox margin="5 0 0 0" materialdesign:hintassist.hint="Municipal" style="{StaticResource MaterialDesignFloatingHintComboBox}" width="130" itemssource="{Binding MunicipalList}" displaymemberpath="MUNICIPALNAME" selectedvaluepath="MUNICIPALID" selectedvalue="{Binding MunicipalParam, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">


Combobox1 Coding
int _ProvinceParam = -1;
public int ProvinceParam
{
get { return _ProvinceParam; }
set
{
_ProvinceParam = value;
NotifyOfPropertyChange(() => ProvinceParam);
if (_ProvinceParam > -1)
{

_MunicipalList = new BindableCollection<municipalitymodel>(_dbConnection.GetMunicipalList(" where PROVINCEID ='" + _ProvinceParam + "' Order by MUNICIPALNAME"));
NotifyOfPropertyChange(() => MunicipalList);

}

}
}

The idea is that whatever is selected in the combobox1-Province filters the selection in the Combobox2-municipality. i tried removing the TargetNullValue but still the error shows in combobox2-Municipality.