A suite of custom WPF controls including:
An example WPF window with a NavigationPanel docked to the left, a MessagePanel docked to the bottom and a XamlFilterTree filling the centre.
The NavigationPanel can be docked to the side of a window, and allows you to switch between views or areas within an application.
-
NavigationPanel - The NavigationPanel contains a list of NavigationPanelItem's, each of which is a logical area within the application.
-
NavigationPanelItem - Each NavigationPanelItem is displayed as a tab in the navigation panel and contains a list of NavigationList's, which groups views within an area of an application.
-
NavigationList - A NavigationList groups lists of views or NavigationListItem's, that can be navigated to.
-
NavigationListItem - A navigable item or view, which when clicked, raises the ItemClickedEvent event and executes the Command.
The following example shows a navigation panel with two main areas within an application, Manage Relationships and User Administration.
- The Manage Relationships tab groups the views for maintaining Customers and Contacts
- The User Administration tab groups the views for managing Users and their Roles.
<navigationPanel:NavigationPanel x:Name="NavigationPanel" DockPanel.Dock="Left" Margin="2">
<navigationPanel:NavigationPanel.NavigationPanelItems>
<navigationPanel:NavigationPanelItem NavigationPanelItemName="Manage Users" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/User_Manage.png">
<navigationPanel:NavigationPanelItem.NavigationList>
<navigationPanel:NavigationList NavigationListName="Users">
<navigationPanel:NavigationList.NavigationListItems>
<navigationPanel:NavigationListItem ItemName="Users" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/User_List.png"/>
<navigationPanel:NavigationListItem ItemName="Add New User" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/User_Add.png"/>
</navigationPanel:NavigationList.NavigationListItems>
</navigationPanel:NavigationList>
<navigationPanel:NavigationList NavigationListName="Roles & Activities">
<navigationPanel:NavigationList.NavigationListItems>
<navigationPanel:NavigationListItem ItemName="Roles" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Roles.png"/>
<navigationPanel:NavigationListItem ItemName="Activities" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Activities.png"/>
</navigationPanel:NavigationList.NavigationListItems>
</navigationPanel:NavigationList>
</navigationPanel:NavigationPanelItem.NavigationList>
</navigationPanel:NavigationPanelItem>
<navigationPanel:NavigationPanelItem NavigationPanelItemName="Customers & Orders" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/customers.png">
<navigationPanel:NavigationPanelItem.NavigationList>
<navigationPanel:NavigationList NavigationListName="Customers">
<navigationPanel:NavigationList.NavigationListItems>
<navigationPanel:NavigationListItem ItemName="Customers" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/CustomerList.png"/>
<navigationPanel:NavigationListItem ItemName="Add New Customer" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/AddNewCustomer.png"/>
</navigationPanel:NavigationList.NavigationListItems>
</navigationPanel:NavigationList>
<navigationPanel:NavigationList NavigationListName="Orders">
<navigationPanel:NavigationList.NavigationListItems>
<navigationPanel:NavigationListItem ItemName="Orders" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Orders.png"/>
<navigationPanel:NavigationListItem ItemName="Place New Order" ItemClicked="NavigationListItem_OnItemClicked" ImageLocation="pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/neworder.png"/>
</navigationPanel:NavigationList.NavigationListItems>
</navigationPanel:NavigationList>
</navigationPanel:NavigationPanelItem.NavigationList>
</navigationPanel:NavigationPanelItem>
</navigationPanel:NavigationPanel.NavigationPanelItems>
</navigationPanel:NavigationPanel>
var manageUsersPanelItem = new NavigationPanelItem();
manageUsersPanelItem.NavigationPanelItemName = "Manage Users";
manageUsersPanelItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/User_Manage.png";
var userAdministrationList = new NavigationList();
userAdministrationList.NavigationListName = "User Administration";
var usersListItem = new NavigationListItem();
usersListItem.ItemName = "Users";
usersListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/User_List.png";
usersListItem.ItemClicked += NavigationListItem_OnItemClicked;
var addNewUserListItem = new NavigationListItem();
addNewUserListItem.ItemName = "Add New User";
addNewUserListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/User_Add.png";
addNewUserListItem.ItemClicked += NavigationListItem_OnItemClicked;
userAdministrationList.NavigationListItems.Add(usersListItem);
userAdministrationList.NavigationListItems.Add(addNewUserListItem);
var rolesAndActivitiesList = new NavigationList();
rolesAndActivitiesList.NavigationListName = "Roles & Activities";
var rolesListItem = new NavigationListItem();
rolesListItem.ItemName = "Roles";
rolesListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Roles.png";
rolesListItem.ItemClicked += NavigationListItem_OnItemClicked;
var activitiesListItem = new NavigationListItem();
activitiesListItem.ItemName = "Activities";
activitiesListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Activities.png";
activitiesListItem.ItemClicked += NavigationListItem_OnItemClicked;
rolesAndActivitiesList.NavigationListItems.Add(rolesListItem);
rolesAndActivitiesList.NavigationListItems.Add(activitiesListItem);
manageUsersPanelItem.NavigationList.Add(userAdministrationList);
manageUsersPanelItem.NavigationList.Add(rolesAndActivitiesList);
var customersAndOrdersPanelItem = new NavigationPanelItem();
customersAndOrdersPanelItem.NavigationPanelItemName = "Customers & Orders";
customersAndOrdersPanelItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Customers.png";
var customerAdministrationList = new NavigationList();
userAdministrationList.NavigationListName = "Customers Administration";
var customersListItem = new NavigationListItem();
customersListItem.ItemName = "Customers";
customersListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Customers_List.png";
customersListItem.ItemClicked += NavigationListItem_OnItemClicked;
var addNewCustomerListItem = new NavigationListItem();
addNewCustomerListItem.ItemName = "Add New Customer";
addNewCustomerListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Add_Customer.png";
addNewCustomerListItem.ItemClicked += NavigationListItem_OnItemClicked;
customerAdministrationList.NavigationListItems.Add(customersListItem);
customerAdministrationList.NavigationListItems.Add(addNewCustomerListItem);
var manageOrdersList = new NavigationList();
manageOrdersList.NavigationListName = "Manage Orders";
var ordersListItem = new NavigationListItem();
ordersListItem.ItemName = "Orders";
ordersListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/Orders.png";
ordersListItem.ItemClicked += NavigationListItem_OnItemClicked;
var newOrderListItem = new NavigationListItem();
newOrderListItem.ItemName = "Place New Order";
newOrderListItem.ImageLocation = @"pack://application:,,,/DevelopmentInProgress.WPFControls.Test;component/Images/neworder.png";
newOrderListItem.ItemClicked += NavigationListItem_OnItemClicked;
manageOrdersList.NavigationListItems.Add(ordersListItem);
manageOrdersList.NavigationListItems.Add(newOrderListItem);
customersAndOrdersPanelItem.NavigationList.Add(customerAdministrationList);
customersAndOrdersPanelItem.NavigationList.Add(manageOrdersList);
NavigationPanel.NavigationPanelItems.Add(manageUsersPanelItem);
NavigationPanel.NavigationPanelItems.Add(customersAndOrdersPanelItem);
Show custom messages in a panel.
<messaging:MessagePanel DockPanel.Dock="Bottom" HeaderText="Information"
Messages="{Binding Messages}"
ClearMessages="{Binding ClearMessages}" Margin="2">
<messaging:MessagePanel.HeaderBackground>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#ECF5FC" Offset="0" />
<GradientStop Color="#98B4D2" Offset="1" />
</LinearGradientBrush>
</messaging:MessagePanel.HeaderBackground>
</messaging:MessagePanel>
var messageError = new Message()
{
MessageType = MessageType.Error,
Text = "The role name is mandatory when creating or saving a role."
};
var messageWarn = new Message()
{
MessageType = MessageType.Warn,
Text = "Cannot create a new role with the name 'Writer' as one already exists."
};
var messageInfo = new Message()
{
MessageType = MessageType.Info,
Text = "User 'Joe Bloggs' has been granted the role 'Writer'."
};
Messages = new ObservableCollection<Message>(new List<Message> { messageError, messageWarn, messageInfo });
Shows messages as a dialog.
var info = new MessageBoxSettings
{
Title = "Grant User Role",
Text = "User 'Joe Bloggs' has been granted the role 'Writer'. Do you wish to continue?",
MessageType = MessageType.Info,
MessageBoxButtons = MessageBoxButtons.OkCancel
};
var infoResult = Dialog.ShowMessage(info);
var warn = new MessageBoxSettings
{
Title = "Create Role",
Text = "A role with the name 'Writer' already exists.\nDo you want to replace it?",
MessageType = MessageType.Warn,
MessageBoxButtons = MessageBoxButtons.YesNoCancel
};
var warnResult = Dialog.ShowMessage(warn);
var question = new MessageBoxSettings
{
Title = "Remove User From Role",
Text = "Do you want to remove user 'Jane Master' from the 'Reviewer' role?",
MessageType = MessageType.Question,
MessageBoxButtons = MessageBoxButtons.YesNo
};
var questionResult = Dialog.ShowMessage(question);
var error = new MessageBoxSettings
{
Title = "Create Role",
Text = "The role name is mandatory when creating or saving a role.",
MessageType = MessageType.Error,
MessageBoxButtons = MessageBoxButtons.Ok
};
Dialog.ShowMessage(error);
Shows exceptions in a dialog.
try
{
int zero = 0;
var result = 1/zero;
}
catch (Exception ex)
{
Dialog.ShowException(ex);
}