How to Bind Configuration Manager Data to a Form
In Configuration Manager, to bind Configuration Manager console data to a property sheet, you use the
DataBindings property of the property sheet's control class.
DataBindings property is used to bind to the objects in the form's
Property Manager. After an object changes, mark the object as changed with SetDirtyFlag. This ensures that the object is serialized properly when the dialog box is dismissed.
To bind Configuration Manager data to a form
If the Configuration Manager console is open, close it.
In Visual Studio 2010, open the project you created in How to Create a Configuration Manager Property Sheet.
In Solution Explorer, right-click ConfigMgrControl.cs, and then click View Designer.
In the Toolbox, click the Common Controls tab, and then double-click TextBox. A field named textBox1 is added to your control on the User Control Designer.
In Solution Explorer, right-click ConfigMgrControl.cs, and then click View Source.
Add the following code to the
textBox1.DataBindings.Add("Text", PropertyManager["Name"], "StringValue");
In Solution Explorer, right-click ConfigMgrPropertySheet.cs, and then click View Designer.
Double-click the text box you added. A new event handler,
TextChanged, is created.
In textBox1_TextChanged, add the following code to set the dirty flag when text is changed:
Dirty = true;
Build the project and copy the assembly to %ProgramFiles%\Microsoft Endpoint Manager\AdminConsole\bin.
Open the Configuration Manager console, and navigate to the Packages node under Software Distribution.
Right-click a package, and then click Show My Property Sheet.
In the property sheet that is displayed, the text box displays the name of the selected package.
Type a new name for the package, and then click OK.
In the Configuration Manager console results pane, the package name is changed to the name you entered.