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
1070
How to bind to the PageSize property of the PagerSettings for an XamGrid
posted

I have the following XAML snippet.

<igDock:ContentPane x:Class="...."
                    ....
                    xmlns:ig=”http://schemas.infragistics.com/xaml”
                    Header=”{Binding Name}”>

  <ig:XamGrid ItemsSource=”{Binding DataTable}” ...>
    <ig:XamGrid.PagerSettings>
      <ig:PagerSettings AllowPaging=”Bottom” PageSize=”{Binding MaxRecordCount}” />
    </ig:XamGrid.PagerSettings>
  </ig:XamGrid>
</igDock:ContentPane>

This XAML snippet shows three binding. One for the Header of the ContentPane, a second for the ItemsSource of the XamGrid and a third for the PageSize of the PagerSettings. The Binding for the Header and ItemsSource work fine but the Binding for the PageSize does not. I see the following Binding Error in the Output window.

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement for FrameworkContentElement for target element. BindingExpression:Path=MaxRecordCount; DataItem=null; target element is ‘PagerSettings’ (HashCode=xxxxxxxxx); target property is ‘PageSize’ (type ‘Int32’)

I have the correct properties in my ViewModel and they are correctly using the NotifyPropertyChanged events.

Can anyone tell me how to correct this Binding Error?

Parents
No Data
Reply
  • 138253
    Verified Answer
    Offline posted

    Hello Eric,

     

    Thank you for your post. I have been looking into it and I have created a sample project for you with the functionality you want. Basically I create an instance of the ViewModel in the Window’s Resources and set it as Binding’s Source, because the DataContext in the PagerSettings is null. Please let me know if this helps you or you need further assistance on this matter.

     

    Looking forward for your reply.

    XamGridPagerSizeBinding.zip
Children