How programmatically dock new element to DockPanel
var myControl = new MyUserControl(); DockPanel.SetDock(myControl, Dock.Left); myDockPanel.Children.Add(myControl); Also see here and here.
var myControl = new MyUserControl(); DockPanel.SetDock(myControl, Dock.Left); myDockPanel.Children.Add(myControl); Also see here and here.
You need to set DockPanel.Dock attached property for your elements and leave TextBox as the last element: <RadioButton HorizontalAlignment=”Stretch” HorizontalContentAlignment=”Stretch”> <DockPanel LastChildFill=”True”> <TextBlock DockPanel.Dock=”Left” VerticalAlignment=”Center” Text=”in location:” /> <Button DockPanel.Dock=”Right” Margin=”10,0,0,0″ Padding=”3,0″ Content=”…” /> <TextBox Margin=”10,0,0,0″> Path string </TextBox> </DockPanel> </RadioButton>
Stack Panel: The StackPanel, as the name implies, arranges content either horizontally or vertically. Vertical is the default, but this can be changed using the Orientation property. Content is automatically stretched based on the orientation (see screenshot below), and this can be controlled by changing the HorizontalAlignment or VerticalAlignment properties. Dock Panel: The DockPanel is … Read more
It sounds like you want a StackPanel where the final element uses up all the remaining space. But why not use a DockPanel? Decorate the other elements in the DockPanel with DockPanel.Dock=”Top”, and then your help control can fill the remaining space. XAML: <DockPanel Width=”200″ Height=”200″ Background=”PowderBlue”> <TextBlock DockPanel.Dock=”Top”>Something</TextBlock> <TextBlock DockPanel.Dock=”Top”>Something else</TextBlock> <DockPanel HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch” … Read more