CustomUserControl在WPF中的ControlTemplate中双击事件

时间:2016-02-25 19:16:32

标签: wpf controltemplate xceed-datagrid

在WPF中,我使用DoubleClick事件处理程序创建了一个CustomUserControl。我以这种方式在ControlTemplate中使用此控件:

             <xcdg:DataCell FieldName="."  Template="{StaticResource myTemplate}">
                </xcdg:DataCell>

这也是我的ControlTemplate:

    <ControlTemplate x:Key="myTemplate" TargetType="xcdg:DataCell">
                        <uicontrols:MyCustomControl  Tag="{Binding ID}"  Margin="0"  Height="140" Width="150" DoubleClick="ctrl_DoubleClick">
    </ControlTemplate>

DoubleClick事件处理程序在ControlTemplate内部无效。问题是什么?什么是最好的解决方案?

1 个答案:

答案 0 :(得分:0)

我找到了答案。而不是在DateCell中使用额外的模板。我使用了内联模板。

<div class="container">
    <div class="box">  
    Stuff goes here...
    </div>
</div>