Conditional Cell Formatting Not Working

4 posts, 0 answers
  1. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 24 Aug 2012 Link to this post

    I am using the following XAML

    <telerik:GridViewDataColumn DataMemberBinding="{Binding CurrentForecastEntry.Month11Qty, Mode=TwoWay, Converter={StaticResource NullInt}}" >
        <telerik:GridViewDataColumn.Header>
                    <TextBlock DataContext="{StaticResource ViewModel}" 
                               Text="{Binding CurrentForecastPeriod.Month11, StringFormat=MMM, FallbackValue='Month01'}" 
                               ToolTipService.ToolTip="{Binding PeriodValue11, StringFormat=MMM-yy}"
                               />
        </telerik:GridViewDataColumn.Header>
         
            <telerik:GridViewDataColumn.CellTemplateSelector>
            <telerik:ConditionalDataTemplateSelector>
                    <telerik:DataTemplateRule Condition="MonthQuantity11 >= 0">
                    <DataTemplate>
                        <Border Background="Red">
                            <TextBlock Foreground="Red" Text="{Binding CurrentForecastEntry.Month11Qty}"/>
                        </Border>
                    </DataTemplate>
                </telerik:DataTemplateRule>
                    <telerik:DataTemplateRule Condition="CurrentForecastEntry.MonthQuantity11 != null">
                    <DataTemplate>
                            <TextBlock Text="{Binding CurrentForecastEntry.Month11Qty}" />
                    </DataTemplate>
                </telerik:DataTemplateRule>
            </telerik:ConditionalDataTemplateSelector>
        </telerik:GridViewDataColumn.CellTemplateSelector>
         
    </telerik:GridViewDataColumn>

    I see no change in the cell regardless of what the values is. What am I doing wrong?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 Aug 2012 Link to this post

    Hello,

     May I ask you to use "&gt;=" instead of ">=" for the Condition? You can as well check our online example on DataTemplateSelectors.

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Robert Kaucher
    Robert Kaucher avatar
    56 posts
    Member since:
    Oct 2010

    Posted 27 Aug 2012 Link to this post

    I have tried both and neither has worked. I assumed that the character code was in correct as the online example uses both ">" and "&lt;" so it is not clear when one is supposed to use the character codes and not.

    In either case, neither one works.

  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 29 Aug 2012 Link to this post

    Hi,

     I have created a test project to check how the condition is applied. It worked fine. Please find it attached for a reference.

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top