I use the following XAML to display a XamComboEditor-field in my XamDataGrid
<igDP:Field Name="NoteType" Label="Type" Width="70">
<igDP:Field.Settings>
<igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}">
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="ItemsSource" Value="{Binding NoteTypes}" />
<Setter Property="DisplayMemberPath" Value="Name" />
</Style>
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
Name="NoteType" refers to the key in the table/collection that contains the name that should be displayed
The column is displayed in the DataGrid, but the Name of the NoteType isn't displayd, only the key.
Am I missing something here?
HI,
I am attaching a sample application that embeds a XamComboEdtior into the XamDataGrid.
Sincerely, Matt Developer Support Engineer
I am just following upu on this forum post.
Please let me know if you need further assistance regarding this issue.
Sincerely,Matt Developer Support Engineer
Doesn't work!
I use a MVVM-pattern in my application
<Setter Property="ItemsSource" Value="{Binding DataContext.NoteTypes}" />
<Setter Property="ValuePath" Value="NoteTypeId"/>
Following classes are VERY simplified. In my solution they are actually LINQ to SQL classes
class Note
{
public string Text { get; set; }
public int NoteType { get; set; }
}
class NoteType
public string Name { get; set; }
Name="NoteType" refers to the field in the Note-object with the id (NoteTypeId) of the NoteType-object.
The field/combobox just displays the NoteTypeId.
Shouldn't I be binding using SelectedItem or something?
Are you saying that the ComboBox has no dropdown data? Is it an empty dropdown?
If that is the case, it could be your ItemSource Bindng. In my sample I am binding.to a static resource.
Are you getting any bindng errors in the output window when you debug?
Sincerely,
MattDeveloper Support Engineer
Thank you so much this is where I was looking behind.
Grts Johan
Hello Matt
I haven't really had the time to look into this issue again...
I think, I might try experimenting with the standard WPF-DataGrid again, to get the desired functionality with SelectedItem-binding.
Thanks for the help!
I am just following up on this forum post.
Matt Developer Support Engineer
HI Christian,
As for binding using the XamComboSelectedItem, you probably could, you would need a converter.
But using the ValuePath propety is much easier and more efficient.
Nope. The binding doesn't work in my case...