Re: ListView in a UserControl
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 10 Aug 2006 10:12:05 -0400
Laurent,
Two things first. One, your property should be public, otherwise, I
don't know how the designer is going to be able to access it.
Two, when you make it public, you will want to name it MyColumns, as per
the public naming convention.
That being said, you need to attach the following attributes to your
MyColumns property:
[MergableProperty(false), Localizable(true),
DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor("System.Windows.Forms.Design.ColumnHeaderCollectionEditor,
System.Design, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor)),
SRDescription("ListViewColumnsDescr")]
This will enable the property window to help with designing your
columns.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Laurent Navarro" <yop@xxxxxxx> wrote in message
news:uMve5TIvGHA.4160@xxxxxxxxxxxxxxxxxxxxxxx
Hello,
I'm creating a control including a listview. I would like to be able to
set the columns through the Design Tool in Visual Studio, so I created a
parameter to access the columns of my listview:
private ListView.ColumnHeaderCollection myColumns
{
get
{
return(this.myListView.Columns);
}
set
{
this.myListView.Columns.Clear();
foreach(ColumnsHeader column in value)
{
this.myListView.Columns.add(column);
}
}
Of course this is not working, I can insert my columns in the designer,
but when I launch my application, the collection is empty. I'm sure what I
did is dirty, but I don't know what to do... If someone has a clue...
Thank !
Laurent
.
- Follow-Ups:
- Re: ListView in a UserControl
- From: Laurent Navarro
- Re: ListView in a UserControl
- References:
- ListView in a UserControl
- From: Laurent Navarro
- ListView in a UserControl
- Prev by Date: Re: way to check values before Initialisation
- Next by Date: Re: Saving Class Object Properties in a UserControl
- Previous by thread: ListView in a UserControl
- Next by thread: Re: ListView in a UserControl
- Index(es):
Relevant Pages
|
Loading