DevExpress.Xpf.Core.v22.2.dll EventToCommand Class

EventToCommand Class | WPF Controls | DevExpress Documentation

GitHub - DevExpress-Examples/wpf-mvvm-framework-ui-services-eventtocommand: This example shows you how to use the EventToCommand behavior to execute a command when an event is raised.

 

Pass a Parameter to the Bound Command

Use the CommandParameter property to pass a parameter to a command:

<ListBox x:Name="list">
    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:EventToCommand EventName="MouseDoubleClick" 
                               Command="{Binding EditCommand}" 
                               CommandParameter="{Binding ElementName=list, Path=SelectedItem}"/>
    </dxmvvm:Interaction.Behaviors>
</ListBox>

 

CellValueChanged Event does not fire - It bind to private method with DXEvent | DevExpress Support

Similarly to the standard WPF binding, DXBinding and DXEvent can work only with public members. So, it will be necessary to make your member public if you want to use DXEvent.

 

DXBinding | WPF Controls | DevExpress Documentation

Binding Tools

The DevExpress Binding mechanism includes three powerful tools that extend standard WPF bindings.

  • The DXBinding allows you to use expressions inside binding paths.

    IsEnabled="{DXBinding '!HasError'}"
    IsEnabled="{DXBinding 'GetHasError(Text)'}"
    Margin="{DXBinding 'new $Thickness(LeftIndent, 0, 0, 0)'}"
    
  • With the DXCommand, you can bind a command property and define methods to call right in xaml.

    <Button Command="{DXCommand 'SaveDocument(DocumentName); CloseDocument(DocumentName)'}"/>
    <Button Command="{DXCommand '@e(checkBox).IsChecked=true'}"/>
    
  • The DXEvent allows you to bind an event to methods.

    <Window Loaded="{DXEvent InitializeViewModel()}"/>
    <Button Click="{DXEvent '@e(checkBox).IsChecked=true'}"/>
    

The Language Specification topic describes the language that is used in the DevExpress binding mechanism.

#Declarative Template Selector

The DXDataTemplateSelector is a declarative way to implement DataTemplateSelector.

The DXDataTemplateSelector allows you to define a simple template selection logic in XAML, so you do not need to create a DataTemplateSelector ancestor in code-behind. The DXDataTemplateSelector works like WPF triggers.

SEE ALSO

 

DXBinding | WPF Controls | DevExpress Documentation

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(35)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-03-08 先使用大漩涡传送门,后召唤图腾的问题
2019-03-08 SxsTrace
2019-03-08 使用CCleaner卸载chrome
2018-03-08 Parallel in C#
2017-03-08 OneNote
2017-03-08 Find or Query Data with the mongo Shell
2016-03-08 socket listen backlog
点击右上角即可分享
微信分享提示