My RadGridView instances always have several properties that are set exactly the same way. Something like this:
So I thought, why not derive from this control and set those properties in the constructor? I wrote this class that extends RadGridView:
Okay, so using this should be as simple as this:
It won't compile. I get an error that says "The name 'MyGridView' does not exist in the namespace 'clr-namespace:MyUI'".
I've tried declaring the namespace with and without the "assembly=MyUI" part.
What am I doing wrong here?
Thanks.
Aaron
<
telerik:RadGridView
RowIndicatorVisibility
=
"Collapsed"
AllowDrop
=
"False"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
CanUserReorderColumns
=
"False"
GridLinesVisibility
=
"Both"
ShowGroupPanel
=
"False"
ShowColumnHeaders
=
"True"
IsFilteringAllowed
=
"False"
CanUserFreezeColumns
=
"False"
CanUserInsertRows
=
"False"
>...</
telerik:RadGridView
>
So I thought, why not derive from this control and set those properties in the constructor? I wrote this class that extends RadGridView:
namespace
MyUI
{
public
class
MyGridView : Telerik.Windows.Controls.RadGridView
{
public
MyGridView()
:
base
()
{
this
.RowIndicatorVisibility = System.Windows.Visibility.Collapsed;
this
.AllowDrop =
false
;
this
.AutoGenerateColumns =
false
;
this
.CanUserDeleteRows =
false
;
this
.CanUserReorderColumns =
false
;
this
.GridLinesVisibility = Telerik.Windows.Controls.GridView.GridLinesVisibility.Both;
this
.ShowGroupPanel =
false
;
this
.ShowColumnHeaders =
true
;
this
.IsFilteringAllowed =
false
;
this
.CanUserFreezeColumns =
false
;
this
.CanUserInsertRows =
false
;
}
}
}
Okay, so using this should be as simple as this:
<
Window
...
xmlns:local
=
"clr-namespace:MyUI;assembly=MyUI"
>
<
local:MyGridView
>...</
local:MyGridView
>
</
Window
>
It won't compile. I get an error that says "The name 'MyGridView' does not exist in the namespace 'clr-namespace:MyUI'".
I've tried declaring the namespace with and without the "assembly=MyUI" part.
What am I doing wrong here?
Thanks.
Aaron