From c79352a92f6b99a6641f7ae1403d9d7ed5c09c77 Mon Sep 17 00:00:00 2001 From: eriklimakc Date: Mon, 18 Dec 2023 11:44:50 +0000 Subject: [PATCH 1/8] docs: Adding csharp markup code examples --- doc/material-controls-extensions.md | 116 ++++++++++++++++++++--- doc/material-getting-started.md | 138 +++++++++++++++++++++------- 2 files changed, 208 insertions(+), 46 deletions(-) diff --git a/doc/material-controls-extensions.md b/doc/material-controls-extensions.md index 15ae35018..d769275dc 100644 --- a/doc/material-controls-extensions.md +++ b/doc/material-controls-extensions.md @@ -4,14 +4,18 @@ uid: Uno.Themes.Material.Extensions # Material Control Extensions +> [!NOTE] +> Uno Material also has support for C# Markup through a [Uno.Material.WinUI.Markup](https://www.nuget.org/packages/Uno.Material.WinUI.Markup) NuGet Package. To get started with Uno Material in your C# Markup application, add the `Uno.Material.WinUI.Markup` NuGet package to your **App Code Library** project and your platform heads. + ## Icon -This feature allows for the addition of icon on the supported controls. Those icons could be any of the [`IconElement`](https://docs.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.iconelement)s: ``, ``, `` or ``. +This feature allows for the addition of icon on the supported controls. Those icons could be any of the [`IconElement`](https://docs.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.iconelement)s: `BitmapIcon`, `FontIcon`, `PathIcon` or `SymbolIcon`. Here are supported control with samples: * TextBox: +# [**XAML**](#tab/xaml) ```xml @@ -20,8 +24,23 @@ Here are supported control with samples: ``` +# [**C#**](#tab/csharp) + ```csharp + new TextBox() + .Style(Theme.TextBox.Styles.Filled) + .ControlExtensions + ( + icon: + new SymbolIcon() + .Symbol(Symbol.SolidStar) + ) + ``` + +*** + * ComboBox: +# [**XAML**](#tab/xaml) ```xml @@ -30,6 +49,19 @@ Here are supported control with samples: ``` +# [**C#**](#tab/csharp) + ```csharp + new ComboBox() + .Style(Theme.ComboBox.Styles.Default) + .ControlExtensions + ( + icon: + new SymbolIcon() + .Symbol(Symbol.SolidStar) + ) + ``` +*** + ## Alternate Content This feature allows putting different content on a control when the state changes. @@ -37,17 +69,38 @@ It's control specific and for now, you can only use it with the ToggleButton con ### Alternate Content on ToggleButton -```xml - - - - - - - - - -``` +# [**XAML**](#tab/xaml) + ```xml + + + + + + + + + + ``` + +# [**C#**](#tab/csharp) + ```csharp + new ToggleButton() + .Style(Theme.ToggleButton.Styles.Icon) + // This is the default content - which is when the control state is UNCHECKED (the default value of a ToggleButton) + .Content + ( + new PathIcon() + .Data(StaticResource.Get("Icon_more_horizontal")) + ) + // This is the alternate content - which is when the control state is CHECKED + .ControlExtensions + ( + alternateContent: + new PathIcon() + .Data(StaticResource.Get("Icon_more_vertical")) + ) + ``` +*** ## Elevation @@ -97,6 +150,7 @@ Within the `ControlTemplate` of the `ElevatedButtonStyle`, instead of performing Applying the surface tint for elevated controls is optional and must be explicitly enabled through the use of the `IsTintEnabled` attached property. Below is an example of how an elevated control may appear with or without a surface tint: +# [**XAML**](#tab/xaml) ```xml