The RadGroupBox has 2 different style - Office & Standard.
Is it possible to define 2 distinct themes for each mode of the RadGroupBox, or do we have to define a custom control? For instance, I want to have a different background colour for the header in each mode
Cheers
Is it possible to define 2 distinct themes for each mode of the RadGroupBox, or do we have to define a custom control? For instance, I want to have a different background colour for the header in each mode
Cheers
4 Answers, 1 is accepted
0
Hello Jason,
Thank you for contacting Telerik support.
You cannot define a different styling for the GroupBoxStyle modes within a single theme using Visual Style Builder - each theme can hold a single style for a control. For this case you can change the theme or any styles in code after you have changed the GroupBoxStyle. For example you can change the background color when you are switching the mode like this:
If you have any questions, please do not hesitate to contact us.
Regards,
Dimitar
Telerik
Thank you for contacting Telerik support.
You cannot define a different styling for the GroupBoxStyle modes within a single theme using Visual Style Builder - each theme can hold a single style for a control. For this case you can change the theme or any styles in code after you have changed the GroupBoxStyle. For example you can change the background color when you are switching the mode like this:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
if
(radGroupBox1.GroupBoxStyle == Telerik.WinControls.UI.RadGroupBoxStyle.Standard)
{
radGroupBox1.GroupBoxStyle = Telerik.WinControls.UI.RadGroupBoxStyle.Office;
this
.radGroupBox1.GroupBoxElement.Header.Fill.BackColor = Color.Aqua;
}
else
{
radGroupBox1.GroupBoxStyle = Telerik.WinControls.UI.RadGroupBoxStyle.Standard;
this
.radGroupBox1.GroupBoxElement.Header.Fill.BackColor = Color.Gray;
}
}
If you have any questions, please do not hesitate to contact us.
Dimitar
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.
0
Jason
Top achievements
Rank 1
answered on 27 Mar 2014, 08:36 AM
OK, I've managed to come up with something that does the job, using a custom control inherited from the RadGroupBox
However, is there a way to hook into the action of when the groupboxstyle changes, so I make the relevant changes to the appearance?
Cheers
However, is there a way to hook into the action of when the groupboxstyle changes, so I make the relevant changes to the appearance?
Cheers
0
Accepted
Hello Jason,
Thank you for writing.
You can use the RadPropertyChanged event of the header to determine that GroupBoxStyle property is changed:
You can subscribe to this event with the following line of code:
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Thank you for writing.
You can use the RadPropertyChanged event of the header to determine that GroupBoxStyle property is changed:
void
Header_RadPropertyChanged(
object
sender, Telerik.WinControls.RadPropertyChangedEventArgs e)
{
if
(e.Property.Name ==
"GroupBoxStyle"
)
{
if
((
string
)e.NewValue ==
"Standard"
)
{
this
.radGroupBox1.GroupBoxElement.Header.Fill.BackColor = Color.Aqua;
}
else
{
this
.radGroupBox1.GroupBoxElement.Header.Fill.BackColor = Color.Gray;
}
}
}
You can subscribe to this event with the following line of code:
radGroupBox1.GroupBoxElement.Header.RadPropertyChanged += Header_RadPropertyChanged;
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.
0
Jason
Top achievements
Rank 1
answered on 31 Mar 2014, 07:33 AM
Thanks. Works like a charm