Hi,
I have a UserControl which itself contains 2usercontrols(XAM datagrid ). i have set Grid's Rowdefinition currently as *,Auto.
if there is huge data in 2nd XAMdatagrid it hides 1st one. i can set rowdefinition fixed .5* for second but 1st XAMDatagrid is parent grid and there may or may not childs in 2nd XAMDatagrid. so in that case half page will be empty.
i need to sent 2nd RowDefinition programmaticaly, if there are childrens it shd be .5* not it shd be auto. Is there any propery of XAMDatagrid which can be used to find number of Rows so that we can set DataTrigger for 2nd RowDefinition to find if rows exist in 2nd XAMDatagrid?
Regards
Hitesh
Hello Hitesh,
Thank you for your feedback.
I am glad to know, you were able to you achieve the functionality you were looking for. If you require any further assistance on this matter, please do not hesitate to ask.
Hi Nick,
Thnks for your post. verified and it's working fine now.
In order to change the RowDefinition's Height, depending on the number of records, you can use a DataTrigger bound to the Xamdatagrid's Records.Count property.To illustrate this I have prepared a custom application for you. For example:
<Grid.RowDefinitions> <RowDefinition> <RowDefinition.Style> <Style> <Setter Property="RowDefinition.Height" Value="*"/> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=xamDataGrid2, Path=Records.Count}" Value="6"> <Setter Property="RowDefinition.Height" Value="100"/> </DataTrigger> </Style.Triggers> </Style> </RowDefinition.Style> </RowDefinition>
It consists of an User control with two Xamdatagrids. The Height of the first one depends on the number of records of the second one. Try deleting a few records it will change in a custom manner.
Another approach could be through the code behind:
layout1.RowDefinitions[0].Height = new GridLength(5);
If this example does not illustrate your scenario, please modify the sample application I have provided so the issue is reproduced and send it back to me. Having this information will help me further investigate this matter for you.
Looking forward to hear from you.