Your navigable business objects should be represented according to the master-detail pattern , as in the following example:
This combination of the fold-out window and the detail area is implemented with the control element VBDockingManager . The docking manager basically shows two designs:
Master (Explorer):
<vb:VBDataGrid VBContent="SelectedMaterial" DisabledModes="Disabled">
<DataGrid.Columns>
<vb:VBDataGridTextColumn VBContent="MaterialNo" />
<vb:VBDataGridTextColumn VBContent="MaterialName1" />
</DataGrid.Columns>
</vb:VBDataGrid>
The SelectedMaterial property specified in VBContent must be defined in your business object:
[ACPropertySelected(302, Material.ClassName, "en{'Material'}de{'Material'}")]
public Material SelectedMaterial
{
get
{
if (AccessPrimary == null)
return null;
return AccessPrimary.Selected;
}
set
{
if (AccessPrimary == null)
return;
AccessPrimary.Selected = value;
OnPropertyChanged("SelectedMaterial");
}
}
The VBDataGrid implemented by IVBSource can automatically bind the matching data collection because both have been identified with the same group name in the ACPropertySelected and ACPropertyList .public IList<Material> MaterialList
Material.ClassName
The Selected property works internally with the Selected property of the ACAccessNav <T> class . This is necessary so that the navigation buttons in the menu ribbon can be used to navigate from the current position (see next section).
Detail:
<vb:VBGrid>
<Grid.ColumnDefinitions>
<ColumnDefinition MaxWidth="600"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<vb:VBTextBox Grid.Column="0" Grid.Row="0" VBContent="CurrentMaterial\MaterialNo" />
<vb:VBTextBox Grid.Column="0" Grid.Row="1" VBContent="CurrentMaterial\MaterialName1" />
</vb:VBGrid>
A property with the name CurrentMaterial was addressed in the VBContent .
Now you will be asking yourself, "Why not the SelectedMaterial ?".
The answer is: yes you can of course use the SelectedMaterial. The Current property , which by the way is provided with the attribute class ACPropertyCurrent , is an optional possibility to separate the selected line in an ItemsControl (e.g. Datagrid) from the displayed object in the detail area. For example, if you want to navigate further without changing the detail area. This is a special case , but in this example it is mentioned for the sake of completeness.
However , to keep both the Selected and Current properties in sync , use the AccessPrimary.Current property:
[ACPropertyCurrent(301, Material.ClassName, "en{'Material'}de{'Material'}")]
public Material CurrentMaterial
{
get
{
if (AccessPrimary == null)
return null;
return AccessPrimary.Current;
}
set
{
if (AccessPrimary == null)
return;
AccessPrimary.Current= value;
OnPropertyChanged("CurrentMaterial");
}
}
Master-detail in lower levels
In the case of hierarchical data structures, you should continue the master-detail principle. We recommend using the docking mechanism here as well. The list should always be on the left and the details area on the right.
The following example shows a production order from "iPlus MES". A three-level data hierarchy is shown here, in which the master-detail pattern is applied recursively:
Take a look at the BSOInOrder.cs business object from the sample project . A two-level hierarchy is implemented there.