This is a migrated thread and some comments may be shown as answers.

EventToCommandBehavior with DataObject.Pasting event

2 Answers 283 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christoph
Top achievements
Rank 1
Christoph asked on 17 Aug 2020, 01:25 PM

Hello,
I want to bind the DataObject.Pasting event of a TextBox with the EventToCommandBehavior to a command of the viewmodel:

<TextBox Grid.Column="3"
         HorizontalContentAlignment="Left" 
         Text="{Binding Offset, UpdateSourceTrigger=PropertyChanged}"
         VerticalContentAlignment="Center">
    <telerik:EventToCommandBehavior.EventBindings>
        <telerik:EventBinding Command="{Binding OffsetPastingCommand}" EventName="DataObject.Pasting" PassEventArgsToCommand="True"/>
    </telerik:EventToCommandBehavior.EventBindings>
</TextBox>

However, in the example above, the message "DataObject.Pasting event cannot be found" appears. What is the right way to bind the pasting event?
Thanks a lot
Christoph

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 19 Aug 2020, 10:01 AM

Hello Christoph,

Thank you for the shared code snippet. 

The DataObject.Pasting event is an attached one and such events cannot be handled with the EventToCommandBehavior. That said, you can check out the following thread, which lists some suggestions for handling attached events.

I hope you find this helpful. 

Regards,
Vladimir Stoyanov
Progress Telerik

0
Christoph
Top achievements
Rank 1
answered on 20 Aug 2020, 04:58 AM

Hello Vladimir,

thanks for the information.

Greetings
Christoph

Tags
General Discussions
Asked by
Christoph
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Christoph
Top achievements
Rank 1
Share this question
or