This is a migrated thread and some comments may be shown as answers.

Deriving from RadGridView

1 Answer 123 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 2
Aaron asked on 31 Mar 2015, 04:16 PM
My RadGridView instances always have several properties that are set exactly the same way. Something like this:

<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

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 01 Apr 2015, 01:39 PM
Hi Aaron,

Is this the only error you get? Does it compile fine if you remove the following line:
<local:MyGridView >...</local:MyGridView>

If so, then would you please share if you use the full binaries, or NoXaml ones?

Regards,
Dimitrina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
GridView
Asked by
Aaron
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Share this question
or