Binding Controls
- We can create a relationship between several controls and another control, so that when that control's visibility expression is changed, all the visibility of all the controls that are bound to that control will change accordingly.
- In this video we demo this behavior in magic, and demo how to achieve the same result in .NET
- Add a new UIContorller "DemoBoundControls"
- We'll add a new local
BoolColumn
called "ShowGroupBox", we'll use it later as the visible expression of the GroupBox
public class DemoBoundContorls : UIContorllerBase
{
public readonly BoolColumn ShowGroupBox = new BoolColumn("Show Group Box");
...
}
- We'll add the "ShowGroupBox" column to the View
- We'll add a GroupBox and two labels to the View, and place one Label inside the GroupBox and another outside.
- To bind the labels to the GroupBox, we'll go to the "Properties" window and select the
BoundTo
Property, in it we can selectgroupBox1
as the bound toControl
.
- We'll bind the visibility of the
groupBox1
to the "ShowGroupBox" column using theBindVisibile
event in the "events" tab of the "Properties" window
private void groupBox1_BindVisible(object sender, BooleanBindingEventArgs e)
{
e.Value = _controller.ShowGroupBox;
}
- See how the visibility of the labels change together with the visibility of the GroupBox
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com