<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx</link><description>There have been several questions on the WPF CodePlex discussion list relating to styling rows and columns based some requirements on other elements or some other conditions. I decided to put a couple examples here on different ways you can accomplish</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Vincent Sibal's Blog : .NET 3.5 SP1 and WPF DataGrid CTP are out now!</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#8954016</link><pubDate>Tue, 16 Sep 2008 18:14:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8954016</guid><dc:creator>Vincent Sibal's Blog : .NET 3.5 SP1 and WPF DataGrid CTP are out now!</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/vinsibal/archive/2008/08/11/net-3-5-sp1-and-wpf-datagrid-ctp-is-out-now.aspx"&gt;http://blogs.msdn.com/vinsibal/archive/2008/08/11/net-3-5-sp1-and-wpf-datagrid-ctp-is-out-now.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>WPF DataGrid - Clipboard Paste Sample</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#8958871</link><pubDate>Fri, 19 Sep 2008 18:07:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8958871</guid><dc:creator>Vincent Sibal's Blog</dc:creator><description>&lt;p&gt;In the v1 release (and CTP) of the WPF DataGrid there will be support for Clipboard.Copy but no support&lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#8971323</link><pubDate>Wed, 01 Oct 2008 12:01:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8971323</guid><dc:creator>Karen</dc:creator><description>&lt;p&gt;I've merged the resources from PresentationFramework.Aero.dll in App.xaml, and added the DataGrid to a window, along with other controls.&lt;/p&gt;
&lt;p&gt;When running on XP, all other controls appear with AeroNormalColor theme, while the grid appears on Classic theme.&lt;/p&gt;
&lt;p&gt;How to address this issue? &lt;/p&gt;</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#8975538</link><pubDate>Fri, 03 Oct 2008 17:23:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8975538</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Karen,&lt;/p&gt;
&lt;p&gt;It is possible that the DataGrid cannot find the application specific theme that you set as it defaults to Classic. &amp;nbsp;Could you explain a bit more on how you merged the resources from PresentationFramework.Aero.dll and maybe a code snippet.&lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#8976183</link><pubDate>Sat, 04 Oct 2008 09:35:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8976183</guid><dc:creator>Carinemaalouf</dc:creator><description>&lt;P&gt;In my App.xaml&lt;/P&gt;
&lt;P&gt;i put the following code&lt;/P&gt;
&lt;P&gt;&amp;lt;Application.Resources&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;lt;ResourceDictionary&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ResourceDictionary Source="pack://application:,,,/PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component\themes/aero.normalcolor.xaml" /&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;!-- other resources go here --&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;lt;/ResourceDictionary&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/Application.Resources&amp;gt;&lt;/P&gt;</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#8992816</link><pubDate>Thu, 09 Oct 2008 16:05:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8992816</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Karen,&lt;/p&gt;
&lt;p&gt;I'm still not able to repro. &amp;nbsp;Could you just send me your repro app. &amp;nbsp;You can send a zipped solution to vinsibal@microsoft.com. &amp;nbsp;Thanks.&lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9000095</link><pubDate>Wed, 15 Oct 2008 00:49:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000095</guid><dc:creator>prasanna_rao</dc:creator><description>&lt;p&gt;I am unable to compile the soln.&lt;/p&gt;
&lt;p&gt;Error	1	The type reference cannot find a public type named 'DataGridRow'. Line 15 Position 81.	C:\Program Files\Microsoft Visual Studio 9.0\Samples\C#Samples\DGridCTP\DataGridCTPSample\DataGridCTPSample\DataGridBasicSample_Demo.xaml	15	81	DataGridCTPSample&lt;/p&gt;
&lt;p&gt;I am using VS2008 SP1 with .Net 3.5 SP1&lt;/p&gt;
&lt;p&gt;Prasanna&lt;/p&gt;</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9002375</link><pubDate>Fri, 17 Oct 2008 00:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9002375</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Prasanna rao,&lt;/p&gt;
&lt;p&gt;Are you correctly referencing WPFToolKit.dll in the csproj? &amp;nbsp;I've seen this error before when I was missing the reference.&lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9007349</link><pubDate>Mon, 20 Oct 2008 15:32:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9007349</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Carine Maalouf,&lt;/p&gt;
&lt;p&gt;I talked about a solution to the issue offline, but I thought I'd post it here just in case anyone else ran into the same issue.&lt;/p&gt;
&lt;p&gt;Basically, when you want to override the default themes you can do what Carine has done with the ResourceDictionary. &amp;nbsp;However, DataGrid actually lives in WPFToolKit.dll so will still retain the default theme styles even after setting the merged ResourceDictionary as been set above. &amp;nbsp;To get it to work you will have to merge the WPFToolKit aero.normalcolor.xaml as well.&lt;/p&gt;
&lt;p&gt;&amp;lt;ResourceDictionary.MergedDictionaries&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ResourceDictionary Source=&amp;quot;pack://application:,,,/PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component\themes/aero.normalcolor.xaml&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;ResourceDictionary Source=&amp;quot;pack://application:,,,/WPFToolKit;V3.5.30731.0;;component\themes/aero.normalcolor.xaml&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/ResourceDictionary.MergedDictionaries&amp;gt;&lt;/p&gt;
&lt;p&gt;Note that you will have to update the uri when the v1 release comes out to use the public key as well as the new version number.&lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9011343</link><pubDate>Wed, 22 Oct 2008 19:46:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9011343</guid><dc:creator>Andy Mitchell</dc:creator><description>&lt;p&gt;Hi Vincent, &lt;/p&gt;
&lt;p&gt;I want to change the appearance of a column based on a property on the column configuration I have. So I added a style in my xaml and set the CellStyle on the grid. I then created my own CustomColumn class and added a property called IsReadOnly and set the property in the event handler for AutoGeneratingColumn. This is very similar to the DataGridStylingWithDataTable example that you are using. The IsReadOnly property is never accessed and I just can't understand why.&lt;/p&gt;
&lt;p&gt;Any help is much appreciated.&lt;/p&gt;
&lt;p&gt;Thanks Andy&lt;/p&gt;
&lt;p&gt;Here's the code:-&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Style x:Key=&amp;quot;defaultCellStyle&amp;quot; TargetType=&amp;quot;{x:Type dg:DataGridCell}&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Style.Triggers&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Trigger Property=&amp;quot;IsEditing&amp;quot; Value=&amp;quot;True&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Setter Property=&amp;quot;BorderBrush&amp;quot; Value=&amp;quot;Red&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Setter Property=&amp;quot;BorderThickness&amp;quot; Value=&amp;quot;2&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Trigger&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;DataTrigger Binding=&amp;quot;{Binding RelativeSource={RelativeSource Self}, &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Path=(Column).(local:ListEditColumn.IsReadOnly), &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Mode=OneWay}&amp;quot; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Value=&amp;quot;True&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Setter Property=&amp;quot;Background&amp;quot; Value=&amp;quot;Tan&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;Setter Property=&amp;quot;Foreground&amp;quot; Value=&amp;quot;Red&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/DataTrigger&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Style.Triggers&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/Style&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub AutoGeneratingColumn(ByVal sender As Object, ByVal e As DataGridAutoGeneratingColumnEventArgs)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim lobjColumn As ListEditColumn = New ListEditColumn&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lobjColumn.CanUserSort = e.Column.CanUserSort&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lobjColumn.Header = e.Column.Header&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lobjColumn.DataFieldBinding = TryCast(e.Column, DataGridBoundColumn).DataFieldBinding&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If lobjColumn.Header.ToString.Contains(&amp;quot;UID&amp;quot;) Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lobjColumn.IsReadOnly = True&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lobjColumn.CanUserSort = False&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;e.Column = lobjColumn&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Public Class ListEditColumn&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Inherits DataGridTextColumn&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Private mblnIsReadOnly As Boolean = False&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Public Property IsReadOnly() As Boolean&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Get&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return mblnIsReadOnly&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Get&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set(ByVal value As Boolean)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mblnIsReadOnly = value&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Set&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Property&lt;/p&gt;</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9024320</link><pubDate>Thu, 30 Oct 2008 15:15:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9024320</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Andy, &lt;/p&gt;
&lt;p&gt;I believe you asked the same question on the codeplex site. &amp;nbsp;I'll put a reference here just in case other people find the same issue, &lt;a rel="nofollow" target="_new" href="http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=38292"&gt;http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=38292&lt;/a&gt;.&lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9057396</link><pubDate>Mon, 10 Nov 2008 16:58:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9057396</guid><dc:creator>Cameron Elliot</dc:creator><description>&lt;p&gt;I can't see from this post how to style a cell from the value of the cell itself. &amp;nbsp;One application of this is in the red/black colouring of positive and negative values. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;To do this I would write a style with a DataTrigger which uses a converter to convert a decimal value into a boolean, representing whether the value is positive or negative.&lt;/p&gt;
&lt;p&gt;I would like to do the following:&lt;/p&gt;
&lt;p&gt;					&amp;lt;dg:DataGridTextColumn Header=&amp;quot;DecVal1&amp;quot; CellStyle=&amp;quot;{StaticResource decimalGridCell}&amp;quot; Binding=&amp;quot;{Binding Path=DecVal1, StringFormat='{}{0:N0}'}&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;But I'm a bit stumped when it comes to writing the style. &amp;nbsp;The following would work but would require me to write a style for each decimal column I want to bind to.&lt;/p&gt;
&lt;p&gt;&amp;lt;DataTrigger Value=&amp;quot;True&amp;quot; Binding=&amp;quot;{Binding Path=DecVal1, Converter=myConverter}&amp;quot; etc &lt;/p&gt;
&lt;p&gt;How do I specify in the DataTrigger that I want Binding=&amp;quot;{Value of the cell}&amp;quot; without having to name a specific property?&lt;/p&gt;
&lt;p&gt;(As an aside, I can achieve this by using a DataGridTemplateColumn, using a TextBlock in the DataTemplate, and applying a style which examines the Text property of the TextBlock, converting to decimal, then to a boolean for positive/negative. &amp;nbsp;This seems long-winded and unnecessary to me)&lt;/p&gt;</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9058384</link><pubDate>Mon, 10 Nov 2008 21:10:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9058384</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Cameron,&lt;/p&gt;
&lt;p&gt;Columns do not derive from FrameworkElement and therefore do not play well when it comes to styling. &lt;/p&gt;
&lt;p&gt;For your example, you could do the binding on DataGridCell's Content property and deal with it in your converter. &amp;nbsp;It's really all that clean but it's another way you can go. &lt;/p&gt;
</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9136594</link><pubDate>Mon, 24 Nov 2008 13:02:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9136594</guid><dc:creator>Jacek Sieka</dc:creator><description>&lt;p&gt;Regarding positive/negative coloring, it would be really nice to have a CellStyleSelector much like the ItemContainerStyleSelector works for each row.&lt;/p&gt;
&lt;p&gt;Could you please provide an example of binding the Content property?&lt;/p&gt;</description></item><item><title>re: WPF DataGrid – Styling rows and columns based on Header conditions and other properties</title><link>http://blogs.msdn.com/vinsibal/archive/2008/09/16/wpf-datagrid-styling-rows-and-columns-based-on-header-conditions-and-other-properties.aspx#9237088</link><pubDate>Thu, 18 Dec 2008 22:41:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9237088</guid><dc:creator>vinsibal</dc:creator><description>&lt;p&gt;Jacek Sieka,&lt;/p&gt;
&lt;p&gt;Which Content property are you talking about?&lt;/p&gt;
</description></item></channel></rss>