WPF中ControlTemplate中的CustomUserControl双击事件
在WPF中,我使用双击事件处理程序创建了一个CustomUserControl。我在ControlTemplate中以以下方式使用此控件:WPF中ControlTemplate中的CustomUserControl双击事件,wpf,controltemplate,xceed-datagrid,Wpf,Controltemplate,Xceed Datagrid,在WPF中,我使用双击事件处理程序创建了一个CustomUserControl。我在ControlTemplate中以以下方式使用此控件: <xcdg:DataCell FieldName="." Template="{StaticResource myTemplate}"> </xcdg:DataCell> 这也是我的控制模板: <ControlTemplate x:Key="myTempl
<xcdg:DataCell FieldName="." Template="{StaticResource myTemplate}">
</xcdg:DataCell>
这也是我的控制模板:
<ControlTemplate x:Key="myTemplate" TargetType="xcdg:DataCell">
<uicontrols:MyCustomControl Tag="{Binding ID}" Margin="0" Height="140" Width="150" DoubleClick="ctrl_DoubleClick">
</ControlTemplate>
双击事件处理程序在ControlTemplate内不工作。什么是问题?什么是最佳解决方案?我找到了答案。而不是在DateCell中使用额外的模板。我使用内联模板
<xcdg:DataCell FieldName=".">
<xcdg:DataCell.Template>
<ControlTemplate>
// your template code. here the event of my controls are working.
</ControlTemplate>
</xcdg:DataCell.Template>
</xcdg:DataCell>
//您的模板代码。这里我的控件的事件正在工作。
我找到了答案。而不是在DateCell中使用额外的模板。我使用内联模板
<xcdg:DataCell FieldName=".">
<xcdg:DataCell.Template>
<ControlTemplate>
// your template code. here the event of my controls are working.
</ControlTemplate>
</xcdg:DataCell.Template>
</xcdg:DataCell>
//您的模板代码。这里我的控件的事件正在工作。