Hello,
i've a little problem. I built a XamDataGrid with a XamDataPresenter. (example at the end of this post)
My first problem: I created about 10 different FieldLayouts. In my dataGrid I want to show only one GridHeader at the Top of the DataGrid. I tried to do much with the LabelLocation and Headerplacement in the FieldlayoutSettings and the Settings Of each FieldLayout seperately, but either there's shown no Header or a seperete Header on top of a group of records which have the same FieldLayout. (like here: http://forums.infragistics.com/forums/p/43282/300445.aspx#300445)
I only got:
Record1: FieldLayout1Record2: FieldLayout1Header from FieldLayout2Record3: FieldLayout2Record4: FieldLayout2Record5: FieldLayout1Record6: FieldLayout1Header from FieldLayout2Record7: FieldLayout2 Record8: FieldLayout2
but i want it to look like this:
Header from FieldLayout2Record1: FieldLayout1 Record2: FieldLayout1 Record3: FieldLayout2 Record4: FieldLayout2 Record5: FieldLayout1 Record6: FieldLayout1 Record7: FieldLayout2 Record8: FieldLayout2
Or better would be a Header from a FieldLayout which isn't used at any row in the grid.
I also tried to do something with UnboundFields, which are inserted above the Header Row like in an example called "XDG_Complex_Spreadheader" i also got it from this forum but can't find the post anymore. But i didn't get it to look like a standard-looking header.
---------
Another Qestion: I have often very similar Fields in every FieldLayout. For example this Field:
<igDP:Field Name="Bez" Width="125"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field>
It's the same in every Layout. Can i simplify this in any way in xaml. Or should i use the code-behind-way to create the Field Layouts?
Thank you very much for every help i get! If you need more infos, no problem, tell me.
Jochen
Here's some example code: (I shortened it a bit) ;)
<igDP:XamDataPresenter Margin="0" Name="spd" CellContainerGenerationMode="PreLoad"> <!-- VIEW --> <igDP:XamDataPresenter.View> <igDP:GridView> <igDP:GridView.ViewSettings> <igDP:GridViewSettings UseNestedPanels="True" Orientation="Vertical" /> </igDP:GridView.ViewSettings> </igDP:GridView> </igDP:XamDataPresenter.View> <!-- RESOURCES --> <igDP:XamDataPresenter.Resources> <Style x:Key="RoundingStyle" TargetType="{x:Type igEditors:XamNumericEditor}"> <Setter Property="Mask" Value="n.nnn"/> </Style> <Style x:Key="CheckStyle" TargetType="{x:Type igEditors:XamCheckEditor}"> <EventSetter Event="ValueChanged" Handler="cValueChanged"/> </Style> <igEditors:ComboBoxItemsProvider x:Key="TabAlignItemsProvider" /> <Style x:Key="TabAlignFieldStyle" TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabAlignItemsProvider}" /> </Style> <igEditors:ComboBoxItemsProvider x:Key="TabGeItemsProvider" /> <Style x:Key="TabGeFieldStyle" TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabGeItemsProvider}" /> </Style>
<igEditors:ComboBoxItemsProvider x:Key="EinhLenItemsProvider" /> <Style x:Key="EinhLenFieldStyle" TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource EinhLenItemsProvider}" /> </Style> </igDP:XamDataPresenter.Resources> <!-- FIELDLAYOUT SETTINGS --> <igDP:XamDataPresenter.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" AllowFieldMoving="No" LabelLocation="Hidden" SelectionTypeCell="Single" SelectionTypeField="None" SelectionTypeRecord="Single"/> <!--AutoArrangeCells="Never"--> </igDP:XamDataPresenter.FieldLayoutSettings> <!-- FIELD SETTINGS --> <igDP:XamDataPresenter.FieldSettings> <igDP:FieldSettings AllowResize="False" /> </igDP:XamDataPresenter.FieldSettings> <!-- FIELD LAYOUTS --> <igDP:XamDataPresenter.FieldLayouts> <igDP:FieldLayout Key="LayoutGebEl"> <igDP:FieldLayout.Fields> <igDP:Field Name="Bez" Width="125"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Cap" Width="95" /> <igDP:Field Name="Rank" Width="30" /> <igDP:Field Name="Einh" Width="120"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabGeItemsProvider}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="TabW" Width="30" /> <igDP:Field Name="TabT" Width="100"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabAlignItemsProvider}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Z" Width="Auto" Row="1" Column="6"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource CheckStyle}" /> </igDP:Field.Settings> </igDP:Field> <!--<igDP:UnboundField Name="HeaderLabel" Label="HeaderLabel" Row="0" Column="2"> <igDP:UnboundField.Settings> <igDP:FieldSettings CellValuePresenterStyle="{StaticResource NoDataCellValuePresenter}" LabelPresenterStyle="{StaticResource LabelHeaderLabelPresenter}"/> </igDP:UnboundField.Settings> </igDP:UnboundField>--> </igDP:FieldLayout.Fields> </igDP:FieldLayout> <igDP:FieldLayout Key="LayoutGroupable"> <igDP:FieldLayout.Fields> <igDP:Field Name="Bez" Width="125"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Cap" Width="95" /> <igDP:Field Name="Rank" Width="30" /> <igDP:Field Name="Rundung" Width="120"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="TabW" Width="30" /> <igDP:Field Name="TabT" Width="100"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabAlignItemsProvider}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Z" Width="Auto"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource CheckStyle}" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="G" Width="Auto" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> <igDP:FieldLayout Key="LayoutDimLength"> <igDP:FieldLayout.Fields> <igDP:Field Name="Bez" Width="125"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Cap" Width="95" /> <igDP:Field Name="Rank" Width="30" /> <igDP:Field Name="Rundung" Width="55"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource RoundingStyle}" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Einh" Width="65"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource EinhLenItemsProvider}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="TabW" Width="30" /> <igDP:Field Name="TabT" Width="100"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabAlignItemsProvider}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Z" Width="Auto"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource CheckStyle}" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="G" Width="Auto" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> <igDP:FieldLayout Key="LayoutElse"> <igDP:FieldLayout.Fields> <igDP:Field Name="Bez" Width="125"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Cap" Width="95" /> <igDP:Field Name="Rank" Width="30" /> <igDP:Field Name="Rundung" Width="120"> <igDP:Field.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="TabW" Width="30" /> <igDP:Field Name="TabT" Width="100"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource TabAlignItemsProvider}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> <igDP:Field Name="Z" Width="Auto"> <igDP:Field.Settings> <igDP:FieldSettings EditorStyle="{StaticResource CheckStyle}" /> </igDP:Field.Settings> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataPresenter.FieldLayouts>
Here's a little example.
All lacks of clarity are written as comment in the code behind file.
I hope this helps.
Kind regards,
Hello Jochen,
I have been looking into your sample and I modified it so now it works as you want. Basically I created a Master FieldLayout witch is applied only to the first Record and I set the LabelLocaltion Property of all other FieldLayouts to Hidden. Also to prevent the XamDataGrid from sorting when you click the Header I set the FieldSettings’s LabelClickAction to Nothing. Please let me know if this helps you or you need further clarifications on this matter.
Looking forward for your reply.