TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aravindh Aravindhan
NA
1
2.6k
How to add datagridcomboboxcolumn in WPF C# DataGrid runtime
Mar 19 2016 3:40 AM
How a use Add DataGridComboBoxColumn in wpf DataGrid at Runtime.
User Specify total number of columns at runtime. According to runtime input the colunm should be created dynamically. Here i'm not able to add new row.
<
DataGrid
x:name
=
"dataGrid"
/>
DataGridTextColumn so =
new
DataGridTextColumn();
so.Header =
"S.No"
;
dataGrid.Columns.Add(so);
DataGridTextColumn name=
new
DataGridTextColumn();
name.Header =
" Name"
;
dataGrid.Columns.Add(name);
DataGridColumn age=
new
DataGridTextColumn();
age.Header =
"Age"
;
dataGrid.Columns.Add(age);
for
(
int
i = 1; i <= (new Random()).Next(1, 50); i++)
{
DataGridComboBoxColumn ss =
new
DataGridComboBoxColumn();
ss.Header = i;
List<
string
> list =
new
List<
string
>();
list.Add(
"Item 1"
);
list.Add(
"Item 2"
);
ss.ItemsSource = list;
ss.Width = 50;
ss.EditingElementStyle = style;
dataGrid.Columns.Add(ss);
}
Reply
Answers (
0
)
RawPrinterHelper does not work in Persian (farsi) Language :
Find record based on some common date range