Hello Prashant,
Thank you for contacting Telerik Support.
It is appropriate to use the
ItemFormatting event and set the desired image for the specific
PropertyGridItemElement:
public
Form1()
{
InitializeComponent();
radPropertyGrid1.PropertySort = PropertySort.Categorized;
radPropertyGrid1.SelectedObject =
new
Item(1234,
"Custom title"
,
"Description"
, 9834657);
radPropertyGrid1.ItemFormatting += radPropertyGrid1_ItemFormatting;
radPropertyGrid1.PropertyGridElement.PropertyTableElement.ItemHeight = 50;
}
private
void
radPropertyGrid1_ItemFormatting(
object
sender, PropertyGridItemFormattingEventArgs e)
{
PropertyGridItemElement item = e.VisualElement
as
PropertyGridItemElement;
if
(item !=
null
&& e.Item.Name==
"Photo"
)
{
item.ValueElement.DrawText =
false
;
item.ValueElement.Image = Properties.Resources.AndrewFuller;
item.ValueElement.ImageLayout = ImageLayout.Zoom;
}
}
public
class
Item
{
[Category(
"Category1"
)]
public
int
Id {
get
;
set
; }
[Category(
"Category2"
)]
public
string
Title {
get
;
set
; }
[Category(
"Category2"
)]
public
string
Description {
get
;
set
; }
[Category(
"Category1"
)]
public
int
BarCode {
get
;
set
; }
public
Image Photo {
get
;
set
; }
public
Item(
int
id,
string
title,
string
description,
int
barCode)
{
this
.Id = id;
this
.Title = title;
this
.Description = description;
this
.BarCode = barCode;
this
.Photo=Properties.Resources.AndrewFuller;
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik