Skip to content

颜色选择器

颜色选择器 (ColorPicker)

xml
<ColorPicker/>

颜色选则器对话框 (ColorDialog)

  • 可通过ColorChanged获取颜色改变信号
xml
<ui:ColorDialog Name="ColorDialog"/>
<Button
  HorizontalAlignment="Center"
  Click="OnShowColorDialog"
  Content="Show Color Dialog"/>
csharp
private async void OnShowColorDialog(object? sender, RoutedEventArgs e)
{
    var result = await ColorDialog.ShowAsync(this);
}

颜色选择按钮 (ColorPickerButton)

  • 用于展示选择的按钮,点击会弹出颜色选择对话框
xml
<StackPanel
  HorizontalAlignment="Center"
  Orientation="Horizontal"
  Spacing="8">
  <ui:ColorPickerButton Color="DeepPink"/>
  <ui:ColorPickerButton Color="DeepSkyBlue"/>
  <ui:ColorPickerButton Color="Aquamarine"/>
</StackPanel>

基于 MIT 许可发布