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

 

posted @ 2023-03-08 12:37  ChuckLu  阅读(50)  评论(0)    收藏  举报