Borders with captions in WPF

2019-04-06 18:09发布

问题:

Does anybody know how to get a border in WPF with a caption, i.e. the way web browsers display <fieldset> tags ? Is there an easy way, like setting a property, or am I going to have to make a ControlTemplate ?

回答1:

Perhaps a GroupBox?

<GroupBox>
    <GroupBox.Header>
      <Label>Hello</Label>
    </GroupBox.Header>
    <TextBlock Text="World!" />
</GroupBox>