Making use of the .ToHTML method this is possible. But since the same functionality is to be replicated across the application may be a custom control would be appropriate.
Does anyone has any sample to head start on creating a custom control for RadGridView.
10 Answers, 1 is accepted
Why not just use UserControl?
Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Also I wanted to make use of the strong binding that the grid view supports.
public class SampleControl : RadGridView |
{ |
static SampleControl() |
{ |
DefaultStyleKeyProperty.OverrideMetadata(typeof(SampleControl), new FrameworkPropertyMetadata(typeof(SampleControl))); |
} |
[assembly: ThemeInfo( |
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located |
//(used if a resource is not found in the page, |
// or application resource dictionaries) |
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located |
//(used if a resource is not found in the page, |
// app, or any theme specific resource dictionaries) |
)] |
If anyone can respond that would be great help as we are transitioning from planning to execution stage.
Thank you
Internally we are setting the DefaultStyleKey in Initialized method in order for our teams to work correctly. This is the reason why your code is not working.
Have you considered a custom style for the grid instead of deriving from it? In this custom style you can add an attached behavior which adds the button for exporting. Here is a blog post which illustrates how to implement similar functionality with a button in the header.
Greetings,
Stefan Dobrev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I need to build custom control inheriting from RadGridView (WPF). I need to set the defaultstylekey for the custom Grid for lots of functalities to be done over the radgridview control.
I have used below code snippet to override the OnInitialized.
protected
override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
DefaultStyleKeyProperty.OverrideMetadata(typeof(iGrid),new FrameworkPropertyMetadata(typeof(iGrid)));
}
But my style's applied in RadGridView Xaml's is not gettng applied.
I have changed radgrid's template , scrollview template, etc.. it need to be resembled.. and those xaml's are routed in Generic.Xaml.
Do you have a static constructor that overrides DefaultStyleKey property? If this doesn't help I need a sample project which I can debug on my side to see what's going on.
Thank you in advance.
P.S. You have to open a separate support ticket in order to be able to attach files.
Nedyalko Nikolov
the Telerik team
currently i try to adapt my program from Q1 2011 to Q3 2012. now i've got the exact same problem (style does not load anymore) with my derived radgridview. i am calling
DefaultStyleKeyProperty.OverrideMetadata(typeof(xxx), new FrameworkPropertyMetadata(typeof(xxx)));
from my static constructor.
Could anyone please help me?
Best Regards,
Thomas
We've added some new features to our theme mechanism (like possibility to build assemblies with no xaml - in order to get smaller libraries (dlls)). Generally the principles are the same you should have similar code in your static constructor and OnInitialized() method:
static
RadGridView()
{
DefaultStyleKeyProperty.OverrideMetadata(
typeof
(RadGridView),
new
FrameworkPropertyMetadata(
typeof
(RadGridView)));
}
protected
override
void
OnInitialized(EventArgs e)
{
base
.OnInitialized(e);
Telerik.Windows.Controls.StyleManager.SetDefaultStyleKey(
this
,
typeof
(RadGridView));
}
If this does not help could you please send me a small sample project (in a separate support ticket) that I can debug on my side in order to see what is going on?
Thank you in advance. Greetings,
Nedyalko Nikolov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.