Skip to content

Conversation

@erikvilima
Copy link
Contributor

GitHub Issue: #1302

PR Type

What kind of change does this PR introduce?

  • Documentation content changes

Description

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@erikvilima erikvilima self-assigned this Dec 18, 2023
@erikvilima erikvilima marked this pull request as ready for review December 18, 2023 13:21
# 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.
Copy link
Collaborator

@kazo0 kazo0 Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can link back to the Getting Started section that mentions C# Markup with an xref here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huum, I removed the Using C# Markup section from that page, since all the C# Markup code is now integrated in the tabs with the Xaml ones, and added a similar note to that page instead:

> [!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.

Do you think it's better to bring back that section?

@kazo0

</um:ControlExtensions.Icon>
</ComboBox>
```
# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
### [**XAML**](#tab/xaml)

</ComboBox>
```

# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
### [**C#**](#tab/csharp)

.Symbol(Symbol.SolidStar)
)
```
***
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
***
***

</um:ControlExtensions.Icon>
</ComboBox>
```
# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
### [**XAML**](#tab/xaml)

</um:ControlExtensions.Icon>
</ComboBox>
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
### [**C#**](#tab/csharp)

new SymbolIcon()
.Symbol(Symbol.SolidStar)
)
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```


### Alternate Content on ToggleButton

# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
#### [**XAML**](#tab/xaml)

</um:ControlExtensions.AlternateContent>
</ToggleButton>
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
#### [**C#**](#tab/csharp)

new PathIcon()
.Data(StaticResource.Get<Geometry>("Icon_more_vertical"))
)
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```


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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
### [**XAML**](#tab/xaml)

```

The above XAML will produce the following result:
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
### [**C#**](#tab/csharp)

.ControlExtensions(elevation: 5)
.Style(Theme.Button.Styles.Elevated)
)
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```


> [!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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>

3. Install the [`Uno.Material.WinUI`](https://www.nuget.org/packages/Uno.Material.WinUI) for XAML or [`Uno.Material.WinUI.Markup`](https://www.nuget.org/packages/Uno.Material.WinUI.Markup) for C# Markup.
4. Add the following Material resources to `AppResources`:

# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
##### [**XAML**](#tab/xaml)

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
##### [**C#**](#tab/csharp)

new MaterialTheme()));
}
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```

ColorOverrideSource="ms-appx:///PROJECT_NAME/Styles/Application/MaterialColorsOverride.xaml" />
```

# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
#### [**XAML**](#tab/xaml)

</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
#### [**C#**](#tab/csharp)

);
}
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```

}
}
```
***
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
***
***

```
***
4. In `AppResources` file, update `MaterialTheme` with the override from the previous steps:
# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
##### [**XAML**](#tab/xaml)

<MaterialTheme xmlns="using:Uno.Material"
ColorOverrideSource="ms-appx:///PROJECT_NAME/Styles/Application/MaterialColorsOverride.xaml" />
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
##### [**C#**](#tab/csharp)

new MaterialTheme()
.ColorOverrideDictionary(new Styles.ColorPaletteOverride())));
```
***
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
***
***

2. In the application's **App Code Library** project (`PROJECT_NAME.csproj`), add a new Resource Dictionary named `MaterialFontsOverride.xaml` for XAML or a new class inheriting from `ResourceDictionary` named `MaterialFontsOverride.cs` for C# Markup
3. Save the new override file within the **App Code Library**, for example, under `Styles/Application`.
4. Assuming the font file has been placed in the **App Code Library** within, for example, a directory such as `Assets/Fonts/MyCustomFont.ttf`, your override file would look like the following:
# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
#### [**XAML**](#tab/xaml)

<FontFamily x:Key="MaterialRegularFontFamily">ms-appx:///PROJECT_NAME/Assets/Fonts/MyCustomFont-Regular.ttfMyCustomFont</FontFamily>
</ResourceDictionary>
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
#### [**C#**](#tab/csharp)

.Add<FontFamily>("MaterialRegularFontFamily", "ms-appx:///PROJECT_NAME/Assets/Fonts/MyCustomFont-Regular.ttfMyCustomFont"));
}
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```

//optional
new Styles.MaterialFontsOverride()));
5. In `AppResources` file, update `MaterialTheme` with the override from the previous steps:
# [**XAML**](#tab/xaml)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**XAML**](#tab/xaml)
#### [**XAML**](#tab/xaml)

<MaterialTheme xmlns="using:Uno.Material"
FontOverrideSource="ms-appx:///PROJECT_NAME/Styles/Application/MaterialFontsOverride.xaml" />
```
# [**C#**](#tab/csharp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# [**C#**](#tab/csharp)
#### [**C#**](#tab/csharp)

new MaterialTheme()
.FontOverrideDictionary(new Styles.MaterialFontsOverride())));
```
***
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
***
***

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants