I am trying to include additional data on RadDataPager by editing the Template.
This code is in DataPager Template:
<TextBlock x:Name="txtPageIndex" Text="{Binding PageIndex, RelativeSource={RelativeSource TemplatedParent}}" Margin="5,0" VerticalAlignment="Center"/> <TextBlock x:Name="txtPageSize" Text="{Binding PageSize, RelativeSource={RelativeSource TemplatedParent}}" Margin="5,0" VerticalAlignment="Center"/> <TextBlock x:Name="txtItemCount" Text="{Binding ItemCount, RelativeSource={RelativeSource TemplatedParent}}" Margin="5,0" VerticalAlignment="Center"/>
I get all three values display on DataPager.
I used http://www.olsonsoft.com/blogs/stefanolson/post/Improvements-to-Silverlight-Multi-binding-support.aspx technique to display the record and do either some formatting or calculation on these fields using converters.
this is what I tried:
<TextBlock Margin="5,0" VerticalAlignment="Center"> <multibind:BindingUtil.MultiBindings> <multibind:MultiBindings> <multibind:MultiBinding TargetProperty="Text" Converter="{StaticResource formatConverter2}" ConverterParameter="Pager1 {0} - {1} of {2}" > <multibind:BindingCollection> <Binding Path="PageIndex" RelativeSource="{RelativeSource TemplatedParent}"/> <Binding Path="PageSize" RelativeSource="{RelativeSource TemplatedParent}"/> <Binding Path="ItemCount" RelativeSource="{RelativeSource TemplatedParent}"/> </multibind:BindingCollection> </multibind:MultiBinding> </multibind:MultiBindings> </multibind:BindingUtil.MultiBindings> </TextBlock>
when I debug I get all three as null. I am not sure what exactly going on when we declare in multibinding.
what's confusing is - I get the values if I use individual textblocks, but if we multibind, I get all values null. Is this way we need to bind? or Stefen's multibind is not figure out with RelativeParent?
Any help is really appreciated.
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog