3 Answers, 1 is accepted
0
Hello Paul,
Thank you for contacting Telerik Support.
You can customize the appearance of RadPropertyGrid items using the ItemFormatting event:
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Thank you for contacting Telerik Support.
You can customize the appearance of RadPropertyGrid items using the ItemFormatting event:
public
Form1()
{
InitializeComponent();
this
.radPropertyGrid1.SelectedObject =
new
MyObject(
"S726R45"
,
"MyObjext Name"
);
this
.radPropertyGrid1.ToolbarVisible =
true
;
}
private
void
radPropertyGrid1_ItemFormatting(
object
sender, PropertyGridItemFormattingEventArgs e)
{
PropertyGridItem item = e.Item
as
PropertyGridItem;
if
(item !=
null
)
{
if
(item.ReadOnly)
{
e.VisualElement.ForeColor = Color.Red;
}
else
{
e.VisualElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}
}
public
class
MyObject
{
private
string
id;
private
string
name;
public
MyObject(
string
id,
string
name)
{
this
.id = id;
this
.name = name;
}
public
string
Name
{
get
{
return
this
.name;
}
set
{
this
.name = value;
}
}
public
string
Id
{
get
{
return
this
.id;
}
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paul
Top achievements
Rank 1
answered on 20 Aug 2013, 04:28 PM
That's pretty much what I was looking for, but is there any way to just set the color of the value (not the label)?
0
Hello Paul,
Thank you for writing back.
If you want to change the fore color only on the cell of the value element, you should modify the previous sample code snippet as follows:
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
Thank you for writing back.
If you want to change the fore color only on the cell of the value element, you should modify the previous sample code snippet as follows:
private
void
radPropertyGrid1_ItemFormatting(
object
sender, PropertyGridItemFormattingEventArgs e)
{
PropertyGridItem item = e.Item
as
PropertyGridItem;
if
(item !=
null
)
{
if
(item.ReadOnly)
{
//e.VisualElement.ForeColor = Color.Red;
((e.VisualElement.Children[0]
as
StackLayoutElement).Children[4]
as
PropertyGridValueElement).ForeColor = Color.Red;
}
else
{
e.VisualElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>