wpf-layout

WPF Grid Items and Right Aligned Text

I have a WPF form where I'm trying to make a simple input form. Two labels, two textboxes, and a "submit" button. I have the layout pretty good, the only thing that I can't get is for my "Labels" to be right aligned inside their cells. I have tried both TextAlign="Right" and HorizontialAlign="Right", that moves the text ALL the way ov...

WPF Layout - Geting a column to fill available space

I have a list box that has a grid in it's template to allow 4 columns. One column is the actual text of the list box. I want that column to fill the available horizontal space. The column definitions are: <ControlTemplate TargetType="ListBoxItem"> <Grid ScrollViewer.CanContentScroll="True" Margin="2"> <Grid.ColumnDefini...

WPF - Grid woes and hopes for a named column

Is there a way to set your column (or row) to a named value rather than a number? I am about to go add a column to my grid. That means I have to go to every control after the new column and bump up its column number. This is tedious and error prone. Is there a way that I can bind to a named column? Maybe via resources? (As I write ...

WPF - GridSplitter with three columns

I have an app with grid with 3 columns. The grid splitter between the first and second columns works just fine. To get the splitter over to be between the second and third columns I made a column for the splitter. (So now the the third column is really the fourth.) When I resize the other columns also shrink. I assume that is becaus...

WPF: Layout Question

My user control has two sub-controls, a list and a detail. When nothing is selected in the list, I want the list to fill the entire control When something is selected, I want the list to fill the top half and the detail control the bottom half. Dynamically changing the visibility on the detail control is easy. What I'm stuck on is ho...

WPF: Textbox width guidelines

Is there a formula for textbox widths as a multiple of max. characters? I assume that if my textbox holds 40 characters, I should be able to plug it into a formula that looks like F(40) = (40 * X + Y). ...

WPF Layout algorithm woes - control will resize, but not below some arbitrary value.

I'm working on an application for a client, and one of the requirements is the ability to make appointments, and display the current week's appointments in a visual format, much like in Google Calendar's or Microsoft Office. I found a great (3 part) article on codeproject, in which he builds a "RangePanel", and composes one for each "pe...

WPF Formatting Issues - Automatically stretching and resizing?

I'm very new to WPF and XAML. I am trying to design a basic data entry form. I have used a stack panel holding four more stack panels to get the layout I want. Perhaps a grid would be better for this, I am not sure. Here is an image of my form in action: http://yfrog.com/7gscreenshot1impp And here is the XAML code that generates it:...

WPF dynamic layout: how to enforce square proportions (width equals height)?

I'm learning WPF and can't figure out how to enfore my buttons to take a square shape. Here is my XAML Markup: <Window x:Class="Example" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="368" Width="333"> <Window.Resources> <St...

Setting VerticalAlignment property to all controls

My WPF UserControl contains two stack panels and each of them contains labels, text boxes and radio buttons. I would like to set VerticalAlignment property to Center to all controls in my UserControl with as little code as possible. Now I have following solutions: brute force - put VerticalAlignment="Center" in each control define o...