Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

A user control with 2 controls that autosize?

$
0
0

Hi,

I am new to WPF, but have been using Winforms for a while. 

In my winforms app, I have user controls (used extensively) that contain both a label and a data entry class (textbox, combobox, etc.)  The color of the label indicates if the data is required, valid, etc.  So there is a close coupling between them (hence the user control to contain them.)  Also, the label may be set to the left, right, or above the data control.  When it's to the left, I need to size the data control to fill the remaining space available.  When it's to the right, I need to calculate the size of the data element based on the width of the user control less the label width & offset.  You get the idea.  This is very easy in Winforms. 

I am trying to do the same in WPF.  But it seems to be much more difficult to do this using the approach I used above.  So I am sure I am doing it wrong.

Could someone point me in the right direction? 

I have been scouring my C# books and while they are quite infomative about all the other things I am doing wrong, I haven't yet found a clue about how to create a similar control. I tried Binging for an answer, but am clearly not able to figure out the correct search key words.

Any and all help is appreciated!

Thanks


me (and yes, I DO mark correct answers)


Viewing all articles
Browse latest Browse all 18858

Trending Articles