Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User custom controls
Message
De
19/02/2004 15:42:38
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00878331
Message ID:
00878925
Vues:
15
Clay,

>I created a custom control consisting of a textbox and DateTimePicker, how can I access the members (BindingFlag, BindingSource and BindingMember) through the IDE? Can I only change the properties of these embedded controls via code?

>In Fox, right-click and edit allowed you access to components of composite control, what is the .NET equivalent?

VS.Net doesn't give us that ability like VFP did. The entire custom control is one type on your form, unlike VFP's style. So, you'll need to add "wrapper" properties onto your custom control to access the properties of the internal controls. I had to do this when getting Component One's DateTime picker control to work with MM.Net.

This should work:

1. Add the following properties to your user control:
/// <summary>
/// Binding flag property
/// </summary>
[Browsable(true), Category("Data"), 
Description("Specifies if the control is automatically bound."),
DefaultValue(true)]
public bool BindingFlag
{
	get
	{
		return this.TextBox.BindingfFlag
	}
	set
	{
		this.TextBox.BindingfFlag = value;
	}
}

/// <summary>
/// Binding source property
/// </summary>
[Browsable(true), Category("Data"), 
Description("The source business object member to bind this control."),
Editor(typeof(mmBindingSourceTypeEditor), typeof(UITypeEditor)),
DefaultValue("")]
public string BindingSource
{
	get
	{
		return this.TextBox.BindingSource;
	}
	set
	{
		this.TextBox.BindingSource = value;
	}
}

/// <summary>
/// Binding source member property
/// </summary>
[Browsable(true), Category("Data"), 
Description("The source business object member to bind this control."),
Editor(typeof(mmBindingSourceMemberTypeEditor), typeof(UITypeEditor)),
DefaultValue("")]
public string BindingSourceMember
{
	get
	{
		return this.TextBox.BindingSourceMember;
	}
	set
	{
		this.TextBox.BindingSourceMember = value;
	}
}

/// <summary>
/// Binding Property property
/// </summary>
[Browsable(true), Category("Data"), 
Description("The control property to data bind."),
DefaultValue("CodeKeyID")]
public string BindingProperty
{
	get
	{
		return this.TextBox.BindingProperty;
	}
	set
	{
		this.TextBox.BindingProperty = value;
	}
}
You'll need to add System.ComponentModel and OakLeaf.MM.Main.Builders to the using statements at the top of your code.

I've changed some object names in this posted code, so you'll need to check that out on your end. Also, this only exposes the binding properties of one of your internal controls. Either the list box or the date picker. Also, you might need to tweek it a little more to get it to work smoothly with MM.Net's data binding strategy. We ended up using a hack on our custom user controls to get them binding with the MM.Net biz objs, but I think you should be able to get this to work.

Hope this helps.

-Nate
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform