Download Demonstration Question? Contact Us
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 “MyMenu” as the class name. Click “Add” button.
5. Open MyMenu.xaml. Change the following code,
<UserControl x:Class="MyDemo.MyMenu"
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:FlexMenu x:Class="MyDemo.MyMenu "
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:FlexMenu>
6. Open MyMenu.xaml.cs.
Add the following line,
using LinsUIWPF;
and change the following code,
public partial class MyMenu : UserControl
{
public MyMenu()
{
InitializeComponent();
}
}
to as follows,
public partial class MyMenu: FlexMenu
{
public MyMenu()
{
InitializeComponent();
}
}
7. Close MyMenu.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 menuitem”, and then click and select the new created menu item,
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 menuitem”
12. Select the new created menu item.
13. Go to Properties panel. Choose an icon, and enter for “Text”, “ToolTipText”, and “HelpContext”. Assign a unique ID to it
14. Continue to add items
15. Open Window1.xaml.cs.
Add the following code, to create and assign the menu to the application, a FlexDocument object, or a FlexPanel object.
public partial class Window1 : LinsMDIWindow
{
public Window1()
{
InitializeComponent();
MyMenu myMenu = new MyMenu();
myMenu.ShowMenu();
this.MainMenu = myMenu;
}
}
References:
No comments:
Post a Comment