hello
i'm using infragistics xamgrid 10.3.
i have a carefull read on this "http://community.infragistics.com/silverlight/articles/conditional-formatting-with-the-xamwebgrid.aspx" and this topics "http://help.infragistics.com/Help/NetAdvantage/Silverlight/2010.3/CLR4.0/html/xamGrid_Conditional_Formatting.html"
i 've tried to used the comparison operand lessthan or greaterthan for conditionnal formatting.i've succeed to obtain wanted display by using hard coded value such as value="50" but when i try any kind of binding on this value it failed.
so my goal based on your code is as follows :
<ig:XamGrid Grid.Row="0" x:Name="MyDataGrid" AutoGenerateColumns="false"> <ig:XamGrid.ConditionalFormattingSettings> <ig:ConditionalFormattingSettings AllowConditionalFormatting="True"/> </ig:XamGrid.ConditionalFormattingSettings> <ig:XamGrid.Columns> <ig:TextColumn Key="ProductID"/> <ig:TextColumn Key="ProductName"/> <ig:TextColumn Key="QuantityPerUnit"/> <ig:TextColumn Key="UnitPrice"/> <ig:TextColumn Key="UnitsInStock"> <ig:TextColumn.ConditionalFormatCollection> <ig:GreaterThanConditionalFormatRule Value="{Binding Path=Rowdata.UnitsOnOrder}" StyleToApply="{StaticResource Style1}"/> <ig:lessThanConditionalFormatRule Value="{Binding Path=Rowdata.UnitsOnOrder}" IsTerminalRule="True" StyleToApply="{StaticResource Style2}"/> </ig:TextColumn.ConditionalFormatCollection> </ig:TextColumn> <ig:TextColumn Key="UnitsOnOrder"/> <ig:TextColumn Key="ReorderLevel"/> <ig:TextColumn Key="Discontinued"/> </ig:XamGrid.Columns></ig:XamGrid>Should you provide any issue to ressolve this ?best regards
<ig:XamGrid Grid.Row="0" x:Name="MyDataGrid" AutoGenerateColumns="false"> <ig:XamGrid.ConditionalFormattingSettings> <ig:ConditionalFormattingSettings AllowConditionalFormatting="True"/> </ig:XamGrid.ConditionalFormattingSettings> <ig:XamGrid.Columns> <ig:TextColumn Key="ProductID"/> <ig:TextColumn Key="ProductName"/> <ig:TextColumn Key="QuantityPerUnit"/> <ig:TextColumn Key="UnitPrice"/> <ig:TextColumn Key="UnitsInStock"> <ig:TextColumn.ConditionalFormatCollection> <ig:GreaterThanConditionalFormatRule Value="{Binding Path=Rowdata.
<
ig:XamGrid
Grid
Row
="0"
x
:
Name
="MyDataGrid"
AutoGenerateColumns
="false"
>
.ConditionalFormattingSettings
ig
ConditionalFormattingSettings
AllowConditionalFormatting
="True"
/>
</
.Columns
TextColumn
Key
="ProductID"
="ProductName"
="QuantityPerUnit"
="UnitPrice"
="UnitsInStock"
TextColumn.ConditionalFormatCollection
GreaterThanConditionalFormatRule
Value
="{Binding Path=Rowdata.
UnitsOnOrder
}" StyleToApply="{StaticResource Style1}"/> <ig:lessThanConditionalFormatRule Value="
}"
StyleToApply
="{
StaticResource
Style1
lessThanConditionalFormatRule
="
{Binding Path=Rowdata.
}
" IsTerminalRule="True" StyleToApply="{StaticResource Style2}"/> </ig:TextColumn.ConditionalFormatCollection> </ig:TextColumn> <ig:TextColumn Key="UnitsOnOrder"/> <ig:TextColumn Key="ReorderLevel"/> <ig:TextColumn Key="Discontinued"/> </ig:XamGrid.Columns></ig:XamGrid>Should you provide any issue to ressolve this ?best regards
"
IsTerminalRule
Style2
="UnitsOnOrder"
="ReorderLevel"
="Discontinued"
Hello,
thank you for the link provided.
it suggest that conditionnal formatting most often required to provide code to run the issue.
your sample also provided hard coded test so how do i code a boolean condition coupled with a style to applky when it's return true.
the way you suggest is breaking the model with many rule available for one cell.
so please take the xaml bellow intoaccount:
<ig:GreaterThanConditionalFormatRule Value="{Binding Path=Rowdata.UnitsOnOrder}" StyleToApply="{StaticResource Style1}"/> <ig:lessThanConditionalFormatRule Value="{Binding Path=Rowdata.UnitsOnOrder}" IsTerminalRule="True" StyleToApply="{StaticResource Style2}"/>base on your link i'll try to have a fix.best regard
<ig:GreaterThanConditionalFormatRule Value="{Binding Path=Rowdata.
" IsTerminalRule="True" StyleToApply="{StaticResource Style2}"/>base on your link i'll try to have a fix.best regard
Hi,
The reason the bindings won't work, is because rules aren't FrameworkElement's, which means they don't have a DataContext, which is why your binding doesn't actually resolve to anything.
As for the sample attached, it was just a point of guidance. You can add a StyleToApply property to your custom Rule, and apply multiple custom rules if needed, and the styles you apply will be merged together.
To Evaluate your condition, you wouldn't need to provide UnitsOnOrder, as you'll have that information in EvaluateCondition, as the SourceDataObject, is your Rows' underlying data. So you can simply check UnitsInStock versus your UnitsOnOrder, and return the appropriate style.
I hope this helps clear some things up.
-SteveZ
Thanks for helping me.
I have use your work around to perform custom formatting with a bit of generalized approach but i still have to writ about 10 class to do what the cllient was expecting.
Best regards