开发者

How to add DockContent into DockPane using DockPanel Suite

As th开发者_如何学编程e title.

For example I have multi chat rooms with multiple userlist. I added all the userlist onto the right dock.

Problem is if the user changes the userlist into bottom dock, I'll still be adding to the right dock.

How do I add a content into a pane such that even if the user changes the location, it'll add to the correct place?

Is there any place with gd documentation of WeiFenLuo's DockPanel Suite?


Hard to answer your question without knowing how you have your DockContent(s) set up.

Assuming you have two classes:

public class ChatRoom : DockContent{}

public class UserList : DockContent{}

All you should have to do is create a dependency between the two instances that relate to one another. Again it is hard to tell you which way is best without knowing more specifics, but you can just add a method that registers the specific ChatRoom with the UserList, and everytime a user leaves or enters the room, you add/remove the user from the list.

public class ChatRoom : DockContent
{
    private UserList MyUserList;

    public void Register(UserList list)
    {
        MyUserList = list;
    }

    public void UserIn(User newUser)
    {
        // Code for adding user to chat room
        MyUserList.Add(newUser);
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜