Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions Source/BackstageDemo/BackstageDemo.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions Source/BackstageDemo/BackstageDemo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using Krypton.Toolkit;
using Krypton.Ribbon;
using BackstageDemo.UserControls;

namespace BackstageDemo
{
/// <summary>
/// Simple demonstration of the backstage functionality.
/// </summary>
public partial class BackstageDemo : KryptonForm
{
private KryptonRibbon? _ribbon;

public BackstageDemo()
{
InitializeComponent();
SetupBackstageDemo();
}

private void SetupBackstageDemo()
{
// Create ribbon
_ribbon = new KryptonRibbon
{
Dock = DockStyle.Top
};

// Configure backstage via the expandable object
_ribbon.BackstageValues.NavigationWidth = 500; // Custom width - wider for better button display
_ribbon.BackstageValues.AllowNavigationResize = false; // Fixed width
Controls.Add(_ribbon);

// Create a simple tab
var homeTab = new KryptonRibbonTab
{
Text = "Home"
};
_ribbon.RibbonTabs.Add(homeTab);

// Create a group
var demoGroup = new KryptonRibbonGroup
{
TextLine1 = "Demo"
};
homeTab.Groups.Add(demoGroup);

// Create a triple container
var triple = new KryptonRibbonGroupTriple();
demoGroup.Items.Add(triple);

// Create a sample button
var sampleButton = new KryptonRibbonGroupButton
{
TextLine1 = "Sample",
TextLine2 = "Button"
};
triple.Items.Add(sampleButton);

// Set up backstage pages using different approaches
SetupBackstagePages();

// Select the home tab
_ribbon.SelectedTab = homeTab;

// Add instruction label below the ribbon
var instructionLabel = new KryptonLabel
{
Text = "Click the Application Button (top-left) to open the backstage view and explore different page types.",
Location = new Point(20, _ribbon.Height + 20),
Size = new Size(750, 50),
StateCommon = { ShortText = { Font = new Font("Segoe UI", 12F), TextV = PaletteRelativeAlign.Near } }
};
Controls.Add(instructionLabel);

// Add demo content
var demoContentLabel = new KryptonLabel
{
Text = "This demo showcases the Krypton Ribbon Backstage View with multiple page types:\n\n" +
"• Simple text pages (Open, Save)\n" +
"• UserControl pages (New, Settings, Help)\n" +
"• Dynamic page management (Settings page has Add/Remove buttons)\n" +
"• Proper theme integration and designer support\n\n" +
"The backstage overlays the entire form area and provides an Office-style interface.",
Location = new Point(20, _ribbon.Height + 80),
Size = new Size(750, 200),
StateCommon = { ShortText = { Font = new Font("Segoe UI", 11F), TextV = PaletteRelativeAlign.Near } }
};
Controls.Add(demoContentLabel);
}

private void SetupBackstagePages()
{
// EXAMPLE: Different ways to add controls to backstage content area

// Method 1: Simple pages with default content (uses TextTitle/TextDescription)
var openPage = _ribbon.BackstagePages.Add("Open");
openPage.TextTitle = "Open an existing document";
openPage.TextDescription = "Browse for documents on your computer or online locations.";

var savePage = _ribbon.BackstagePages.Add("Save");
savePage.TextTitle = "Save your document";
savePage.TextDescription = "Save your document to your computer or online locations.";

// Method 2: Pages with UserControls (recommended for complex layouts)
var newDocumentUserControl = new NewDocumentPage();
var newPage = _ribbon.BackstagePages.Add("New", newDocumentUserControl);

var settingsUserControl = new SettingsPage();
var settingsPage = _ribbon.BackstagePages.Add("Settings", settingsUserControl);

var helpUserControl = new HelpPage();
var helpPage = _ribbon.BackstagePages.Add("Help", helpUserControl);
}
}
}
18 changes: 18 additions & 0 deletions Source/BackstageDemo/BackstageDemo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
<StartupObject>BackstageDemo.Program</StartupObject>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Krypton Components\Krypton.Toolkit\Krypton.Toolkit 2022.csproj" />
<ProjectReference Include="..\Krypton Components\Krypton.Ribbon\Krypton.Ribbon 2022.csproj" />
</ItemGroup>

</Project>
120 changes: 120 additions & 0 deletions Source/BackstageDemo/BackstageDemo.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
27 changes: 27 additions & 0 deletions Source/BackstageDemo/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.IO;
using System.Windows.Forms;
using Krypton.Toolkit;

namespace BackstageDemo
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

// Set up Krypton theming
var manager = new KryptonManager();
manager.GlobalPaletteMode = PaletteMode.Microsoft365Blue;

using var form = new BackstageDemo();
Application.Run(form);
}
}
}
Loading