Click or drag to resize

BcfHierarchicalViewManagerAddRootBindingSourceTBindingSource Method

[This is preliminary documentation and is subject to change.]

Creates and registers a new binding source.

Namespace:  CalculationWorks.ViewModel.Forms
Assembly:  CalculationWorks.ViewModel.Forms (in CalculationWorks.ViewModel.Forms.dll) Version: 4.0.0-beta7
Syntax
protected TBindingSource AddRootBindingSource<TBindingSource>(
	string name,
	BcfTable table,
	Func<BcfBindingSourceBuilder, TBindingSource> createBindingSource
)
where TBindingSource : BcfBindingSource

Parameters

name
Type: SystemString
The name.
table
Type: CalculationWorks.BusinessModelBcfTable
The table.
createBindingSource
Type: SystemFuncBcfBindingSourceBuilder, TBindingSource
TBindingSource constructor.

Type Parameters

TBindingSource
The type of the binding source.

Return Value

Type: TBindingSource
TBindingSource.
Exceptions
ExceptionCondition
ArgumentNullExceptionAny parameter is null
ArgumentExceptionSpecified table is not managed by this view-manager.
ArgumentExceptionname is not unique
Remarks
Note Note
Use a custom binding-source class inheriting BcfBindingSource.
Examples
Add BindingSources
[ToolboxItem(true)]
public partial class MyViewManager 
{

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public BcfBindingSource MasterBindingSource { get; set; }
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    public BcfBindingSource DetailBindingSource { get; set; }

    public override void InitializeBindingSources() 
    {
        MasterBindingSource = AddRootBindingSource("Master", DataSet.MasterTable, (b) => new BcfBindingSource(b));
        DetailBindingSource = AddBranchBindingSource("Detail", MasterBindingSource, DataSet.MasterToDetailRelation, b => new BcfBindingSource(b));
    }
}
See Also