Silverlight Controls and Silverlight Toolkithttp://forums.silverlight.net//35.aspx/1?Silverlight+Controls+and+Silverlight+ToolkitDiscussions around using and developing Silverlight controls and the Silverlight ToolkitMon, 01 Jan 0001 00:00:00 -050035131370http://forums.silverlight.net//p/49800/131370.aspx/1?Update+datagrid+row+text+color+based+on+bounded+data+property+valueUpdate datagrid row text color based on bounded data property value <p>&nbsp;Hello,</p> <p>&nbsp;I need to update the row text font based on bounded data.</p> <p>&nbsp;For example, let's say I have a class Person with a property bool HasChildren.</p> <p>I want&nbsp; to display the row's text in red for each Person which HasChildren is rue.</p> <p>What's the best way to do this ?</p> <p>Thanks. <br> </p> 2008-11-14T22:39:50-05:00131372http://forums.silverlight.net//p/49800/131372.aspx/1?Re+Update+datagrid+row+text+color+based+on+bounded+data+property+valueRe: Update datagrid row text color based on bounded data property value <p>I think I know how to do this: bind the row Foreground property to HasChildren using a IValueConverte which returns a brush </p> 2008-11-14T22:45:03-05:00131377http://forums.silverlight.net//p/49800/131377.aspx/1?Re+Re+Update+datagrid+row+text+color+based+on+bounded+data+property+valueRe: Re: Update datagrid row text color based on bounded data property value <p>&nbsp;What I need in fact is to set the whole row color.<br> </p> 2008-11-14T22:59:05-05:00131432http://forums.silverlight.net//p/49800/131432.aspx/1?Re+Re+Update+datagrid+row+text+color+based+on+bounded+data+property+valueRe: Re: Update datagrid row text color based on bounded data property value <p>Yes, using DataBining and IValueConverter to do this is the right way. If you need to set the whole row color, you still need to do it for each column&nbsp; because there is no way to set the whole row background color or text color in the current DataGrid.</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-11-15T03:03:46-05:00131440http://forums.silverlight.net//p/49800/131440.aspx/1?Re+Re+Update+datagrid+row+text+color+based+on+bounded+data+property+valueRe: Re: Update datagrid row text color based on bounded data property value <p>In the datatemplate, bind the data to a textbox, From the codebehind, depending on the condition change the background of the textbox, Have the&nbsp;size of the textbox to auto so it fills the whole row and height. Make the enabling false.</p> <p>Hope this is helpful.</p> <p>If this post was helpful then <strong>please 'Mark as Answer'</strong></p> <p>Sharker Khaleed Mahmud<br> Sr. Software Developer<br> (MCP,MCTS,MCPD[web])</p> <p>This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.</p> <p>&nbsp;</p> <p>&nbsp;</p> <p><br> &nbsp;</p> 2008-11-15T03:24:44-05:00131558http://forums.silverlight.net//p/49800/131558.aspx/1?Re+Re+Re+Update+datagrid+row+text+color+based+on+bounded+data+property+valueRe: Re: Re: Update datagrid row text color based on bounded data property value <p>Does any of you know about a known problem with binding the Foreground property and using IValueConverter on a DataGridTextColumn ?</p> <p>On a TextBlock in a&nbsp; DataGridTemplateColumn this works fine:</p> <p>Foreground=&quot;{Binding Item.IsDeleted, Converter={StaticResource ItemDeletedBrushConverter}}&quot; </p> <p>But setting the exactly the same line on a DataGridTextColumn throws an exception:</p> <p>Item is a class having a boolean IsDeleted public property and again it works fine on DataGridTemplateColumn.</p> <p>Obviously setting Foreground to {Red} for example does work for DataGridTextColumn.</p> <p>Any idea ? <br> </p> <p>&nbsp;</p> 2008-11-15T12:13:31-05:00