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?
Hello Benjamin,
Thank you for your post. I have been looking into it and I created a sample proeject for you using your Style. Basically I changed the Binding of the Textblock's Text, so now everything works as you want. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thanks. I got same solution.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.