This is a migrated thread and some comments may be shown as answers.

Conditional Cell Formatting Not Working

3 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert Kaucher
Top achievements
Rank 2
Robert Kaucher asked on 24 Aug 2012, 06:33 PM
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?

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 27 Aug 2012, 06:21 AM
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.

0
Robert Kaucher
Top achievements
Rank 2
answered on 27 Aug 2012, 12:52 PM
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.

0
Dimitrina
Telerik team
answered on 29 Aug 2012, 01:34 PM
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.

Tags
GridView
Asked by
Robert Kaucher
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Robert Kaucher
Top achievements
Rank 2
Share this question
or