Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF looking for way to create border with text labeling the frame

Tags:

c#

forms

wpf

xaml

Something like this

enter image description here

was available in windows forms, but i forget what it was called. But I'm just looking for some good borders to outline regions that allows me to name the region.

like image 874
James Joshua Street Avatar asked Aug 05 '13 21:08

James Joshua Street


People also ask

How do you make a grid border in WPF?

<Grid> <Border BorderBrush="Black" BorderThickness="2"> <Grid Height="166" HorizontalAlignment="Left" Margin="12,12,0,0" Name="grid1" VerticalAlignment="Top" Width="479" Background="#FFF2F2F2" /> </Border> ... and so on ...

How do you add a border in XAML?

To apply a border to a XAML element, you can place the element within a Border element, The BorderThickness and BorderBrush are two main properties of a Border The BorderBrush property represents the brush that is used to draw the border. The BorderThickness property represents the thickness of the border.

What is frame in WPF?

The WPF Frame control using XAML and C# supports content navigation within content. A Frame can be hosted within a Window, NavigationWindow, Page, UserControl, or a FlowDocument control.


1 Answers

Sounds like you need a GroupBox. I wrote an article about these but I won't post a link, as I don't like using StackOverflow for promoting web sites. I will post the opening example XAML though so you can see the effect and check if it's what you want.

<Window x:Class="GroupBoxDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="GroupBox Demo"
        Width="250"
        Height="180">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <GroupBox Header="Mouse Handedness">
            <StackPanel>
                <RadioButton Content="Left-Handed" Margin="5"/>
                <RadioButton Content="Right-Handed" Margin="5" IsChecked="True"/>
            </StackPanel>
        </GroupBox>

        <GroupBox Grid.Row="1" Header="Double Click Speed">
            <Slider Margin="5" />
        </GroupBox>
    </Grid>
</Window>

It looks like:

WPF Groupbox

like image 132
BlackWasp Avatar answered Sep 28 '22 07:09

BlackWasp