Blazor的Telerik UI?下载30天免费试用

事件选择器

本文描述了用于Blazor的Telerik ColorPicker的可用事件。

OnChange

OnChange事件触发时,用户提交他们的选择:

  • 应用或取消按钮单击
  • 输入键盘按键
  • 模糊动作(弹出关闭)

注意OnChange事件也可能在实际选择的颜色没有改变时触发。

事件类型为EventCallback <对象>.的OnChange对象的双向绑定价值属性。

@*处理ColorPickerOnChange事件*@ 

@ eventlog

@code {string颜色{get;设置;} string EventLog {get;设置;} async任务ColorPickerOnChange(对象newColor) {EventLog =字符串。Format("The selected color is: {0}", (string)newColor);}}

ValueChanged

ValueChanged事件在用户选择新颜色且组件值发生变化时触发。

事件类型为EventCallback <字符串>.使用ValueChanged类型的单向绑定价值在事件处理程序中更新属性和手动值。

@*处理ColorPickerValueChanged事件*@  @code {string颜色{get;设置;} async Task ColorPickerValueChanged(string newColor) {Color = newColor;}}

ViewChanged

ViewChanged事件在用户在弹出视图之间切换时触发。

事件类型为EventCallback < ColorPickerView >.使用ViewChanged类型的单向绑定视图在事件处理程序中更新属性和手动值。

@*处理ColorPickerViewChanged事件*@  @code {string Color {get;设置;} ColorPickerView查看{获取;设置;} async Task ColorPickerViewChanged(ColorPickerView newView) {View = newView;}}

OnOpen

OnOpen事件在ColorPicker弹出渲染前触发。

事件处理程序接收一个参数ColorPickerOpenEventArgs对象,该对象包含:

财产 描述
IsCancelled 设置IsCancelled财产真正的取消弹出窗口的打开。
 @code {private string Color {get;设置;} = "rgb(40,47,137)";//设置IsCancelled为true来取消OnOpen事件参数。IsCancelled = false;}}

OnClose

OnClose事件在ColorPicker弹出窗口关闭之前触发。

事件处理程序接收一个参数MultiColumnComboBoxCloseEventArgs对象,该对象包含:

财产 描述
IsCancelled 设置IsCancelled财产真正的取消弹出窗口的关闭。
@*取消基于条件的OnClose事件*@  @code{私有字符串颜色{get;设置;} = "rgba(40,47,137,0)";private void OnColorPickerPopupClose(ColorPickerCloseEventArgs){//取消基于条件的OnClose事件如果(Color == "rgba(255,255,255,0)") {args。IsCancelled = true;}}}

另请参阅

在本文中
Baidu
map