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 167519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:17:22+00:00 2026-05-11T12:17:22+00:00

Can anyone tell me if it is possible to create and add data to

  • 0

Can anyone tell me if it is possible to create and add data to an unbound WPF Toolkit datagrid.

If it is in fact possible to do, can someone please provide an example of the following:

Programmatically: create a datagrid create a datagridtextcolumn add the datagridtextcolumn to the datagrid create a datagridrow set the text of the datagridtextcolumn for the row to ‘test’ add the datagridrow to the datagrid

I would like to create a datagrid that is unbound. My reason is that i would like to create a template column with multiple controls of different types and numbers – 2 checkboxes, 4 radiobuttons, 5 checkboxes, etc. – which are dynamically added at runtime and since the type and number are unknown cannot think of a way to databind them. I am happy to work unbound.

Thank you in advance!

[Edit: I have not yet found an appropriate answer to this question and have started a bounty]

  • 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. 2026-05-11T12:17:23+00:00Added an answer on May 11, 2026 at 12:17 pm

    You can use UserControl that will create desired controls.

    Window1.xaml (snippet)

    <dg:DataGrid ItemsSource='{Binding}' CanUserAddRows='False' AutoGenerateColumns='False'>     <dg:DataGrid.Columns>         <dg:DataGridTemplateColumn Header='Test' MinWidth='100'>             <dg:DataGridTemplateColumn.CellTemplate>                 <DataTemplate>                     <my:ControlA Foo='{Binding}'></my:ControlA>                 </DataTemplate>             </dg:DataGridTemplateColumn.CellTemplate>         </dg:DataGridTemplateColumn>      </dg:DataGrid.Columns> </dg:DataGrid> 

    Window1.xaml.cs

    public partial class Window1 : Window {     List<Foo> _items = new List<Foo>();      public Window1()     {         InitializeComponent();          _items.Add(new Foo { CheckBoxCount = 2, TextBoxCount = 1 });         _items.Add(new Foo { CheckBoxCount = 3, TextBoxCount = 0 });          DataContext = _items;     } } 

    ControlA.xaml

    <UserControl x:Class='Demo.ControlA'     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>     <StackPanel x:Name='_placeHolder'>     </StackPanel> </UserControl> 

    ControlA.xaml.cs

    public partial class ControlA : UserControl {     public ControlA()     {         InitializeComponent();          Loaded += new RoutedEventHandler(ControlA_Loaded);     }      void ControlA_Loaded(object sender, RoutedEventArgs e)     {         if (Foo != null)         {             for (int it = 0; it < Foo.CheckBoxCount; it++)                 _placeHolder.Children.Add(new CheckBox());              for (int it = 0; it < Foo.TextBoxCount; it++)                 _placeHolder.Children.Add(new TextBox());         }     }      public static readonly DependencyProperty FooProperty =         DependencyProperty.Register('Foo', typeof(Foo), typeof(ControlA));      public Foo Foo     {         get { return (Foo)GetValue(FooProperty); }         set { SetValue(FooProperty, value); }     } } 

    Foo.cs

    public class Foo {     public int TextBoxCount { get; set; }     public int CheckBoxCount { get; set; } } 

    Hope this helps.

    P.S. It should be possible to refactor DataGridTemplateColumn into separate UserControl.

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

Sidebar

Related Questions

Can anyone please tell me if it is possible to create an SSRS 2008
Can anyone please tell me how to create multiple instance of skype with different
Can anyone tell me if it is possible to create a view in share
Can any one tell me if its possible to create a stored procedure in
CAn anyone tell me is it is possible to display the files in computer
Can anyone tell me if its possible to validate a link with php? By
Can anyone tell me if it is possible to mix views arguments with static
Can anyone who has used three.js tell me if its possible to detect webgl
Can anyone tell me if it's possible to change the interval of an NSTimer
Can anyone tell me how to best possible way to convert the following code

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.