Depending on the chosen theme, the page TextBox will not display all of the digits. This is inconvenient in scenarios where the RadDataPager has many pages.
To work this around, subscribe to the Loaded event of RadDataPager and retrieve the ScrollContentPresenter element with x:Name="PART_ScrollContentPresenter" using the ChildrenOfType extension method and set its Width property to the desired value and HorizontalAlignment property to Center.
private void radDataPager_Loaded(object sender, RoutedEventArgs e)
{
RadDataPager radDataPager = (RadDataPager)sender;
ScrollContentPresenter scrollContentPresenter = radDataPager
.ChildrenOfType<ScrollContentPresenter>().FirstOrDefault(x => x.Name == "PART_ScrollContentPresenter");
if (scrollContentPresenter != null )
{
scrollContentPresenter.Width = 45;
scrollContentPresenter.HorizontalAlignment = HorizontalAlignment.Center;
}
}
The DataPagerTextBox element has a set Width property by design, which leads to the hiding of the digits. This decision was taken, in order for the textbox to have a fixed size and not change its size based on the input value.
With this in mind, since having many pages is a valid scenario, the correct way to prevent this behavior is to utilize the TextBoxStyle property of the RadDataPager control. A Style that targets the DataPagerTextBox element can be created and its Width property can be set so that the observed behavior is not present.
The following code snippet shows the appropriate way of updating the Width property of the DataPagerTextBox:
xmlns:dataPager="clr-namespace:Telerik.Windows.Controls.Data.DataPager;assembly=Telerik.Windows.Controls.Data"
<Window.Resources>
<!--If NoXaml assemblies are used: BasedOn="{StaticResource DataPagerTextBoxStyle}"-->
<Style x:Key="DataPagerTextBoxStyle" TargetType="dataPager:DataPagerTextBox" >
<Setter Property="Width" Value="98"/>
</Style>
</Window.Resources>
<Grid>
<telerik:RadDataPager x:Name="radDataPager" TextBoxStyle="{StaticResource DataPagerTextBoxStyle}"/>
</Grid