User Control inherit from ListBox in Wpf?

Posted by Rev on Stack Overflow See other posts from Stack Overflow or by Rev
Published on 2010-04-04T05:29:23Z Indexed on 2010/04/04 5:33 UTC
Read the original article Hit count: 464

Filed under:
|

Hi.

I want to make a user Control in WPf with same properties and events like ListBox.(can add items , remove them , selecting ,...)

on way in windows App is use a user control which is inherit form ListBox. but in WPF I don't know how make User Control inherit from ListBox (or other WPF Control)!!!

I write this code but it had an exception

 public partial class InboxListItem : ListBox
{
    public InboxListItem()
    {
        InitializeComponent();
    }

and It's Xaml file

<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"
/>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpf-controls