I have a grid that should display full information for some rows and only basic info and description for the others. E.g. there is a number, a description field and details after it for rows of type A and there's just a number and a description for a row of type B. The description field should extend till the end of the row and cover not relevant cells. The description is longer for B rows, so it makes sense for this column to be wide. All objects in a collection are of the same C# type, but there's a property that returns the type A or B. What are my choices? Would multiple fieldlayouts be a way? How? I also want the grid to always use the field descriptions from the A row even if the first row is B. I'd prefer XAML only solution, but I'll take whatever I can get :) Any ideas? Thanks.
Hello Ivan,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Cool, that's all done, now. Thank you for your help and patience, Stefan.
Ivan
Hello again,
You can handle the XamDataGrid's Loaded event and in the handler you can set the dummy Record to be fixed, like this:
(sender as XamDataGrid).Records[0].IsFixed = true;
Hi Stefan,
yes, that worked! Thanks. Now it looks exactly as it should. The last inconvenience is that the header with column descriptions scrolls away when there's a scrollbar. Can something be done about that? :)
You can add the following Style for the DataRecordPresenter to the XamDataGrid's Resources:
<Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding DataItem.Id}" Value="0"> <Setter Property="Height" Value="0"/> </DataTrigger> </Style.Triggers> </Style>
You can use a value that will be uniques for a Property of the dummy Record. In teh example the Proeprty is called "Id" and the value is "0". You can change them as per your requiremnts. Please let me know if this helps you or you have furtehr questions on this matter.
Looking forward for your reply.