开发者

Silverlight DataGrid events not firing

开发者 https://www.devze.com 2023-03-02 04:31 出处:网络
I have a Silverlight DataGrid bound to a PagedCollectionView. The SelectionChanged event fires if I simply bind the DataGrid. However, if I add a DataPager to work with the datagrid, none of the event

I have a Silverlight DataGrid bound to a PagedCollectionView. The SelectionChanged event fires if I simply bind the DataGrid. However, if I add a DataPager to work with the datagrid, none of the events on the DataGrid fire except for the first row while loading. Here's my code:

<sdk:DataGrid Cursor="Hand" IsReadOnly="True" x:Name="dgImports" AutoGenerateColumns="False">
    <sdk:DataGrid.Columns>
        <sdk:DataGridTextColumn Binding="{Binding ImportID}" Width="0" Visibility="Collapsed"/>
        <sdk:DataGridTextColumn Binding="{Binding Sequence}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Sequence Number" Width="Auto" />
        <sdk:DataGridTextColumn Binding="{Binding CreateDate}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Create Date" Width="Auto" />
        <sdk:DataGridTextColumn Binding="{Binding Error}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Error" Width="Auto" />
    </sdk:DataGrid.Columns>
    <i:Interaction.Triggers&g开发者_如何学运维t;
        <i:EventTrigger EventName="SelectionChanged">
            <i:InvokeCommandAction
                 Command="{Binding SelectionChangedCommand}"
                 CommandParameter="{Binding SelectedItem, ElementName=dgImports}"/>
            </i:EventTrigger>

        </i:Interaction.Triggers>
</sdk:DataGrid>

<sdk:DataPager x:Name="dgImportsPager" 
               Source="{Binding Path=ItemsSource, ElementName=dgImports}"
               PageSize="20"  />

Any clues?


First, am i missing something? I don't see where you are Binding the datagrid to a PagedCollectionView (or any items source for that matter).

Second, for kicks & giggles, try setitng the Source for the DataPager to the PagedCollectionView as well, rather than the Path=ItemsSource of the dgImports.

0

精彩评论

暂无评论...
验证码 换一张
取 消