Well I’m designing a Custom WPF control – fore the sake of learning – that display logs message in a similar way Visual Studio does. I want to allow the user add messages by adding message istances to an Items collection, or by binding to an ItemSource. I think this is a well established pattern in many wpf controls, but I have no Idea on how achieve it. I know I can obtain the same result by adding a listview as a part of my control, but the project goal is learning, so I prefer avoid that solution. Any idea ?
Well I’m designing a Custom WPF control – fore the sake of learning –
Share
Have a read around the
ItemsControl, your custom control can inherit from anItemsControl, or a derivative of it. If you create anObservableCollectioncontaining your items and bind that to yourItemsSource, then your list will be automatically updated. You can style theItemTemplateandTemplateto give the list a different look and feel.There’s loads of info here