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>
I tried this but the result is not what i want.
Here's an example if i set the LabelLocation to "Default" in first Fieldlayout (the first in the xaml Code) and all other to "Hidden".It's the second Field which is assigned to an item/record. And this Record occures only once in the whole Datagrid. That's why only one Header occurs.
If i set the LabelLocation of the first FieldLayout, which is assigned to an item, to "Default" and all others to "Hidden" then this happens:
Everytime this FieldLayout is used in a bunch of records then this bunch gets a header.
Another problem is that i cannot say for sure, which FieldLayout will be the first in the DataGrid, because i'm starting this grid with different settings in various situations.
I hope you can help me :)
Hello Jochen,
I have been looking into your post and I suggest you handle the XamDataGrid’s AssignFieldLayoutToItem event and use the following code in there:
In order to set the LabelLocation to Hidden to all FieldLayouts except to the first one that is assigned. Please let me know if this helps you, if not could please send me an isolated sample project, so I can investigate it further for you.
Looking forward for your reply.