Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Issue in setting the field layout of XamDataGrid in code behind
posted

Hello,

I have a user control which has a xamdatagrid.  This user control is placed inside a view. The xamdatagrid is binded to a property of the view model of the view. Now as the view model propery changes, the data shown in the xamdatagrid should also change.

Since the data is dynamic and will vary based on the property of the view model, I cannot have the field layout setting in the XAML. I need to have the layout setting in the code behind which will change based on the property value.

Here is my code for the grid which is binded to the parent view model property. 

<

 

Infragistics:XamDataGrid Grid.Row="1" Grid.ColumnSpan="2" AutoFit="False" Name="ux_grdFees" Theme="Aero" IsGroupByAreaExpanded="False" GroupByAreaLocation="AboveDataArea" DataSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Maintenance:MaintenanceView}},Path=DataContext.Fees, Converter={StaticResource commonFeeConverter}}" FieldLayoutInitializing="ux_grdFees_FieldLayoutInitializing" >

I am changing the field layout setting in the  FieldLayoutInitializing  event which is called whenever the data source property in the parent view model is changed. However, my grid is not showing the layout changes and is not binding to the data.

When I tried the same thing with field layout set in XAML, it worked fine. So, it should not be a problem with the data source.

Anyone has any idea how to approach this problem?

Thanks

Pallavi 

  • 138253
    Offline posted

    Hello Pallavi,

     

    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.

     

    If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.

  • 138253
    Offline posted

    Hello Pallavi,

    Thank you for your post. I have been looking through it and I suggest you see this forum thread:

    http://forums.infragistics.com/forums/t/57569.aspx

    which discusses the same issue as yours. Please let me know if this helps you or you need further assistance on this matter.

    Looking forward for your reply.