Hi
In XamDataGrid I want to bind "ExpansionIndicatorVisibility" for each Record based on Condition (based on column value present in DataSet/DataTable) in XAML
can anybody suggest me how can I do that in XAML?
Hello Naitik,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hi Stefan,
Thanks for your solution.
Currently I am accessing cell value using "Column Name". and I am binding different Dataset to XamDataGrid. so DataSet may not contain that "Column Name" at
that time i am getting error in converter. I did some workaround but I don't think it is a good way when I have millions of records and lot of Columns (Fields).
Is there any other way to achieve that?? I have Attached my Convertor file.
My Final Goal is to achieve the functionality which is Combination of CheckOnDisplay + CheckOnExpand (If there is child record then it should display Expansion sign else not. and when Parent Expands it should fetch child records)
I have already set FieldLayoutSettings.ExpansionIndicatorDisplayMode = ExpansionIndicatorDisplayMode.CheckOnExpand in my code.
Thanks & Regards,
Naitik
I can suggest set the XamDataGrid’s FieldLayoutSettings’ ExpansionIndicatorVisibility to Always and handle the DataRecordPresenter’s Loaded event using Style like this:
<Style TargetType="{x:Type igDP:DataRecordPresenter}"> <EventSetter Event="Loaded" Handler="DRPLoaded"/> </Style>
And add the following handler and get the ExpansionIndicator:
private void DRPLoaded(object sender, RoutedEventArgs e) { ExpansionIndicator ei = Utilities.GetDescendantFromName(sender as DependencyObject, "ExpansionIndicator") as ExpansionIndicator; //Check the child tables... }
After you check if the Row has Child table you can set the correct visibility. Also you can handle the XamDataGrid’s RecordExpanding event and in its handler you can fetch the child table.
Hope this helps you.
Thanks for your quick reply.
I am using Resource Dictionary for Common style and i think for EventSetter in resource dictionary i need to user command. I don't think so there is any other way to do so.
I will try your suggestion and let you know if any help needed.
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.
Thank you very much for your sample example. It worked as expected.
Thanks once again.
I have modified the sample I sent you before and now there aren’t event handlers, only relay commands for the DataRecordPresenter’s Loaded event. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
I am not able to bind "Loaded" event in resource dictionary using EventSetter. Problem is Event is in different xaml.cs file then resource dictionary.
can you guide me how to bind EventSetter to event (which is in other xaml.cs file) in Resource Dictionary??