I have a RadGridview with itemsource as list. with certain content.
now depending on new content in the list i need to display as bold in RadGridview.
like i need to display the mails in Inbox in a RadGridview... which has both read and unread mails ..if the mail is unread i need to display that Row content as Bold ..Is this possible?????
In my each record contain "status" field, its contain "False" or "True" value, False-mean unread msg and True-mean read msg
as anyone explain this to me.
4 Answers, 1 is accepted
Here is how to do it:
using
System.Windows;
using
System.Windows.Controls;
using
Telerik.Windows.Controls;
using
Telerik.Windows.Controls.GridView;
using
Telerik.Windows.Data;
namespace
TicketID_256061_ConditionalRowFormatting
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
this
.playersGrid.RowLoaded +=
new
System.EventHandler<Telerik.Windows.Controls.GridView.RowLoadedEventArgs>(playersGrid_RowLoaded);
this
.playersGrid.ItemsSource = Club.GetPlayers();
}
void
playersGrid_RowLoaded(
object
sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
GridViewRow row = e.Row
as
GridViewRow;
if
(row !=
null
)
{
Player player = (Player)e.DataElement;
// Dummy logic -- your will be the real one.
if
(player.Number > 10)
{
row.FontWeight = System.Windows.FontWeights.ExtraBold;
}
}
}
}
}
I have attached the sample project. I hope it helps.
Sincerely yours,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I get my answer.
Is there any workaround for this?
You can use either a CellStyleSelector or a RowStyleSelector to achieve the functionality that Piyush Patel asked about in 2009. You can even change the template of the cell based on certain conditions by using a CellTemplateSelector.
If that is not what you want to achieve, could you please elaborate on your exact problem/question?
Rossen Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.