사용자 정의 컨트롤에 포함 된 단추의 클릭 이벤트가 노출됩니다. 이 사용자 지정 컨트롤의 인스턴스는 다른 사용자 지정 컨트롤의 컨트롤 템플릿에서 선언됩니다.다른 사용자 지정 컨트롤의 컨트롤 템플릿에 정의 된 사용자 지정 컨트롤 이벤트 노출
public class CustomTabPanel : Panel
{
public Button newButton;
//lots of other stuff
}
그리고 내가 인스턴스를 정의하고이 CustomControl 클래스는 템플릿이 generic.xaml을 정의하고있다 그래서
public class CustomControl : Selector
{
//stuff here
}
같은 다른 제어 할 수 있습니다 : 예를 들어
, 나는 다음과 같은 있다고 가정 CustomTabPanel의 유사 함 (내용물이 제거되었습니다)<Style TargetType="{x:Type local:CustomControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:CustomControl}">
<local:CustomTabPanel IsItemsHost="True"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
인스턴스 MainWindow.xaml 또는 어디서나이 컨트롤의 이름을 만들 수 있습니다.
내 질문에, 거기에 정의 된 MainWindow.xaml있는 CustomTabPanel 단추의 Click 이벤트를 어떻게 액세스 할 수 있습니까?
더 자세한 구현 정보가 필요하면이 설명을 가능한 한 간단하게 유지하려고 노력했습니다.
많은 도움을 주셔서 감사합니다.
크리스