Hi, I've a list of items bound to a RadCombo with IsEditable set to true. Two items of that list had the same name (DisplayMemberPath). When the second (in this case last) item is selected in Combobox, the first one becames the selected item. The real problem is much more complex than this example but the unexpected behaviour is the one that is reported in this post.public
class
Person
{
public
string
Name {
get
;
set
; }
}
public
partial
class
MainPage : UserControl, INotifyPropertyChanged
{
public
List<Person> Crowd {
get
;
set
;}
private
Person _SelectedPerson;
public
Person SelectedPerson
{
get
{
return
_SelectedPerson; }
set
{
_SelectedPerson = value;
NotifyOfPropertyChange(
"SelectedPerson"
);
}
}
public
MainPage()
{
InitializeComponent();
Crowd =
new
List<Person>();
Crowd.Add(
new
Person { Name =
"Sam"
});
Crowd.Add(
new
Person { Name =
"Mary"
});
Crowd.Add(
new
Person { Name =
"Wendy"
});
Crowd.Add(
new
Person { Name =
"Steven"
});
Crowd.Add(
new
Person { Name =
"Sam"
});
this
.DataContext =
this
;
SelectedPerson = Crowd[0];
}
public
event
PropertyChangedEventHandler PropertyChanged;
public
void
NotifyOfPropertyChange(
string
propname)
{
if
(PropertyChanged !=
null
)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(propname));
}
}
}
Can you help me on that ? Thanks.<
UserControl
x:Class
=
"RadComboBoxTest.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
ListBox
ItemsSource
=
"{Binding Crowd}"
SelectedItem
=
"{Binding SelectedPerson, Mode=TwoWay}"
Width
=
"200"
>
<
ListBox.ItemTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
DataTemplate
>
</
ListBox.ItemTemplate
>
</
ListBox
>
<
telerik:RadComboBox
SelectedItem
=
"{Binding Path=SelectedPerson, Mode=TwoWay}"
ItemsSource
=
"{Binding Path=Crowd}"
DisplayMemberPath
=
"Name"
IsEditable
=
"True"
Width
=
"200"
/>
</
StackPanel
>
</
Grid
>
</
UserControl
>