나는 목록 상자와 같은 동일한 속성 및 이벤트와 WPF에서 사용자 컨트롤을 만들고 싶어. (선택, 제거, 항목을 추가 할 수 있습니다, ...)UserControl에서 ListBox에서 Wpf를 상속합니까?
윈도우 응용 프로그램의 방법에가 상속하는 사용자 컨트롤을 사용하다 ListBox를 만듭니다. WPF에서 모르겠다 ListBox에서 사용자 정의 컨트롤을 상속하는 방법 (또는 다른 WPF 컨트롤) !!!
나는이 코드를 작성하지만 예외
public partial class InboxListItem : ListBox
{
public InboxListItem()
{
InitializeComponent();
}
이 있고 그것은 당신이 UserControl이이 목록 상자에서 상속 만들어 질수 XAML 파일
<UserControl
x:Class="ListBoxControl.InboxListItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:myTypes="clr-namespace:ListBoxControl"
/>
UserControl 태그를 ListBox 태그로 변경할 수 있다고 생각합니다. –
'UC의 목록 상자'를 정의하는 경우에도 가능하며 listbox에서 동일한 작업을 수행하기위한 이벤트, 메서드 및 속성을 정의 할 수 있습니다. – Rev
예. 직접 추가 할 수 있습니다. 도움이 필요하면 http://stackoverflow.com/questions/6201343/wpf-custom-usercontrol-that-includes-a-control-versus-inherits-a-control –