Ok, so I am opening a new topic with this issue
Hi, I am MarkoI am having a problem understanding how this works:http://samples.infragistics.com/sllob/RunSamples.aspx?cn=grid#/grid/handling-hierarchical-data-setsCan someone please put here some sample project with Access database (I am using SQL 2008) so that I can see how do I get data from the database into the class objects and the into grid. I am asking this cause I can't understand this part with binding data to the columns:Text="{Binding Source={StaticResource Strings} , Path=XWG_OrderDetails_Discount}"This is how I load data into grid from database: I make new class "Users" and make method in service "GetUsers" that executes sql query and gets data from db onto list of objects of "Users" class and returns that list. When execution of the service method is completed I do this xamGrid1.ItemsSource = e.Result; and grid displays data.How is this "http://samples.infragistics.com/sllob/RunSamples.aspx?cn=grid#/grid/handling-hierarchical-data-sets" different ? comparing to the my method described above??
PS. Can someone please put here some sample project with Access database.
Please help me resolve this issue,Best regards,Marko
Hello ,
I am just checking if you require any further assistance on the matter.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hi Marko,
I am glad I was able to assist you.
As to your last questions, I took a look and there is a gap in the 3ird row because, as I mentioned, my code reaches only the second level of the hierarchy. In order to manipulate the third one, you can nest additional loop like this:
foreach (Row r in xamGrid1.Rows)
{
if (r.Control.Height != 14)
r.Control.Height = 14;
if (r.HasChildren)
foreach (var c in r.ChildBands)
foreach (Row row in c.Rows)
if (row.Control != null && row.Control.Height != 14)
row.Control.Height = 14;
foreach (var v in row.ChildBands)
foreach (Row row2 in v.Rows)
if (row2.Control != null && row2.Control.Height != 14)
row2.Control.Height = 14;
}
Or you can organize this in a recursion structure, so no nesting will be necessary in future, if you decide to add more levels in your hierarchy.
As to your second question, every column layout can declare its own expansion indicator’s style - all you have to do is to define ExpansionIndicatorSettings on the desired level. Please notice that you should use ExpansionIndicatorSettingsOverridel like this:
<ig:ColumnLayout.ExpansionIndicatorSettings>
<ig:ExpansionIndicatorSettingsOverride>
<ig:ExpansionIndicatorSettingsOverride.Style>
<Style TargetType="Prim:ExpansionIndicatorCellControl">
<Setter Property="Height" Value="20"/>
<Setter Property="Background" Value="Violet"/>
</Style>
</ig:ExpansionIndicatorSettingsOverride.Style>
</ig:ExpansionIndicatorSettingsOverride>
</ig:ColumnLayout.ExpansionIndicatorSettings>
<ig:ColumnLayout.Columns> …
Please let me know if you have any additional questions regarding the discussed matter.
Infragistics, Inc.
Hi EkStaneva
Your solution works fine. Thank you very much for your help.
I have two more doubts but they are not so impostant, I am just gonna ask you if you know to solve them of the top of your head. Here is the picture:
1st one: Can you see the gap still exists only (i repeat only) after the first sub row "Opis problema"? How do I remove it?
2nd one: Can expansion indicator cell have two different styles?? One style on ordinary (parent) row and second style on sub row. I am asking this because I have set padding so that the arrow would be nicely visible on sub row expansion indicator cells where height of the cell is 15px. But that style
<Setter Property="Padding" Value="0 -2 0 0" /> <-- note !! <Setter Property="Margin" Value="0" /> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalContentAlignment" Value="Top" /> <Setter Property="Width" Value="30" />
applies on expansion indicator cells of parent rows too where height of the row is 26px so the arrow goes up. And is not vertically centered to "Center". It just doesn't look nice.
These ARE minor issues but I would like to solve them nevertheless.
Best regards.
Marko.
Hi,
thank you for your answer, I will try it and then I'll get back to you.
Best regards,
Hello Marko,
I have been investigating into your issue and you can use the following code in order to set the height of the xamGrid’s main layout and second layout rows separately:
private void xamGrid1_LayoutUpdated(object sender, EventArgs e)
Please notice that the inner instance of the row.Control will be instantiated when the corresponding layout gets expanded, which means that the height property should be set when the layout is being updated. That’s why I am placing this code in the LayoutUpdated handler. Notice also the check which I am performing (if value is 14) – this one is done in order to guarantee that the height property will be set only once, even though the handler is being invoked multiple times.
Please let me know if you require funder assistance regarding the discussed matter.