21.2.09

When everything is a DependencyProperty, life’s a beach…

When faced with a requirement to automatically generate parts of a modular UI based on events raised by interaction with other controls, the question is normally, how do I position the generate controls in such a way that there is no conflict between my design-time view of the UI and it’s runtime view.

Combining the grid layout and use of DependencyProperty resolves this dilemma

public VanillaLayoutTemplate()
{
InitializeComponent();
PositionGroupControlsInFirstColumn();
}

private void PositionGroupControlsInFirstColumn()
{
CaptureOutComeGroup.SetValue(Grid.ColumnProperty, 0);
ProductServicesGroup.SetValue(Grid.ColumnProperty,0);
}

The CaptureOutComeGroup and ProductServicesGroup represent a hidden control that is positioned in the first column. When the page is rendered, the 2 controls are overlapped and hidden; visibility is managed by the user providing various inputs.

No comments: