Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
822 views
in Technique[技术] by (71.8m points)

xaml - Why doesn't WPF border control have a mousedoubleclick event?

Why doesn't WPF border control have a mousedoubleclick event? I have a ItemsControl with some layout stuff in it for a DataTemplate. I want to handle the double click event to pop up a details dialog, but the border, my layout container, doesn't appear to expose the event.

Any suggestions on how to either get at the double click event, or rework the xaml to make it possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just use InputBindings.

<Border>
    <Border.InputBindings>
        <MouseBinding MouseAction="LeftDoubleClick" Command="..."/>
    </Border.InputBindings>
</Border>

In general; avoid using events if not developing controls in WPF. Usually the usage of code behind based events is a strong indication for a MVVM Pattern break.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...