-
Notifications
You must be signed in to change notification settings - Fork 17
Added new kb article gradient-header-tabview-dotnet-maui #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
didiyordanova
merged 4 commits into
master
from
new-kb-gradient-header-tabview-dotnet-maui-d547c47d8a8c407b9ff881891aa370ab
Jun 12, 2025
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
81e2302
Added new kb article gradient-header-tabview-dotnet-maui
845f1fa
add another kb article for gradient color for header
didiyordanova 96e1265
Update knowledge-base/gradient-header-tabview-dotnet-maui.md
didiyordanova b491460
Update knowledge-base/gradient-header-tabview-dotnet-maui.md
didiyordanova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
title: Applying Gradient to TabView Header for .NET MAUI | ||
description: Learn how to apply a gradient background to the Header of the TabView component in .NET MAUI. | ||
type: how-to | ||
page_title: Setting Gradient Background for TabView Header in .NET MAUI | ||
slug: gradient-header-tabview-dotnet-maui | ||
tags: tabview,.net maui, header, gradient, tabviewheaderitem | ||
res_type: kb | ||
--- | ||
|
||
## Environment | ||
|
||
| Version | Product | Author | | ||
| --- | --- | ---- | | ||
| 11.0.0 | Telerik UI for .NET MAUI TabView | [Dobrinka Yordanova](https://www.telerik.com/blogs/author/dobrinka-yordanova) | | ||
|
||
## Description | ||
|
||
I want to apply a gradient effect to the entire header of the [TabView]({%slug tabview-overview%}) component in .NET MAUI, not just individual header items. Additionally, I need transparency for the background and border properties of the header items. | ||
|
||
This knowledge base article also answers the following questions: | ||
- How to style TabView header with gradient in .NET MAUI? | ||
- How to use `HeaderTemplate` for TabView in .NET MAUI? | ||
- How to apply transparency to TabView header items in .NET MAUI? | ||
|
||
## Solution | ||
|
||
To achieve a gradient effect for the entire TabView header and apply transparency to the header items, follow these steps: | ||
|
||
1. Define a `LinearGradientBrush` resource for the gradient effect. | ||
2. Create a `ControlTemplate` for the header and use the gradient brush in its background property. | ||
3. Set transparency for header item background and border properties using the `HeaderItemStyle`. | ||
didiyordanova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```xaml | ||
<ContentPage.Resources> | ||
<ResourceDictionary> | ||
<!-- Gradient Brush for Header Background --> | ||
<LinearGradientBrush x:Key="brush" StartPoint="0,0" EndPoint="1,1"> | ||
<GradientStop Color="Blue" Offset="0.0"/> | ||
<GradientStop Color="Blue" Offset="0.4"/> | ||
<GradientStop Color="Red" Offset="0.6"/> | ||
<GradientStop Color="Red" Offset="1.0"/> | ||
</LinearGradientBrush> | ||
|
||
<!-- Header Control Template --> | ||
<ControlTemplate x:Key="TabViewHeaderControlTemplate"> | ||
<telerikMauiControls:RadBorder Background="{StaticResource brush}" | ||
BorderColor="{TemplateBinding BorderColor}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
Padding="{TemplateBinding ContentPadding}" | ||
AutomationId="RadTabViewHeader"> | ||
<ContentPresenter /> | ||
</telerikMauiControls:RadBorder> | ||
</ControlTemplate> | ||
</ResourceDictionary> | ||
</ContentPage.Resources> | ||
|
||
<telerik:RadTabView x:Name="tabView" HeaderTemplate="{StaticResource TabViewHeaderControlTemplate}"> | ||
<!-- Style for Header Items --> | ||
<telerik:RadTabView.HeaderItemStyle> | ||
<Style TargetType="telerik:TabViewHeaderItem"> | ||
<Setter Property="FontAttributes" Value="Italic"/> | ||
<Setter Property="TextColor" Value="#99000000" /> | ||
<Setter Property="Background" Value="Transparent"/> | ||
<Setter Property="BackgroundColor" Value="Transparent"/> | ||
<Setter Property="BorderColor" Value="Transparent"/> | ||
</Style> | ||
</telerik:RadTabView.HeaderItemStyle> | ||
|
||
<!-- Tab Items --> | ||
<telerik:TabViewItem HeaderText="Home"> | ||
<Label Margin="10" Text="This is the content of the Home tab" /> | ||
</telerik:TabViewItem> | ||
<telerik:TabViewItem HeaderText="Folder"> | ||
<Label Margin="10" Text="This is the content of the Folder tab" /> | ||
</telerik:TabViewItem> | ||
<telerik:TabViewItem HeaderText="View"> | ||
<Label Margin="10" Text="This is the content of the View tab" /> | ||
</telerik:TabViewItem> | ||
</telerik:RadTabView> | ||
``` | ||
|
||
## See Also | ||
|
||
- [TabView Documentation]({%slug tabview-overview%}) | ||
- [Applying Gradient to TabView Header Item for .NET MAUI]({%slug gradient-header-item-tabview-dotnet-maui%}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
title: Applying Gradient to TabView Header Item for .NET MAUI | ||
description: Learn how to apply a gradient background to the Header Item of the TabView component in .NET MAUI. | ||
type: how-to | ||
page_title: Setting Gradient Background for TabView Header Item in .NET MAUI | ||
slug: gradient-header-item-tabview-dotnet-maui | ||
tags: tabview,.net maui, header item, gradient, tabviewheaderitem | ||
res_type: kb | ||
--- | ||
|
||
## Environment | ||
|
||
| Version | Product | Author | | ||
| --- | --- | ---- | | ||
| 11.0.0 | Telerik UI for .NET MAUI TabView | [Dobrinka Yordanova](https://www.telerik.com/blogs/author/dobrinka-yordanova) | | ||
|
||
## Description | ||
|
||
I want to apply a gradient background to the header items of the [TabView]({%slug tabview-overview%}) component in .NET MAUI. The headers' background needs to be styled using a `LinearGradientBrush` while maintaining custom styling for other properties like `FontAttributes` and `TextColor`. | ||
|
||
This knowledge base article also answers the following questions: | ||
- How to set a gradient background for TabView headers in .NET MAUI? | ||
- How to customize TabView `HeaderItemStyle` in .NET MAUI? | ||
- How to use `LinearGradientBrush` in TabView `HeaderItemStyle`? | ||
|
||
## Solution | ||
|
||
To apply a gradient background to the headers in the TabView component, define a custom `HeaderItemStyle` targeting the `TabViewHeaderItem`. Use the `LinearGradientBrush` to specify the gradient background. Below is an example implementation: | ||
|
||
```xml | ||
<telerik:RadTabView x:Name="tabView"> | ||
<telerik:RadTabView.HeaderItemStyle> | ||
<Style TargetType="telerik:TabViewHeaderItem"> | ||
<!-- Customize font style --> | ||
<Setter Property="FontAttributes" Value="Italic"/> | ||
<!-- Customize text color --> | ||
<Setter Property="TextColor" Value="#99000000" /> | ||
<!-- Apply gradient background --> | ||
<Setter Property="Background"> | ||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> | ||
<GradientStop Color="Blue" Offset="0.0"/> | ||
<GradientStop Color="Blue" Offset="0.4"/> | ||
<GradientStop Color="Red" Offset="0.6"/> | ||
<GradientStop Color="Red" Offset="1.0"/> | ||
</LinearGradientBrush> | ||
</Setter> | ||
</Style> | ||
</telerik:RadTabView.HeaderItemStyle> | ||
<!-- Define TabView items --> | ||
<telerik:TabViewItem HeaderText="Home"> | ||
<Label Margin="10" Text="This is the content of the Home tab" /> | ||
</telerik:TabViewItem> | ||
<telerik:TabViewItem HeaderText="Folder"> | ||
<Label Margin="10" Text="This is the content of the Folder tab" /> | ||
</telerik:TabViewItem> | ||
<telerik:TabViewItem HeaderText="View"> | ||
<Label Margin="10" Text="This is the content of the View tab" /> | ||
</telerik:TabViewItem> | ||
</telerik:RadTabView> | ||
``` | ||
|
||
## See Also | ||
|
||
- [TabView Documentation]({%slug tabview-overview%}) | ||
- [Applying Gradient to TabView Header for .NET MAUI]({%slug gradient-header-tabview-dotnet-maui%}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.