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

  • SEARCH
  • Home
  • 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 7813647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:56:37+00:00 2026-06-02T04:56:37+00:00

In my application i have a list box with a data template on his

  • 0

In my application i have a list box with a data template on his ItemTemplate, with some text blocks and check box.
I use this app to load an excel sheet, read its contents and add some itens to the list box (the objective is create a text block for description and a check box for a event).

My first idea was to use a DataGrid, but, when i’m reading the sheet, i have to create events for the check boxes (one event for each CB), but i could not do it with DataGrid.
Then, i went to the list box option, using the data template in ItemTemplate. But i was stuck on the “null” problem object when using ContentPresenter (from what i read, it’s because the item on the list box isn’t “ready”, some bug on WPF).

So, there’s another way to “automate” this ? Or i have to create each text block and check box ?

Thanks ! (sorry for the bad english)

  • 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-02T04:56:39+00:00Added an answer on June 2, 2026 at 4:56 am

    The orthodox way to implement this is to construct a view model object to represent each item you want to display. This view model would likely contain a bool property and a string property to hold your data. As you parse the excel sheet, for each entry, construct an instance of your view model, put the data in it, and then add it to a list

    After you read all your excel data, you can go about implementing the presentation of your data. First, declare a DataTemplate for your view model object. In this DataTemplate, bind a checkbox to your bool and a textblock/label to your string. Next, declare a ListBox and bind your view model list instance to ListBox.ItemsSource. If you did everything correctly you should see a listbox with each row containing a checkbox and a description.

    Note: if you want the user to be able to modify the data in your view model, be sure to implement INotifyPropertyChanged on your view model object and use TwoWay binding in your DataTemplate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a App.xaml template : <Application.Resources> <!-- template for recent history --> <DataTemplate
I want brief knowledge about Data Template for Customizing a control(like Combo Box,List Box
I am creating an application that will have a list of items that can
Imagine the typical type of application where you have a list of items with
In my application, I have list view. Selecting another item in it, triggers an
I have a List in the main application and I am trying to access
In the entry form of my wpf application, I have a list of buttons
I have an application that has a list of buttons and has customized tooltips.
I have an application where it displays list of files within a directory and
I am wondering is it possible to have a list box that has custom

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.