How do ListViews remember their items?

  • Thread starter Thread starter Charles Jenkins
  • Start date Start date
C

Charles Jenkins

I would like to make a new control which encapsulates
System.Windows.Forms.ListView, but when I do, the new control can never
remember any items that add to the list in the Visual Studio Designer.

How does the regular ListView remember its items?

I have a book which seems to suggest that you add the attribute
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
to properties which represent collections of complex objects, but that
attribute seems to be unavailable in the .NET Compact Framework 2.0

What else might I try?

Thanks!
 
@TK2MSFTNGP04.phx.gbl:

Alex, thank you ever so much!!!

After weeks of research with Google and MSDN, the article you pointed me to
was the first thing to describe something that would actually work in the
Compact Framework!

You are a lifesaver!

---------------------------------------

PS: For anyone else trying to develop custom controls in VS 2005, here is a
big secret:

If you add DesignTimeAttributes to a UserControl that is used on any forms
elsewhere in your Solution, you may find that the Designer blows up with an
extremly unhelpful, spurious error message the next time you try to view
that form. Even Cleaning and Rebuilding the solution won't help. Apparently
there is some kind of cache left behind even when you Clean and Rebuild,
and the Designer attempts to use the new version of your control in
combination with its memory of the old version.

Here's a procedure that works for me to make the forms designable again:

1. Add the DesignTimeAttributes in the Class Diagram.
2. Save All.
3. Clean the Solution.
4. Quit VS 2005.
5. Start VS 2005.
6. Rebuild the Solution.
7. Quit VS 2005.
8. Start VS 2005.
9. Try to view the offending form in the Designer. If there are no real
problems with the form, it should appear properly now.
 
Back
Top