Why i cant set selecteditem property programatically?
Im calling it from another XAML Window, that hace certaing controls , one of them is a ComboBox i was trying this :
string tm = (from ea in db.EXAMENXATENCIONs where ea.codigo == Convert.ToInt32(numeroinforme) select ea.turnomedico).FirstOrDefault(); demo.cboTurnoMed.SelectedItem = tm; demo.cboTurnoMed.Text = tm;
C# 3.5
Thanks!
Is the item you’re trying to set as selected well in the
ComboBoxdata source?The
SelectedItemproperty looks for the value you provide in data source and then select it if found.