Hello Alex,
Thanks For reply.
Sorry I didn’t get your point as I am binding ComboBox with a ObservableCollection.
I tell you in detail.................................
I am using a xamDatagrid and that grid is having one of the Cell as a xamComboEditor which is bound to DataContext.JobFunctionList.
JobFunctionList is coming from lookup Values which is combionation of two fields
1. RefGeneralValueId
2. RefGeneralValueDescLong
So ValuePath="RefGeneralValueId" and DisplayMemberPath="RefGeneralValueDescLong"
1. I have bound “Value” to PersonFunctionId(one of the field from another table). This may be one of the Id in RefGeneralValueId. As I want to show “RefGeneralValueDescLong” with respect to the PersonFunctionId at editing time so I have bound “Value” to PersonFunctionId.
Code for Datagrid :
<GroupBox Header="Job Function" Grid.Row="8" Grid.ColumnSpan="5" Margin="10">
<Controls1:LipperGrid Theme="Office2k7Silver" x:Name="grdContactAssociation" ScrollViewer.VerticalScrollBarVisibility="Auto" DataSource="{Binding ContactJobFunctionList}" ContextMenu="{StaticResource ContactAssociationMenu}" MinHeight="100" Margin="5" SelectedItemsChanged="grdContactAssociation_SelectedItemsChanged">
<DataPresenter:LipperGrid.FieldLayoutSettings>
<DataPresenter:FieldLayoutSettings AutoGenerateFields="False" />
</DataPresenter:XamDataGrid.FieldLayoutSettings>
<DataPresenter:XamDataGrid.FieldSettings>
<DataPresenter:FieldSettings LabelClickAction="Nothing" ></DataPresenter:FieldSettings>
</DataPresenter:XamDataGrid.FieldSettings>
<DataPresenter:XamDataGrid.FieldLayouts>
<DataPresenter:FieldLayout>
<DataPresenter:FieldLayout.Fields>
<DataPresenter:Field Name="PersonFunctionId" Label="Select Job Function" >
<DataPresenter:Field.Settings>
<DataPresenter:FieldSettings AllowEdit="True" AllowGroupBy="True" CellWidth="150" CellValuePresenterStyle="{StaticResource ComboJobFunction}"/>
</DataPresenter:Field.Settings>
</DataPresenter:Field>
<DataPresenter:Field Name="IsMain" Label="Primary Job Function" >
<DataPresenter:FieldSettings AllowEdit="False" AllowGroupBy="True" CellWidth="150" CellValuePresenterStyle="{StaticResource CheckBoxPrimaryJobFunction}"/>
</DataPresenter:FieldLayout.Fields>
</DataPresenter:FieldLayout>
</DataPresenter:XamDataGrid.FieldLayouts>
</DataPresenter:XamDataGrid>
</GroupBox>
2. I tried using DataTrigger like this
<Style x:Key="ComboJobFunction" TargetType="{x:Type DataPresenter:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataPresenter:CellValuePresenter}" >
<igEditors:XamComboEditor Margin="0" x:Name="cboJobFunction" Value="{Binding Path=DataItem.PersonFunctionId}"
ValuePath="RefGeneralValueId" DisplayMemberPath="RefGeneralValueDescLong"
ItemsSource="{Binding Path=DataContext.JobFunctionList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
SelectedItemChanged="cboJobFunction_SelectedItemChanged" >
</igEditors:XamComboEditor >
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=ComboBoxDataItem, RelativeSource={RelativeSource Self}, Value="-1" >
<Setter Property="Background" Value="Red"></Setter>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Might be I am missing something Please help me.
Hello,
You can create a style for the ComboBoxDataItem and bind to its value property with a DataTrigger and set the FontSize,FontWeight or Margin to indent.
Hope this helps.
Is there any way to indent XamComboEditor I am facing the problem?
Please help me. If you didn't get the question i will descibe it again.
thanks in advance.