Currently i have a grid with a combobox in. The combobox works fine. i can change a record and write it back to the table.
The 2 problems are the textblock when not editing shows the Value not the Display. I can't figure out how to change this.
Also the dropdown records of the combobox show the class MYNAMESPACE.tblEquipmentType rather than the values.
The text of the combobox displays fine also. I've spent days going round in circles looking through the examples trying to do this.
Here is selections of my XAML and code behind.
private IEnumerable<tblEquipmentType> etQuery = null;
public IEnumerable<tblEquipmentType> qEquipmentType
{
get
{
if (etQuery == null)
{
etQuery = from e in db.tblEquipmentTypes
select e;
}
return etQuery.ToList();
}
}
*************************** XAML **************************
<DataTemplate x:Key="typeCellDataTemplate">
<TextBlock Text="{Binding}"
MinHeight="22"
TextTrimming="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentColumn.TextTrimming}"
TextWrapping="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:Cell}}, Path=ParentColumn.TextWrapping}"/>
</DataTemplate>
<xcdg:CellEditor x:Key="typeEditor">
<xcdg:CellEditor.EditTemplate>
<DataTemplate>
<ComboBox BorderThickness="0"
Background="Transparent"
Foreground="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(TextElement.Foreground)}"
VerticalContentAlignment="Top"
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}},Path=qEquipmentType}"
DisplayMemberPath="eqType"
SelectedValue="{xcdg:CellEditorBinding}"
SelectedValuePath="eqTypeID"
>
<ComboBox.Resources>
<Style TargetType="Popup">
<Setter Property="TextElement.Foreground"
Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
</Style>
</ComboBox.Resources>
</ComboBox>
</DataTemplate>
</xcdg:CellEditor.EditTemplate>
</xcdg:CellEditor>
******************** GRID *******************
<xcdg:DataGridControl Name="dataGridControl1" ItemsSource="{Binding Source={StaticResource cvsEquipment}}" AutoCreateColumns="True" CellEditorDisplayConditions="MouseOverRow" Margin="0,0,0,41.441">
<xcdg:DataGridControl.Resources>
<Style x:Key="{x:Type xcdg:ScrollTip}" TargetType="xcdg:ScrollTip">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</xcdg:DataGridControl.Resources>
<xcdg:DataGridControl.View>
...
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="eqID"
Title="eqID"
Width="125"
Visible="False" IsMainColumn="True" />
<xcdg:Column FieldName="eqTypeID"
Title="Type"
Width="125"
CellContentTemplate="{StaticResource typeCellDataTemplate}"
CellEditor="{StaticResource typeEditor}"
Visible="True" />
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>