Skip to content

Commit

Permalink
Example code for Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Nov 20, 2024
1 parent 7c7a7e2 commit efc46b5
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d">
<ikw:SimpleStackPanel>
<local:ControlExample HeaderText="A simple Menu">
<local:ControlExample x:Name="Example1" HeaderText="A simple Menu">
<Menu>
<MenuItem Header="File">
<MenuItem Header="New" />
Expand All @@ -30,7 +30,7 @@
</MenuItem>
</Menu>
</local:ControlExample>
<local:ControlExample HeaderText="Menu with input gesture texts">
<local:ControlExample x:Name="Example2" HeaderText="Menu with input gesture texts">
<Menu>
<MenuItem Header="File">
<MenuItem Header="New" InputGestureText="Ctrl+N" />
Expand All @@ -51,7 +51,7 @@
</MenuItem>
</Menu>
</local:ControlExample>
<local:ControlExample HeaderText="Menu with submenus, seperators, and radio items">
<local:ControlExample x:Name="Example3" HeaderText="Menu with submenus, seperators, and radio items">
<Menu>
<MenuItem Header="File">
<MenuItem Header="New">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,106 @@ public partial class MenuPage
public MenuPage()
{
InitializeComponent();
UpdateExampleCode();
}

#region Example Code

public void UpdateExampleCode()
{

Example1.Xaml = Example1Xaml;
Example2.Xaml = Example2Xaml;
Example3.Xaml = Example3Xaml;
}

#endregion

public string Example1Xaml => $@"
<Menu>
<MenuItem Header=""File"">
<MenuItem Header=""New"" />
<MenuItem Header=""Open..."" />
<MenuItem Header=""Save"" />
<MenuItem Header=""Exit"" />
</MenuItem>
<MenuItem Header=""Edit"">
<MenuItem Header=""Undo"" />
<MenuItem Header=""Cut"" />
<MenuItem Header=""Copy"" />
<MenuItem Header=""Paste"" />
</MenuItem>
<MenuItem Header=""Help"">
<MenuItem Header=""About"" />
</MenuItem>
</Menu>
";

public string Example2Xaml => $@"
<Menu>
<MenuItem Header=""File"">
<MenuItem Header=""New"" InputGestureText=""Ctrl+N"" />
<MenuItem Header=""Open..."" InputGestureText=""Ctrl+O"" />
<MenuItem Header=""Save"" InputGestureText=""Ctrl+S"" />
<MenuItem Header=""Exit"" InputGestureText=""Ctrl+E"" />
</MenuItem>
<MenuItem Header=""Edit"">
<MenuItem Header=""Undo"" InputGestureText=""Ctrl+Z"" />
<MenuItem Header=""Cut"" InputGestureText=""Ctrl+X"" />
<MenuItem Header=""Copy"" InputGestureText=""Ctrl+C"" />
<MenuItem Header=""Paste"" InputGestureText=""Ctrl+V"" />
</MenuItem>
<MenuItem Header=""Help"">
<MenuItem Header=""About"" InputGestureText=""Ctrl+I"" />
</MenuItem>
</Menu>
";

public string Example3Xaml => $@"
<Menu>
<MenuItem Header=""File"">
<MenuItem Header=""New"">
<MenuItem Header=""Plain Text Document"" />
<MenuItem Header=""Rich Text Document"" />
<MenuItem Header=""Other Formats..."" />
</MenuItem>
<MenuItem Header=""Open..."" />
<MenuItem Header=""Save"" />
<Separator />
<MenuItem Header=""Exit"" />
</MenuItem>
<MenuItem Header=""Edit"">
<MenuItem Header=""Undo"" />
<MenuItem Header=""Cut"" />
<MenuItem Header=""Copy"" />
<MenuItem Header=""Paste"" />
</MenuItem>
<MenuItem Header=""View"">
<MenuItem Header=""Output"" />
<Separator />
<ui:RadioMenuItem GroupName=""OrientationGroup"" Header=""Landscape"" />
<ui:RadioMenuItem
GroupName=""OrientationGroup""
Header=""Portrait""
IsChecked=""True"" />
<Separator />
<ui:RadioMenuItem GroupName=""SizeGroup"" Header=""Small icons"" />
<ui:RadioMenuItem
GroupName=""SizeGroup""
Header=""Medium icons""
IsChecked=""True"" />
<ui:RadioMenuItem GroupName=""SizeGroup"" Header=""Large icons"" />
</MenuItem>
<MenuItem Header=""Help"">
<MenuItem Header=""About"" />
</MenuItem>
</Menu>
";
}
}

0 comments on commit efc46b5

Please sign in to comment.