首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏dino.c的专栏

    [UWP 自定义控件]了解模板化控件(7):支持Command

    要实现Command支持,控件中要执行如下步骤: 定义Command和CommandParameter属性。 监视Command的CanExecuteChanged事件。 在CanExecuteChanged的事件处理函数及CommandParameter的PropertyChangedCallback中,根据Command.CanExecute(CommandParameter static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register("CommandParameter 的值 /// public object CommandParameter { get { return (object)GetValue = Command) && Command.CanExecute(CommandParameter)) { Command.Execute(CommandParameter

    72430发布于 2019-01-18
  • 来自专栏艳艳代码杂货店

    C#的SQLiteHelper类似SqlHelper类实现存取Sqlite数据库

    ", i, commandParameter.ParameterName)); if (columns.Contains(commandParameter.ParameterName )) commandParameter.Value = dataRow[commandParameter.ParameterName]; else if (columns.Contains(commandParameter.ParameterName.Substring(1))) commandParameter.Value )) commandParameter.Value = dataRow[commandParameter.ParameterName]; else if (columns.Contains(commandParameter.ParameterName.Substring(1))) commandParameter.Value

    2.5K30发布于 2021-10-27
  • 来自专栏黄腾霄的博客

    EventTrigger原理浅谈

    { return; } var command = GetCommand(); var commandParameter = CommandParameterValue; if (commandParameter == null && PassEventArgsToCommand ) { commandParameter = EventArgsConverter == null ? = null && command.CanExecute(commandParameter)) { command.Execute (commandParameter); } } 链接 MVVM实现 MVVM进阶 MVVMLight源码EventToCommand ---- 本文会经常更新,

    85530发布于 2020-06-10
  • 来自专栏Niuery的技术日记

    WPF --- 非Button自定义控件实现点击功能

    的存在,所以在 WPF 中 Button 点击功能有两种方案, 第一种是直接注册点击事件,比如 Click="OpenFolderBrowserControl_Click" 第二种是绑定Command、CommandParameter 、CommandTarget,比如 Command="{Binding ClickCommand}" CommandParameter="" CommandTarget="" 。 定义了一个 ICommand 类型的属性 Command, 定义了一个表示与控件关联的, IInputElement 类型的 CommandTarget 定义了一个表示命令参数,object 类型的属性 CommandParameter GetValue(CommandProperty); } set { SetValue(CommandProperty, value); } } public object CommandParameter static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register("CommandParameter

    1.3K10编辑于 2023-10-22
  • 来自专栏.NET开发那点事

    豆瓣电台WP7客户端 MVVM重构记录之使用MVVM Light实现Event绑定

    <cmd:EventToCommand Command="{Binding TapCommand}" CommandParameter </i:Interaction.Triggers> </toolkit:HubTile> EventToCommand 的 Command绑定命令,CommandParameter

    95230编辑于 2022-05-07
  • 来自专栏GuZhenYin

    C#使用Xamarin开发可移植移动应用进阶篇(10.综合演练,来一份增删改查CRUD)

    ViewCell> <ViewCell.ContextActions> <MenuItem CommandParameter Clicked="MenuItem_Clicked" Text="修改" /> <MenuItem x:Name="DeleteBtn" CommandParameter EventArgs e) { var mi = ((MenuItem)sender); ContextModel date = mi.CommandParameter EventArgs e) { var mi = ((MenuItem)sender); int id = Convert.ToInt32( mi.CommandParameter

    2.4K80发布于 2018-01-04
  • 来自专栏JusterZhu

    WPF实现消息中心

    DataContext.ClickAcceptCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter DataContext.ClickRefuseCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter DataContext.ClickAgreeCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter

    91610编辑于 2022-12-07
  • 来自专栏dino.c的专栏

    [UWP]为番茄钟应用设计一个平平无奇的状态按钮

    要实现ICommand支持,控件中要执行如下步骤: 定义Command和CommandParameter属性。 监视Command的CanExecuteChanged事件。 在CanExecuteChanged的事件处理函数及CommandParameter的PropertyChangedCallback中,根据Command.CanExecute(CommandParameter 因为从需求来说这个按钮不需要CommandParameter,也不需要监视CanExecuteChanged事件,所以实现得简单些: public ICommand StartCommand {

    99600发布于 2019-11-13
  • 来自专栏JusterZhu

    (03).NET MAUI实战 基础控件

    Button xaml语法: <Button Text="我是Btn" WidthRequest="200" HeightRequest="50" Command="{Binding OkCommand}" CommandParameter ImageButton Source="/img/1.jpg" WidthRequest="200" HeightRequest="50" Command="{Binding OkCommand}" CommandParameter

    2K20编辑于 2022-12-07
  • 来自专栏DotNet 致知

    WPF中的命令(Command)

    点击按钮,输出窗口会打印“命令被执行了”字样: 然后我们清除掉输出窗口的内容,当再一次点击按钮时,因为isCanExec被设置为FALSE,所以命令终止执行,输出窗口无内容: 【命令参数CommandParameter 在执行命令时传入进来,我们则可以根据这个参数,对执行逻辑做多样化的判断,下面我将代码稍作改变: 在界面上放置两个按钮,并修改ViewModel代码为如下所示: 在Button中使用CommandParameter

    2.1K20发布于 2021-11-05
  • 来自专栏水击三千

    Silverlight学习(三)

    Grid.RowDefinitions> 23 <Button Content="添加" Width="50" Height="25" Command="{Binding OnInsert,Mode=OneWay}" CommandParameter "1" Width="50" Height="30" Content="查询" Command="{Binding OnSearch,Mode=OneWay}" 32 CommandParameter Button控件可以绑定Command命令,不需要实现click事件,同时可以通过CommandParameter传递参数,也就是当这个命令发生的时候传递的参数。 本文传递了需要查询的字段值,为控件绑定的CommandParameter="{Binding Text,ElementName=txtSearch}",也就是将txtSeatrch的值传递过去。

    1.1K80发布于 2018-02-27
  • 来自专栏Dotnet9

    浅谈WPF之控件拖拽与拖动

    EventTrigger EventName="Loaded"> <i:InvokeCommandAction Command="{Binding WinLoadedCommand}" CommandParameter MouseLeftButtonDown"> <i:InvokeCommandAction Command="{Binding IconMouseLeftDownCommand}" CommandParameter MouseLeftButtonDown"> <i:InvokeCommandAction Command="{Binding IconMouseLeftDownCommand}" CommandParameter

    2.2K10编辑于 2023-12-13
  • 来自专栏hbbliyong

    WPF命令(Command)介绍、命令和数据绑定集成应用

    由于Command和CommandParameter都是元素上的属性,所以他们都能被设置为一些绑定到他们的数据。因此,可以使用绑定的数据内容来确定应该发生的动作。       <TextBlock Text="{Binding Path=Name}"/> <Button Margin="5" CommandParameter <TextBlock Text="{Binding Path=Name}"/> <Button x:Name="btnShow" Margin="5" CommandParameter

    7K40发布于 2018-03-05
  • 来自专栏张志敏的技术专栏

    MvvmCross 框架中的数据绑定语法

    BindMode , 则继续添加: , Mode=$WhichMode$ $WhichMode$ 允许的值如下: OneWay OneWayToSource TwoWay OneTime Default 如果需要 CommandParameter , 则可以继续添加: , CommandParameter=$CPValue$ $CPValue$ 允许的内容与 $ParameterValue$ 相同。 Value Count, BindingMode=TwoWay 将 Value 属性绑定到 ViewModel 的 Count 属性, 并指明是双向绑定; Click DayCommand, CommandParameter

    2.2K31发布于 2020-08-06
  • 来自专栏历史专栏

    【愚公系列】2023年09月 WPF控件专题 Button控件详解

    CommandParameter:向关联的命令传递的参数。 IsEnabled:Button控件是否启用。 IsDefault:指定该Button是否作为默认Button。 Binding SaveCommand}"/> 带参数的Command <Button Content="Delete" Command="{Binding DeleteCommand}" CommandParameter

    1.5K22编辑于 2023-09-29
  • 来自专栏博客园

    深入浅出话命令

    答案是使用CommandParameter,命令源一定是实现了ICommandSource接口的对象,而ICommandSource有一个属性就是CommandParameter,如果把命令看作飞向目标的炮弹 ,那么CommandParameter就相当于装载在炮弹里面的“消息”。 ="Teacher"></Button>   <Button Content="New Student" Grid.Row="4" Command="New" CommandParameter="Student 个属性   ///    public ICommand Command       {   get;   set;       }   public object CommandParameter 在本例中CommandParameter完全没有被用到,而CommandTarget作为参数传递给了Command的Execute方法。

    2.2K40发布于 2018-08-31
  • 来自专栏哲学驱动设计

    WPF中ICommand接口 的一个设计问题

    ICommand Command { get; } object CommandParameter { get; } IInputElement CommandTarget

    1.2K70发布于 2018-01-29
  • 来自专栏张善友的专栏

    IronPython整合Windows PowerShell

    input cmd = Command(_cmdName) #Adds parameters to the command for arg in args: cmd.Parameters.Add(CommandParameter (None, fix_arg(arg))) for name, value in kws.items(): cmd.Parameters.Add(CommandParameter(name, fix_arg

    1.5K70发布于 2018-01-30
  • 来自专栏Kiba518

    【我们一起写框架】MVVM的WPF框架之绑定(二)

    <Button HorizontalAlignment="Left" Content="PageMain" Command="{Binding ChangeFrameSourceCommand}" CommandParameter <Button HorizontalAlignment="Left" Content="PageUser" Command="{Binding ChangeFrameSourceCommand}" CommandParameter

    2.5K41发布于 2018-09-28
  • 来自专栏WPF

    .NET Core 3 WPF MVVM框架 Prism系列之对话框服务

    ="5" Foreground="White" FontSize="12" Background="#5cb85c" Command="{Binding CloseDialogCommand}" CommandParameter ="5" Foreground="White" FontSize="12" Background="#d9534f" Command="{Binding CloseDialogCommand}" CommandParameter

    1.9K20发布于 2020-04-28
领券