Hi,
I am dynamically filling a RadComboBox based on input from the keyboard. My XAML looks like this:
My IdentifierNameType class looks like this:
Everything looks good except for when I actually select an item from the dropdown. It looks like my bindings are wrong. How do I set it to where the IdentifierNameType.Name is bound correctly? What I am seeing in the text portion of the RadComboBox is the class name.
Thanks,
Darren
I am dynamically filling a RadComboBox based on input from the keyboard. My XAML looks like this:
<telerikInput:RadComboBox x:Name="MedName" GotFocus="MedName_GotFocus" SelectionChanged="MedName_SelectionChanged" ItemsSource="{Binding IdentifierNameType}" Text="{Binding Name, Mode=TwoWay}" Grid.Row="1" Grid.Column="1" IsTextSearchEnabled="False" IsEditable="True" Height="20" Width="200" HorizontalAlignment="Left"> |
<telerikInput:RadComboBox.ItemTemplate> |
<DataTemplate> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="{Binding Name}" /> |
</StackPanel> |
</DataTemplate> |
</telerikInput:RadComboBox.ItemTemplate> |
</telerikInput:RadComboBox> |
My IdentifierNameType class looks like this:
public class IdentifierNameType |
{ |
private int identifier = 0; |
private string name = ""; |
public IdentifierNameType() { } |
public IdentifierNameType(int identifier, string name) |
{ |
this.identifier = identifier; |
this.name = name; |
} |
[DataMember(Name = "Identifier")] |
public int Identifier |
{ |
get |
{ |
return this.identifier; |
} |
set |
{ |
this.identifier = value; |
} |
} |
[DataMember(Name = "Name")] |
public string Name |
{ |
get |
{ |
return this.name; |
} |
set |
{ |
this.name = value; |
} |
} |
} |
Everything looks good except for when I actually select an item from the dropdown. It looks like my bindings are wrong. How do I set it to where the IdentifierNameType.Name is bound correctly? What I am seeing in the text portion of the RadComboBox is the class name.
Thanks,
Darren