Hi,
I need to show a border around the cell when a certain condition meets a criteria, is this is possible? Using ConditionalFormattingCellControl.BackgroundProperty, I see I can set background colors via various brushes, but how can I create border around a cell? Any ideas?
Thanks
Please note I am using TextColumn and I am showing a "number" (Double type) on such column with custom formatting (FormatString) so only few decimal precision could be rendered on this column. Can I use template column in such case where if a condition meets it shows a border keeping the format string working?
Hello Rohit,
Thank you for your post. I have been looking into it. You can use the default style for the CellControl and bind the BorderBrush property of the CellControl to a property from your ViewModel for example. Please node, that you have to change the value of the BorderThickness property to ‘1,1,1,1’, in order for the border to appear.
Since you have mentioned that you are using some custom formatting, would you please provide us a small sample application, that shows the functionality you are using, in order for us to be able to further research the issue and provide you with further support.
Would you please also further explain on what condition you want to set the change the color of the border?
Thank you in advance for the provided information. Looking forward to hearing from you.
Thanks.
OK the border and border brush works ok but let me ask you bit different question.
I want to show a number colum that rounds of the number to certain decimal precision but then I also want to underline the number if it meets certain criteria, i know i could use template column but then template column does not use FormatString property.
Can you show me an example of how to use template column with formatstring so i could round of a number yet apply conditional formatting so i could underline if it is greater than say 5?
Grid.Columns.Add(new TextColumn() { HeaderText = "Col4", Key = "Col4", IsReadOnly = true, FormatString = <Decimal precision format goes here> });
Grid.Columns.Add(new TemplateColumn { HeaderText = "Condition1", Key = "Condition1", });
I have been looking into your post. I am glad I was able to help.
Regarding your question about the TemplatedColumns I have created a small sample to show you how you can use them and have string formatting too.
In the sample application I have created two TemplatedColumns. They both have HeaterTemplates, that show the Header of the column, and ItemTempletes – to show the values in the cells.
I have placed a TextBlock inside the ItemTemplate for the columns, since this template is used when the cell is not in edit mode. Then in the binding for the text I set the StringFormat property for the text of the TextBlock.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
This is great, thanks much for your help.
Thank you for the feedback. I am glad I was able to help.