Click here to Skip to main content
16,012,611 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm not quite sure how to ask this but I want to create a custom control basically like the facebook toolbar chat. The problem im running into is the control has 2 parts the bottom part which displays a name of a user and when you click that I want my chat part to maximize up just as facebook and google talks does. The main problem I'm having with this is the control is limited to the grid size how can i make the top part of the custom control pop out above the grid. Thanks in advance for any insight
Posted

1 solution

One my idea is: create two separate controls representing two parts loosely coupled together. One control should use an interface of another control. In this way, you solve your layout problem separately from controls functionality.

Let's consider Top part uses interface of Button part (you can flip it; I don't know your functionality:
C#
public interface IBottomControl { /*..*/ }

public class BottomControl : IBottomControl { /*..*/ }

public class TopControl {
   public IBottomControl BottomControl { get; set; }
   //...
} //class TopControl

//...
//...

TopControl MyTopControl = new TopControl();
BottomControl MyBottomControl = new BottomControl();

//...

MyTopControl.BottomControl = MyBottomControl;


Can it fit your control functionality? (You did not share any information on it, so I cannot know exactly.)

It's important to understand loose coupling. Read http://en.wikipedia.org/wiki/Loose_coupling[^].

Here is another idea:

I found that layout problems are solved much better when you don't use Grid but use DockPanel instead. See:
http://msdn.microsoft.com/en-us/library/system.windows.controls.dockpanel.aspx[^],
http://www.wpftutorial.net/DockPanel.html[^].

—SA
 
Share this answer
 
v5
Comments
furyous 18-May-11 1:42am    
maybe I should give you some more info because I'm not sure what you are trying to get at here. I have a stack panel positioned at the bottom of the window with the orientation of horizontal basically what im wanting to do is add my custom control to the stack panel (this would be a persons chat) basically a button on bottom but when you click that the top expands into the chat part of the window the only issue im having is when you try to expand it the stackpanel doesnt let you go out of the bounds to show above the stackpanel

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900