Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8647463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:04:47+00:00 2026-06-12T13:04:47+00:00

I have searched extensively on Google and am struggling to find an easy example

  • 0

I have searched extensively on Google and am struggling to find an easy example to follow for an ItemsControl which I think I need to be able to do the following.

I currently have a Grid with a scrollable Listbox containing Checkboxes which works as expected using the following XAML layout

<Grid>
    <ListBox ScrollViewer.VerticalScrollBarVisibility="Auto" 
ItemsSource="{Binding Selections}" Margin="12,22,12,94">
    <ListBox.ItemTemplate>
            <DataTemplate>
                <CheckBox IsChecked="{Binding IsChecked}" 
        Content="{Binding Path=Item.SelectionName}">
                </CheckBox>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</Grid>

I now want to add a TextBox to the right of each Checkbox so it’s aligned horizontally with 1 Checkbox and 1 Textbox per row. I thought I would have to use an ItemsControl to allow two controls but using the ItemsControl as below I lose the ability to scroll

<Grid>
    <ItemsControl ScrollViewer.VerticalScrollBarVisibility="Auto" 
    ItemsSource="{Binding Selections}" Margin="12,22,12,94">
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <CheckBox IsChecked="{Binding IsChecked}" 
        Content="{Binding Path=Item.SelectionName}">
                </CheckBox>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</Grid>

Also, if I try and add a textbox similar to

    <DataTemplate>
        <CheckBox IsChecked="{Binding sChecked}" Content="{Binding Path=Item.BookieName}" />
        <TextBox />
    </DataTemplate>

I get an error The object 'DataTemplate' already has a child and cannot add 'TextBox'

Essentially, I want it to look like this

enter image description here

Can anyone give me a few pointers on how to structure the controls in XAML to get my desired layout?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:04:48+00:00Added an answer on June 12, 2026 at 1:04 pm

    Just use a StackPanel in your DataTemplate and set the orientation to horizontal.

     <DataTemplate>
        <StackPanel Orientation="Horizontal">
        <CheckBox IsChecked="{Binding sChecked}" Content="{Binding Path=Item.BookieName}" />
        <TextBox />
        </StackPanel>
    </DataTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched extensively and haven't been able to find any guidelines or posts
I have searched extensively and cannot for the life of me find any information
I have searched extensively on this, but cannot find the solution to my problem.
I have searched this site extensively but cannot find a solution. Here is the
I have searched for a general solution to this but only find answers to
I have searched all morning and yesterday afternoon and still cannot find an solution
I have searched and searched for this but I think my terminology isn't correct
I have searched around but have been unsuccessful in determining whether the following approach
I have searched quite extensively on how to output messages in Oracle SQL. I
Let me start by saying I've extensively searched for answers on google and more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.