Loading...
Loading...
Compare original and translation side by side
<!-- Basic ColorPickerPalette setup -->
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="ColorPickerPalette Sample">
<Grid>
<!-- Default dropdown mode with theme and standard colors -->
<syncfusion:ColorPickerPalette x:Name="colorPickerPalette"
Color="Red"
GenerateThemeVariants="True"
GenerateStandardVariants="True"
RecentlyUsedPanelVisibility="Visible"
Width="60"
Height="40" />
</Grid>
</Window>using Syncfusion.Windows.Tools.Controls;
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
// Handle color selection
colorPickerPalette.SelectedBrushChanged += ColorPickerPalette_SelectedBrushChanged;
}
private void ColorPickerPalette_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e) {
var newColor = e.NewColor;
var newBrush = e.NewBrush;
// Apply color to UI elements
}
}<!-- 基础ColorPickerPalette配置 -->
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="ColorPickerPalette Sample">
<Grid>
<!-- 带主题色和标准色的默认下拉模式 -->
<syncfusion:ColorPickerPalette x:Name="colorPickerPalette"
Color="Red"
GenerateThemeVariants="True"
GenerateStandardVariants="True"
RecentlyUsedPanelVisibility="Visible"
Width="60"
Height="40" />
</Grid>
</Window>using Syncfusion.Windows.Tools.Controls;
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
// 处理颜色选择事件
colorPickerPalette.SelectedBrushChanged += ColorPickerPalette_SelectedBrushChanged;
}
private void ColorPickerPalette_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs e) {
var newColor = e.NewColor;
var newBrush = e.NewBrush;
// 将颜色应用到UI元素
}
}<syncfusion:ColorPickerPalette
Themes="Metro"
GenerateThemeVariants="True"
GenerateStandardVariants="True"
ThemePanelVisibility="Visible"
StandardPanelVisibility="Visible"
RecentlyUsedPanelVisibility="Visible"
MoreColorOptionVisibility="Visible"
NoColorVisibility="Visible" /><syncfusion:ColorPickerPalette
Themes="Metro"
GenerateThemeVariants="True"
GenerateStandardVariants="True"
ThemePanelVisibility="Visible"
StandardPanelVisibility="Visible"
RecentlyUsedPanelVisibility="Visible"
MoreColorOptionVisibility="Visible"
NoColorVisibility="Visible" />var customColors = new ObservableCollection<CustomColor>
{
new CustomColor { Color = Color.FromArgb(255, 17, 235, 248), ColorName = "Aqua" },
new CustomColor { Color = Color.FromArgb(255, 248, 15, 166), ColorName = "Deep Pink" }
};
colorPickerPalette.CustomColorsCollection = customColors;
colorPickerPalette.SetCustomColors = true;
colorPickerPalette.CustomHeaderText = "Brand Colors";var customColors = new ObservableCollection<CustomColor>
{
new CustomColor { Color = Color.FromArgb(255, 17, 235, 248), ColorName = "Aqua" },
new CustomColor { Color = Color.FromArgb(255, 248, 15, 166), ColorName = "Deep Pink" }
};
colorPickerPalette.CustomColorsCollection = customColors;
colorPickerPalette.SetCustomColors = true;
colorPickerPalette.CustomHeaderText = "Brand Colors";<syncfusion:ColorPickerPalette
Mode="Split"
SelectedCommand="{Binding ApplyColorCommand}"
Color="{Binding SelectedColor, Mode=TwoWay}" /><syncfusion:ColorPickerPalette
Mode="Split"
SelectedCommand="{Binding ApplyColorCommand}"
Color="{Binding SelectedColor, Mode=TwoWay}" /><syncfusion:ColorPickerPalette
Mode="Palette"
BorderWidth="30"
BorderHeight="30" /><syncfusion:ColorPickerPalette
Mode="Palette"
BorderWidth="30"
BorderHeight="30" />| Property | Type | Purpose |
|---|---|---|
| | Gets/sets the selected color (default: Black) |
| | Gets/sets the selected brush |
| | Dropdown, Palette, or Split mode |
| | Office, Apex, Metro, etc. |
| | Show/hide theme color variants |
| | Show/hide standard color variants |
| | Custom color items |
| | Enable custom colors display |
| | Color item dimensions |
| | Palette popup size |
| | Show recently selected colors |
| | Show theme colors |
| | Show standard colors |
| | Show "More Colors" button |
| | Show transparent/no color button |
| | Default reset color |
| 属性 | 类型 | 用途 |
|---|---|---|
| | 获取/设置选中颜色(默认值:黑色) |
| | 获取/设置选中画笔 |
| | 下拉、调色板或拆分模式 |
| | Office、Apex、Metro等主题 |
| | 显示/隐藏主题色变体 |
| | 显示/隐藏标准色变体 |
| | 自定义颜色项 |
| | 启用自定义颜色显示 |
| | 颜色项尺寸 |
| | 调色板弹出窗口大小 |
| | 显示最近选中的颜色 |
| | 显示主题色 |
| | 显示标准色 |
| | 显示“更多颜色”按钮 |
| | 显示透明/无颜色按钮 |
| | 默认重置颜色 |