How can i handle dynamic content in WPF?
I'm tryin开发者_运维百科g to realize a chat app using WPF with MVVM approach. I would like to have an interface similar to the last Skype version, with the BuddlyList on the left side and the active chat on the center-right. When the user clicks on a name, the chat panel appears on the right. I want to use DataBinding and I'm asking which is the best UI component to use for handling chat sessions:
A panel with different child panels (all hidden minus the active): maybe simpler to handle but maybe heavy for memory.
A panel that changes content according to the active session (using filters to ObservableCollection): maybe lighter but harder to realize?
Another type of container.
Other solutions.
Can anyone help me with understanding which would be a good way to work with WPF?
As you will have to handle collections of data, like your user list or the list of messages in a chat, you will have to use a control, you can databind the collection to. Therefore you need a control deriving from ItemsControl. There are ListBox or ListView (extended ListBox) or DataGrid for your purpose. Which to go for depends on what you want to do in detail regarding styling, selection of rows, etc.
All of these are suitable in general, so you will just have to do a bit of research to find out, which one is best for what you want to achieve.
精彩评论