Loading...
Loading...
Compare original and translation side by side
SfDropDownColorPaletteSfDropDownColorPalette| Section | Purpose |
|---|---|
| Selected Color Button | Displays currently selected color; clicking opens palette |
| Automatic Color | Quick access to default color (usually black) |
| Theme Colors | Predefined theme colors with shade variants |
| Standard Colors | 10 standard colors (red, green, blue, yellow, etc.) |
| Recently Used | Colors selected from More Colors dialog |
| More Colors... | Opens spectrum dialog for any color |
| 区域 | 用途 |
|---|---|
| 已选颜色按钮 | 显示当前选中的颜色;点击可打开调色板 |
| 自动颜色 | 快速访问默认颜色(通常为黑色) |
| 主题颜色 | 预定义的主题颜色及色调变体 |
| 标准颜色 | 10种标准颜色(红、绿、蓝、黄等) |
| 最近使用 | 从「更多颜色」对话框中选择过的颜色 |
| 更多颜色... | 打开色谱对话框以选择任意颜色 |
Syncfusion.Editors.WinUISyncfusion.Editors.WinUI<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:editors="using:Syncfusion.UI.Xaml.Editors">
<Grid>
<editors:SfDropDownColorPalette x:Name="colorPalette" />
</Grid>
</Page><Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:editors="using:Syncfusion.UI.Xaml.Editors">
<Grid>
<editors:SfDropDownColorPalette x:Name="colorPalette" />
</Grid>
</Page>using Syncfusion.UI.Xaml.Editors;
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
var colorPalette = new SfDropDownColorPalette();
grid.Children.Add(colorPalette);
}
}using Syncfusion.UI.Xaml.Editors;
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
var colorPalette = new SfDropDownColorPalette();
grid.Children.Add(colorPalette);
}
}<editors:SfDropDownColorPalette SelectedBrush="Yellow" x:Name="palette" />// Get the selected color
var selectedBrush = palette.SelectedBrush as SolidColorBrush;
if (selectedBrush != null)
{
Color selectedColor = selectedBrush.Color;
}
// Set a new color
palette.SelectedBrush = new SolidColorBrush(Colors.Red);<editors:SfDropDownColorPalette SelectedBrush="Yellow" x:Name="palette" />// 获取选中颜色
var selectedBrush = palette.SelectedBrush as SolidColorBrush;
if (selectedBrush != null)
{
Color selectedColor = selectedBrush.Color;
}
// 设置新颜色
palette.SelectedBrush = new SolidColorBrush(Colors.Red);<editors:SfDropDownColorPalette
SelectedBrushChanged="Palette_SelectedBrushChanged"
x:Name="palette" />private void Palette_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
{
var oldBrush = e.OldBrush as SolidColorBrush;
var newBrush = e.NewBrush as SolidColorBrush;
// Apply color somewhere
textBlock.Foreground = newBrush;
}<editors:SfDropDownColorPalette
SelectedBrushChanged="Palette_SelectedBrushChanged"
x:Name="palette" />private void Palette_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e)
{
var oldBrush = e.OldBrush as SolidColorBrush;
var newBrush = e.NewBrush as SolidColorBrush;
// 在某处应用颜色
textBlock.Foreground = newBrush;
}<editors:SfDropDownColorPalette
DropDownMode="Split"
Command="{x:Bind ApplyColorCommand}"
x:Name="palette" />private ICommand applyColorCommand;
public ICommand ApplyColorCommand => applyColorCommand;
public void ApplyColorToSelectedText(object param)
{
// Apply the currently selected color
richTextBox.Document.Selection.CharacterFormat.BackgroundColor =
(palette.SelectedBrush as SolidColorBrush).Color;
}<editors:SfDropDownColorPalette
DropDownMode="Split"
Command="{x:Bind ApplyColorCommand}"
x:Name="palette" />private ICommand applyColorCommand;
public ICommand ApplyColorCommand => applyColorCommand;
public void ApplyColorToSelectedText(object param)
{
// 应用当前选中的颜色
richTextBox.Document.Selection.CharacterFormat.BackgroundColor =
(palette.SelectedBrush as SolidColorBrush).Color;
}<editors:SfDropDownColorPalette
DropDownPlacement="BottomEdgeAlignedRight"
x:Name="palette" />AutoBottomEdgeAlignedLeftBottomEdgeAlignedRightTopEdgeAlignedLeftTopEdgeAlignedRight<editors:SfDropDownColorPalette
DropDownPlacement="BottomEdgeAlignedRight"
x:Name="palette" />AutoBottomEdgeAlignedLeftBottomEdgeAlignedRightTopEdgeAlignedLeftTopEdgeAlignedRight<editors:SfDropDownColorPalette
DropDownOpened="Palette_DropDownOpened"
DropDownClosed="Palette_DropDownClosed"
x:Name="palette" />private void Palette_DropDownOpened(object sender, EventArgs e)
{
// Palette opened
}
private void Palette_DropDownClosed(object sender, EventArgs e)
{
// Palette closed
}<editors:SfDropDownColorPalette
DropDownOpened="Palette_DropDownOpened"
DropDownClosed="Palette_DropDownClosed"
x:Name="palette" />private void Palette_DropDownOpened(object sender, EventArgs e)
{
// 调色板已打开
}
private void Palette_DropDownClosed(object sender, EventArgs e)
{
// 调色板已关闭
}| Property | Type | Purpose |
|---|---|---|
| | Gets/sets the currently selected color (default: Black) |
| | Position of dropdown relative to button (default: Auto) |
| | Dropdown or Split mode (default: Dropdown) |
| | Command executed when button clicked (Split mode) |
| | Customize selected color button appearance |
| | Customize dropdown arrow button (Split mode) |
| 属性 | 类型 | 用途 |
|---|---|---|
| | 获取/设置当前选中的颜色(默认:黑色) |
| | 下拉菜单相对于按钮的位置(默认:Auto) |
| | 下拉模式或拆分模式(默认:Dropdown) |
| | 按钮点击时执行的命令(拆分模式) |
| | 自定义选中颜色按钮的外观 |
| | 自定义下拉箭头按钮(拆分模式) |