Live Chat Icon For mobile
Live Chat Icon

How can I create a GroupBox that has a title and a visible border that encloses it’s content ?

Platform: WPF| Category: GroupBox

This can be created with the following piece of code.

[XAML]

<GroupBox Width='300' Height='410'>
    <GroupBox.Header>
      <Label>Employee Data</Label>
    </GroupBox.Header>
    <StackPanel>
    <TabControl Name='myTabControl' 
       TabStripPlacement='Top' 
           Margin='0, 0, 0, 10' Height='350'
       >
      <TabItem Name='PersonalInfo'>
        <TabItem.Header>_Personal Info</TabItem.Header>
        <StackPanel>
          <TextBlock>Employee</TextBlock>
          <TextBlock>Select your name</TextBlock>
          <ListBox Name='empName' SelectionChanged='updateSummary'>
            <ListBoxItem IsSelected='true'>Esther</ListBoxItem>
            <ListBoxItem>George</ListBoxItem>
            <ListBoxItem>Alan</ListBoxItem>
            <ListBoxItem>Eric</ListBoxItem>
          </ListBox>
         </StackPanel>
      </TabItem>
      <TabItem>
        <TabItem.Header>_Job Info</TabItem.Header>
          <StackPanel>
          <TextBlock>Select a job</TextBlock>
          <ListBox Name ='job' SelectionChanged='updateSummary'>
            <ListBoxItem IsSelected='true'>Programmer</ListBoxItem>
              <ListBoxItem>Tester</ListBoxItem>
              <ListBoxItem>Writer</ListBoxItem>
              <ListBoxItem>Manager</ListBoxItem>
            </ListBox>
          </StackPanel>
          </TabItem>
          <TabItem Name='Skill'>
            <TabItem.Header>_Skill</TabItem.Header>
            <StackPanel>
              <TextBlock>
                  Select your strongest skill
              </TextBlock>
          <ListBox Name='skills' SelectionChanged='updateSummary'>
              <ListBoxItem IsSelected='true'>C#</ListBoxItem>
              <ListBoxItem>Visual Basic</ListBoxItem>
              <ListBoxItem>.NET</ListBoxItem>
              <ListBoxItem>JScript</ListBoxItem>
            </ListBox>
        </StackPanel>
        </TabItem>
        <TabItem Name='Summary' >
          <TabItem.Header>Su_mmary</TabItem.Header>
          <StackPanel>
          <TextBlock Name='emp'/>
          <TextBlock Name='ejob'/>
          <TextBlock Name='eskill'/>
        </StackPanel>
      </TabItem>
    </TabControl>
      <Button Content='Show Summary' Click='goToSummaryTab'/>
    </StackPanel>
  </GroupBox>

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.