Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to make property visible in Visual studio designer?
 

How to make property visible in Visual studio designer?

I have a property of type IBindableQuery (http://bindablelinq.codeplex.com/).

I want to bind that property to a control on windows form using Visual Studio 2008 designer.

But I can’t see the property In designer.


Whatpropertytype is visible infield DataMember onBindingSource control in thewindows form deginer?

  • Moved bynobugzMVP, ModeratorTuesday, June 09, 2009 5:21 PMdesigner q (From:.NET Base Class Library)
  •  
JNikolov  Tuesday, June 09, 2009 1:53 PM

Hi JNikolov,

Let's say the class that contains the property of type IBindableQuery is MyClass. To get what you want, the MyClass class should derives from the Component type and implement the IListSource interface. When implementing the GetList method of the IListSource interface, return a list that contains the current instance of the MyClass itself. The following is a sample:

public class MyClass: Component, IListSource
{
public MyClass() { }

public MyClass(IContainer container)
{
container.Add(this);
}

privateIBindableQuery bindableQuery;
publicIBindableQueryBindableQuery
{
get { return bindableQuery; }
}


#region IListSource Members

bool IListSource.ContainsListCollection
{
get { return true; }
}
System.Collections.IList IListSource.GetList()
{
List<MyClass> list = new List<MyClass>();
list.Add(this);
return list;
}

#endregion
}

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu


Please remember to mark the replies as answers if they help and unmark them if they provide no help. Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
Linda Liu  Wednesday, June 17, 2009 9:07 AM

Hi JNikolov,

Let's say the class that contains the property of type IBindableQuery is MyClass. To get what you want, the MyClass class should derives from the Component type and implement the IListSource interface. When implementing the GetList method of the IListSource interface, return a list that contains the current instance of the MyClass itself. The following is a sample:

public class MyClass: Component, IListSource
{
public MyClass() { }

public MyClass(IContainer container)
{
container.Add(this);
}

privateIBindableQuery bindableQuery;
publicIBindableQueryBindableQuery
{
get { return bindableQuery; }
}


#region IListSource Members

bool IListSource.ContainsListCollection
{
get { return true; }
}
System.Collections.IList IListSource.GetList()
{
List<MyClass> list = new List<MyClass>();
list.Add(this);
return list;
}

#endregion
}

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu


Please remember to mark the replies as answers if they help and unmark them if they provide no help. Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
Linda Liu  Wednesday, June 17, 2009 9:07 AM

You can use google to search for other answers

Custom Search

More Threads

• Implementing IButtonControl
• how to set a format for date
• Bug in Forms Designer
• Alter GridSize for DesignSurface
• Extender and Panel
• lost with glyph, adorner and behaviorservice,...
• "Window class name not valid" error in designer
• IEventHandlerService, IMouseHandler
• Design time only data
• How to manipulate cells in a TableLayoutPanel