Setting property in Style

6 posts, 1 answers
  1. Le_Roy
    Le_Roy avatar
    31 posts
    Member since:
    Nov 2009

    Posted 06 Sep 2010 Link to this post

    Hello, dear developers!
    I got question, can I set property value of DataPager in static resource?
    Here's my point of view.
    This one is placed in App.xaml.

    <Style x:Key="DataPagerPageSize" TargetType="telerik:RadDataPager">
      <Setter Property="telerik:RadDataPager.PageSize" Value="2"/>
    </Style>

    And that is on the control
    <telerik:RadDataPager DisplayMode="FirstLastPreviousNextNumeric" Source="{Binding Data, ElementName=dds}" Style="{StaticResource DataPagerPageSize}"/>
    DataPager using binding to DomainDataSource..

    This scenario is not working. So the question is HowTo?
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 06 Sep 2010 Link to this post

    Hello Le_Roy,

    Your style setter is wrong. Please, read this article.

    I hope this helps.

    Best wishes,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Le_Roy
    Le_Roy avatar
    31 posts
    Member since:
    Nov 2009

    Posted 06 Sep 2010 Link to this post

    According to MSDN, their example
    <Style TargetType="{x:Type TextBlock}">
      <Setter Property="FontFamily" Value="Segoe Black" />
      <Setter Property="HorizontalAlignment" Value="Center" />
      <Setter Property="FontSize" Value="12pt" />
      <Setter Property="Foreground" Value="#777777" />
    </Style>
    And mine
    <Style x:Key="DataPagerPageSize" TargetType="telerik:RadDataPager">
      <Setter Property="telerik:RadDataPager.PageSize" Value="2"/>
    </Style>

    E.g. with RadWindow, RadComboBox such scenario works like a charm.
    Perharps its related to Resharper bug, I'll try. Tx for fast reply.
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 06 Sep 2010 Link to this post

    Hello Le_Roy,

    Simply leave PageSize. You do not need the rest:

    <Style x:Key="DataPagerPageSize" TargetType="telerik:RadDataPager">
      <Setter Property="PageSize" Value="2"/>
    </Style>

    As you notice the Style carries information about the TargetType so you do not need to specify it each Setter.

    Regards,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Le_Roy
    Le_Roy avatar
    31 posts
    Member since:
    Nov 2009

    Posted 07 Sep 2010 Link to this post

    Ross, it doesnt works either..
  7. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 07 Sep 2010 Link to this post

    Hi Le_Roy,

    Then open a separate support ticket and send us a sample project which we can debug. Thanks in advance.

    Sincerely yours,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner