syncfusion-wpf-hub-tile
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing WPF Tile Controls
实现WPF磁贴控件
Guide for implementing Syncfusion® WPF Tile Controls — SfHubTile and SfPulsingTile — which create Windows Desktop-style live tile UIs with animated transitions, content cycling, grouping, and freeze support.
本文是实现Syncfusion® WPF磁贴控件——SfHubTile和SfPulsingTile——的指南,这些控件可创建带有动画过渡、内容轮播、分组和冻结功能的Windows桌面风格动态磁贴UI。
When to Use This Skill
何时使用本技能
Use this skill when you need to:
- Create live tile UIs similar to Windows Desktop or Windows Phone start screens
- Implement SfHubTile — tiles that cycle between primary and secondary content with Slide/Fade transitions
- Implement SfPulsingTile — tiles that zoom/pan content continuously (music/video tile style)
- Configure tile header, title, and image display
- Set up transition animations and intervals
- Group tiles and freeze/unfreeze animations programmatically or via
HubTileService - Customize appearance with styles, templates, and themes
在以下场景中可使用本技能:
- 创建类似Windows桌面或Windows Phone开始屏幕的动态磁贴UI
- 实现SfHubTile——通过滑动/淡入淡出过渡在主内容和次要内容之间切换的磁贴
- 实现SfPulsingTile——持续缩放/平移内容的磁贴(音乐/视频磁贴风格)
- 配置磁贴的标题、副标题和图片显示
- 设置过渡动画和间隔
- 通过编程或实现磁贴分组以及冻结/解冻动画
HubTileService - 通过样式、模板和主题自定义外观
Component Overview
组件概述
| Control | Style | Key Capability |
|---|---|---|
| Live tile | Cycles between primary + secondary content via Slide/Fade transitions |
| Music/video tile | Continuously zooms and pans its content using |
Both inherit from and share: , , , , , , , , .
HubTileBaseHeaderTitleImageSourceIsFrozenGroupNameScaleDepthTilePressDurationClickCommandRequired assemblies:
Syncfusion.SfHubTile.WPFSyncfusion.SfShared.WPF
XAML namespace:
xml
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns:shared="clr-namespace:Syncfusion.Windows.Controls;assembly=Syncfusion.SfShared.Wpf"| 控件 | 风格 | 核心能力 |
|---|---|---|
| 动态磁贴 | 通过滑动/淡入淡出过渡在主内容+次要内容之间切换 |
| 音乐/视频磁贴 | 使用 |
两者均继承自,并共享以下属性/事件:、、、、、、、、。
HubTileBaseHeaderTitleImageSourceIsFrozenGroupNameScaleDepthTilePressDurationClickCommand所需程序集:
Syncfusion.SfHubTile.WPFSyncfusion.SfShared.WPF
XAML命名空间:
xml
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns:shared="clr-namespace:Syncfusion.Windows.Controls;assembly=Syncfusion.SfShared.Wpf"Documentation and Navigation Guide
文档与导航指南
Getting Started
快速入门
📄 Read: references/getting-started.md
- Assembly references and NuGet setup
- Adding tiles via Designer, XAML, and C#
- Setting Header, Title, and ImageSource
- Basic click events and MVVM command binding
- Applying built-in themes
📄 阅读: references/getting-started.md
- 程序集引用和NuGet设置
- 通过设计器、XAML和C#添加磁贴
- 设置Header、Title和ImageSource
- 基础点击事件和MVVM命令绑定
- 应用内置主题
Hub Tile Features
Hub磁贴功能
📄 Read: references/hub-tile-features.md
- Secondary content (image, text, or control)
- Slide and Fade transitions with
HubTileTransitions - Transition interval and event
HubTileTransitionCompleted - Press animation (,
ScaleDepth)TilePressDuration - MVVM command binding
📄 阅读: references/hub-tile-features.md
- 次要内容(图片、文本或控件)
- 使用实现滑动和淡入淡出过渡
HubTileTransitions - 过渡间隔和事件
HubTileTransitionCompleted - 按压动画(、
ScaleDepth)TilePressDuration - MVVM命令绑定
Pulsing Tile Features
脉冲磁贴功能
📄 Read: references/pulsing-tile-features.md
- Scaling animation (,
PulseScale)PulseDuration - Horizontal/vertical translation (,
RadiusX,RadiusY)TranslateDuration - Press animation (,
ScaleDepth)TilePressDuration - note
OverrideDefaultStates - MVVM command binding
📄 阅读: references/pulsing-tile-features.md
- 缩放动画(、
PulseScale)PulseDuration - 水平/垂直平移(、
RadiusX、RadiusY)TranslateDuration - 按压动画(、
ScaleDepth)TilePressDuration - 注意事项
OverrideDefaultStates - MVVM命令绑定
Grouping & Freeze/Unfreeze
分组与冻结/解冻
📄 Read: references/grouping-and-freeze.md
- property for tile grouping
GroupName - Data binding grouping with ListView + ItemTemplate (MVVM)
- property to freeze/unfreeze a single tile
IsFrozen - /
HubTileService.Freezeby instance or group nameUnFreeze - dependency notes
System.Windows.Interactivity
📄 阅读: references/grouping-and-freeze.md
- 用于磁贴分组的属性
GroupName - 使用ListView + ItemTemplate实现数据绑定分组(MVVM)
- 用于冻结/解冻单个磁贴的属性
IsFrozen - 通过实例或组名调用/
HubTileService.FreezeUnFreeze - 依赖说明
System.Windows.Interactivity
Appearance & Themes
外观与主题
📄 Read: references/appearance-and-themes.md
- and
HeaderStylecustomizationHeaderTemplate - customization
TitleStyle - and
SecondaryContent(HubTile)SecondaryContentTemplate - Applying built-in themes via
SfSkinManager - Creating custom themes with ThemeStudio
📄 阅读: references/appearance-and-themes.md
- 和
HeaderStyle自定义HeaderTemplate - 自定义
TitleStyle - 和
SecondaryContent(Hub磁贴)SecondaryContentTemplate - 通过应用内置主题
SfSkinManager - 使用ThemeStudio创建自定义主题
Quick Start
快速开始
SfHubTile (live tile with transitions)
SfHubTile(带过渡效果的动态磁贴)
xml
<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns:shared="clr-namespace:Syncfusion.Windows.Controls;assembly=Syncfusion.SfShared.Wpf">
<Grid>
<syncfusion:SfHubTile Header="Mail"
Title="You have 5 new messages"
ImageSource="/Assets/mail.png"
Foreground="White"
Interval="00:00:03">
<syncfusion:SfHubTile.HubTileTransitions>
<shared:SlideTransition/>
</syncfusion:SfHubTile.HubTileTransitions>
<syncfusion:SfHubTile.SecondaryContent>
<Image Source="/Assets/mail-preview.png" Stretch="UniformToFill" Margin="-1"/>
</syncfusion:SfHubTile.SecondaryContent>
</syncfusion:SfHubTile>
</Grid>
</Window>xml
<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns:shared="clr-namespace:Syncfusion.Windows.Controls;assembly=Syncfusion.SfShared.Wpf">
<Grid>
<syncfusion:SfHubTile Header="Mail"
Title="You have 5 new messages"
ImageSource="/Assets/mail.png"
Foreground="White"
Interval="00:00:03">
<syncfusion:SfHubTile.HubTileTransitions>
<shared:SlideTransition/>
</syncfusion:SfHubTile.HubTileTransitions>
<syncfusion:SfHubTile.SecondaryContent>
<Image Source="/Assets/mail-preview.png" Stretch="UniformToFill" Margin="-1"/>
</syncfusion:SfHubTile.SecondaryContent>
</syncfusion:SfHubTile>
</Grid>
</Window>SfPulsingTile (zoom/pan animation)
SfPulsingTile(缩放/平移动画)
xml
<syncfusion:SfPulsingTile Header="Music"
Title="Now Playing - Song Name"
ImageSource="/Assets/album.jpg"
Foreground="White"
PulseScale="2"
PulseDuration="00:00:03"
RadiusX="50"
RadiusY="50">
<Image Source="/Assets/album.jpg" Stretch="UniformToFill"/>
</syncfusion:SfPulsingTile>xml
<syncfusion:SfPulsingTile Header="Music"
Title="Now Playing - Song Name"
ImageSource="/Assets/album.jpg"
Foreground="White"
PulseScale="2"
PulseDuration="00:00:03"
RadiusX="50"
RadiusY="50">
<Image Source="/Assets/album.jpg" Stretch="UniformToFill"/>
</syncfusion:SfPulsingTile>C# code-behind
C#后台代码
csharp
using Syncfusion.Windows.Controls.Notification;
SfHubTile hubTile = new SfHubTile();
hubTile.Header = "Mail";
hubTile.Title = "You have 5 new messages";
hubTile.Foreground = Brushes.White;
hubTile.ImageSource = new BitmapImage(new Uri(@"/Assets/mail.png", UriKind.RelativeOrAbsolute));
hubTile.HubTileTransitions.Add(new SlideTransition());
hubTile.Interval = TimeSpan.FromSeconds(3.0);
grid.Children.Add(hubTile);csharp
using Syncfusion.Windows.Controls.Notification;
SfHubTile hubTile = new SfHubTile();
hubTile.Header = "Mail";
hubTile.Title = "You have 5 new messages";
hubTile.Foreground = Brushes.White;
hubTile.ImageSource = new BitmapImage(new Uri(@"/Assets/mail.png", UriKind.RelativeOrAbsolute));
hubTile.HubTileTransitions.Add(new SlideTransition());
hubTile.Interval = TimeSpan.FromSeconds(3.0);
grid.Children.Add(hubTile);Common Patterns
常见模式
Choose the right tile type
选择合适的磁贴类型
- User wants live tile that cycles content → use with
SfHubTile+ transitionsSecondaryContent - User wants continuously animated background (music/video style) → use with
SfPulsingTile+PulseScale/RadiusXRadiusY - User wants both → each is independent; can mix in same layout
- 用户需要可轮播内容的动态磁贴 → 使用带有和过渡效果的
SecondaryContentSfHubTile - 用户需要持续动画背景(音乐/视频风格)→ 使用带有和
PulseScale/RadiusX的RadiusYSfPulsingTile - 用户同时需要两者 → 两者相互独立,可在同一布局中混合使用
Freeze tile on demand
按需冻结磁贴
csharp
// Freeze single tile
hubTile.IsFrozen = true;
// Freeze entire group
HubTileService.Freeze("GroupName");
// Unfreeze entire group
HubTileService.UnFreeze("GroupName");csharp
// 冻结单个磁贴
hubTile.IsFrozen = true;
// 冻结整个分组
HubTileService.Freeze("GroupName");
// 解冻整个分组
HubTileService.UnFreeze("GroupName");MVVM: bind tiles from a collection
MVVM:从集合绑定磁贴
Bind an to a and use with . Each model exposes , , and properties. See for the full MVVM example.
ObservableCollection<Model>ListViewItemTemplateSfHubTileHeaderImageSourceIntervalreferences/grouping-and-freeze.md将绑定到,并在中使用。每个模型需暴露、和属性。完整MVVM示例请查看。
ObservableCollection<Model>ListViewItemTemplateSfHubTileHeaderImageSourceIntervalreferences/grouping-and-freeze.mdKey Properties
核心属性
| Property | Control | Purpose |
|---|---|---|
| Both | Label displayed at tile bottom |
| Both | Notification text at tile top |
| Both | Primary image path |
| Both | Text color (set to White for dark tiles) |
| Both | Stop/start animation |
| Both | Group tiles for bulk freeze/unfreeze |
| SfHubTile | Time between transitions |
| SfHubTile | Content shown during transition |
| SfHubTile | Transition effects (Slide, Fade) |
| SfPulsingTile | Zoom magnitude |
| SfPulsingTile | Duration of one zoom cycle |
| SfPulsingTile | Translation range on X/Y axes |
| SfPulsingTile | Duration of one translation cycle |
| Both | Press animation zoom depth |
| Both | Press animation duration |
| 属性 | 控件 | 用途 |
|---|---|---|
| 两者 | 磁贴底部显示的标签 |
| 两者 | 磁贴顶部显示的通知文本 |
| 两者 | 主图片路径 |
| 两者 | 文本颜色(深色磁贴建议设为白色) |
| 两者 | 停止/启动动画 |
| 两者 | 对磁贴进行分组,以便批量冻结/解冻 |
| SfHubTile | 过渡效果的时间间隔 |
| SfHubTile | 过渡时显示的内容 |
| SfHubTile | 过渡效果(滑动、淡入淡出) |
| SfPulsingTile | 缩放幅度 |
| SfPulsingTile | 单次缩放周期的时长 |
| SfPulsingTile | X/Y轴上的平移范围 |
| SfPulsingTile | 单次平移周期的时长 |
| 两者 | 按压动画的缩放深度 |
| 两者 | 按压动画的时长 |