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
4970
How to bind data from VM for customized pager?
posted

I try to bind data from vm for a element in pager of XamGrd.  I set up page style as:

    <Style x:Key="MyPager" TargetType="gridPrim:PagerCellControl" >
        <Setter  Property="Template">
            <Setter.Value >
                <ControlTemplate TargetType="gridPrim:PagerCellControl">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition  Width="Auto" />
                            <ColumnDefinition  Width="*" />
                            <ColumnDefinition  Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{Binding ListName}" HorizontalAlignment="Left" />
                        <StackPanel Grid.Column="2"  Orientation="Horizontal" HorizontalAlignment="Right" >                          
                            <gridPrim:PagerControl x:Name="PagerItemControl">
                                <ig:Commanding.Commands>
                                    <ig:XamGridPagingCommandSource EventName="FirstPage"  CommandType="FirstPage"/>
                                    <ig:XamGridPagingCommandSource EventName="LastPage"  CommandType="LastPage"/>
                                    <ig:XamGridPagingCommandSource EventName="PreviousPage"  CommandType="PreviousPage"/>
                                    <ig:XamGridPagingCommandSource EventName="NextPage"  CommandType="NextPage"/>
                                    <ig:XamGridPagingCommandSource EventName="GoToPage"  CommandType="GoToPage" />
                                </ig:Commanding.Commands>
                            </gridPrim:PagerControl>
                        </StackPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter >
    </Style>

the XamGrid is in UserControl1 which is bound to VM for DataContext with two properties:

public string ListName{get;set;}

public PagedCollectionView DataList { get; set; }

ItemSource of XamGrid is bound DataList.

then in code I try to assign Name for ListName="My List Name"; but it is not showing up when run the app. I even force to raise property change like:

ListName="My List Name";

RaisePropertyChanged("ListName");

Still can't see ListName display in pager.

How to resolve this problem?

Parents Reply Children
No Data