Saturday, February 14, 2015

How to create a ribbon menu with LinsUIWPF Suite

Download   Demonstration  Question?   Contact Us

1.     Follow the link How to create a new project to create your project with LinsUIWPF Suite.
2.     Highlight “MyDemo” project folder, and Project->New Folder to create a new folder named “Icons”.
3.     Project->Add Existing Item …, and select icons to add them into the “Icons” folder.
4.     Project->Add New Item …, it should bring up the following dialog.

Choose “WPF” as Category and “User Control (WPF)” as Template. Use “MyRibbonMenu” as the class name. Click “Add” button.
5.     Open MyRibbonMenu.xaml. Change the following code,
<UserControl x:Class="MyDemo.MyRibbonMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300">
<Grid>
           
</Grid>
</UserControl>
to as follows, and assign a unique ID to it. The unique ID is for layout persistent. It should be between 1,000 and 10,000,000.
<src:FlexRibbonMenu x:Class="MyDemo.MyRibbonMenu "
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:src="clr-namespace:LinsUIWPF;assembly=LinsUIWPF"
Height="300" Width="300" ID="1003">
<Grid>
            
</Grid>
</src:FlexRibbonMenu>
6.     Open MyRibbonMenu.xaml.cs.
Add the following line,
using LinsUIWPF;
and change the following code,
public partial class MyRibbonMenu : UserControl
{
public MyRibbonMenu()
{
InitializeComponent();
}
}
to as follows,
public partial class MyRibbonMenuFlexRibbonMenu
{
public MyRibbonMenu()
{
InitializeComponent();
}
}
7.     Close MyRibbonMenu.xaml, then reopen it again, the screen should show the following,
8.     Click the combo box; it will pop up the list,
9.     Select “Add a tab”, and then click and select the new created tab,
10.  Go to Properties panel.  Choose an icon, and enter for “Text”, “ToolTipText”, and “HelpContext”. Assign a unique ID to it
11.  Click the combo box; it will pop up the list, select “Add a category”
12.  Select the new created category.
13.  Go to Properties panel and enter a string for “Text”.
14.  Click the combo box; it will pop up the list, select “Add a strip”
15.  Select the new created strip.
16.  Go to Properties panel and select VERTICAL for “Alignment
17.  Click the combo box; it will pop up the list, select “Add a button”
18.  Select the new created button.
19.  Go to Properties panel.  Choose an icon, and enter for “Text”, “ToolTipText”, and “HelpContext”. Assign a unique ID to it
20.  Continue to add items.
21.  Open Window1.xaml.cs.
Add the following code, to create and assign the ribbon menu to the application, a FlexDocument object, or a FlexPanel object.
public partial class Window1 : LinsMDIWindow
{
public Window1()
{
InitializeComponent();

MyRibbonMenu myRibbonMenu = new MyRibbonMenu();
myRibbonMenu.ShowMenu();
this.MainRibbonMenu = myRibbonMenu;
}
}


References:
Command,
Command Events,
Commands Manager,
FlexRibbonMenu,
Features,
How To,
Index,
Instruction,
LinsUIWPFDockingManager,
Tool Items Manager








No comments:

Post a Comment