StyleRule Condition Expression Through the CS dynamic generation what

1 posts, 0 answers
  1. ZHANG
    ZHANG avatar
    8 posts
    Member since:
    Jul 2011

    Posted 05 Jun 2012 Link to this post

    Who can help me ah, thank you.

    ,The following code bold information, how to pass the background ( CS) dynamically generated.?

    <telerik:RadGridView x:Name="RadGridView1"  AutoGenerateColumns="False" MinHeight="386" MaxHeight="500" Width="700"
                              CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed">
                <telerik:RadGridView.RowStyleSelector>
                    <telerik:ConditionalStyleSelector>
                        <telerik:StyleRule Condition=" (UnitPrice&gt;50 and UnitPrice&lt;60) or ProductName='1行 '">
                            <!--GridViewCell &gt为大于,&lt为小于-->
                            <Style TargetType="telerik:GridViewRow">
                                <Setter Property="Background" Value="#7F2FB3FD" />
                                <Setter Property="Foreground" Value="Red" />
                            </Style>
                        </telerik:StyleRule>
                    </telerik:ConditionalStyleSelector>
                </telerik:RadGridView.RowStyleSelector>
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn Header="Product Name" DataMemberBinding="{Binding Path=ProductName,Mode=TwoWay}"/>
                    <telerik:GridViewDataColumn Header="UnitPrice" DataMemberBinding="{Binding Path=UnitPrice,Mode=TwoWay}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

    <telerik:RadGridView x:Name="RadGridView1"  AutoGenerateColumns="False" MinHeight="386" MaxHeight="500" Width="700"                          CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed">            <telerik:RadGridView.RowStyleSelector>                <telerik:ConditionalStyleSelector>                    <telerik:StyleRule Condition=" '">                        <!--GridViewCell &gt为大于,&lt为小于-->                        <Style TargetType="telerik:GridViewRow">                            <Setter Property="Background" Value="#7F2FB3FD" />                            <Setter Property="Foreground" Value="Red" />                        </Style>                    </telerik:StyleRule>                </telerik:ConditionalStyleSelector>            </telerik:RadGridView.RowStyleSelector>            <telerik:RadGridView.Columns>                <telerik:GridViewDataColumn Header="Product Name" DataMemberBinding="{Binding Path=ProductName,Mode=TwoWay}"/>                <telerik:GridViewDataColumn Header="UnitPrice" DataMemberBinding="{Binding Path=UnitPrice,Mode=TwoWay}"/>            </telerik:RadGridView.Columns>        </telerik:RadGridView>
Back to Top