I would like to bind the PropertyGrid from List<string> that i have.
I want to use the PropertyGrid as a detail form my list but i want onle several properties:
File name (this is the file from my list)
and after that 3 section contain 2 properties section with headline
for example:
file1.doc
the 3 section:
File Details (this is section 1)
Size: sere i want text box
Property 2: Text-box
Property 3: Text-box
Section 2
Property 1 Text-box
Property 2 Text-box
Property 3 Text-box
Section 3
Property 1 Text-box
Property 2 Text-box
Property 3 Text-box
d
d
d
I want to use the PropertyGrid as a detail form my list but i want onle several properties:
File name (this is the file from my list)
and after that 3 section contain 2 properties section with headline
for example:
file1.doc
the 3 section:
File Details (this is section 1)
Size: sere i want text box
Property 2: Text-box
Property 3: Text-box
Section 2
Property 1 Text-box
Property 2 Text-box
Property 3 Text-box
Section 3
Property 1 Text-box
Property 2 Text-box
Property 3 Text-box
d
d
d
4 Answers, 1 is accepted
0
Hello Gshhar,
Thank you for wiring.
I am not sure that the property grid is suitable for your purposes, because If you bind it to the list it will display its properties not the contained ones (like Count and Capacity). RadPropertyGrid support custom properties but I think just a regular grouped grid will do the job in this case. For example if you initialize the grid like in the following code snippet it will look like in the attached image:
I hope this will be useful.
Regards,
Dimitar
Telerik
Thank you for wiring.
I am not sure that the property grid is suitable for your purposes, because If you bind it to the list it will display its properties not the contained ones (like Count and Capacity). RadPropertyGrid support custom properties but I think just a regular grouped grid will do the job in this case. For example if you initialize the grid like in the following code snippet it will look like in the attached image:
public
Form1()
{
InitializeComponent();
radGridView1.ShowColumnHeaders =
false
;
radGridView1.ShowGroupPanel =
false
;
radGridView1.ShowRowHeaderColumn =
false
;
radGridView1.AllowAddNewRow =
false
;
radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
radGridView1.GroupDescriptors.Add(
new
Telerik.WinControls.Data.GroupDescriptor(
"Section"
));
radGridView1.DataSource = GetTable();
}
static
DataTable GetTable()
{
DataTable table =
new
DataTable();
table.Columns.Add(
"Property"
,
typeof
(
string
));
table.Columns.Add(
"Property Value"
,
typeof
(
string
));
table.Columns.Add(
"Section"
,
typeof
(
string
));
for
(
int
i = 0; i < 10; i++)
{
table.Rows.Add(
"Property "
+ i,
"TextBox"
,
"Section "
+ (i / 3));
}
return
table;
}
I hope this will be useful.
Regards,
Dimitar
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Gshhar
Top achievements
Rank 1
answered on 24 Aug 2014, 12:55 PM
Thanks a lot Dimitar, it's exactly what i looking for, i only want some minor changes and need your help:
1. I changed the GetTable function signature to: ​GetTable(IReadOnlyCollection<RadListDataItem> files)
After loop over my collection this operaion failed in the second loop because a column named 'Select' already belongs to this DataTable.
How can i create new Table each loop ?
2. I added another column: table.Columns.Add("Select", typeof(bool));
how can i set the width of the column ?
1. I changed the GetTable function signature to: ​GetTable(IReadOnlyCollection<RadListDataItem> files)
After loop over my collection this operaion failed in the second loop because a column named 'Select' already belongs to this DataTable.
How can i create new Table each loop ?
2. I added another column: table.Columns.Add("Select", typeof(bool));
how can i set the width of the column ?
0
Gshhar
Top achievements
Rank 1
answered on 24 Aug 2014, 02:50 PM
And another question is how to loop through the grouped grid ?
0
Hello Gshar,
Thank you for writing back.
1. By default you cannot add two columns with the same name to a datatable. In addition you should be able to bind the grid directly to the collection without converting it to data table (if you need to use data table please send us your current implementation so we can determine the reason for the issue). More information is available here: Bindable Types.
2. The Width property of the column can be used for changing the width:
Detailed information can be found here: Resizing columns programatically.
3. Looping through grouped grid is the same like in a regular grid. More information is available here: Iterating Rows. However if you need some specific functionality please specify what is it. This will allow me to give you better suggestions.
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Thank you for writing back.
1. By default you cannot add two columns with the same name to a datatable. In addition you should be able to bind the grid directly to the collection without converting it to data table (if you need to use data table please send us your current implementation so we can determine the reason for the issue). More information is available here: Bindable Types.
2. The Width property of the column can be used for changing the width:
void
Form1_Load(
object
sender, EventArgs e)
{
radGridView1.Columns[
"Property"
].Width = 300;
}
Detailed information can be found here: Resizing columns programatically.
3. Looping through grouped grid is the same like in a regular grid. More information is available here: Iterating Rows. However if you need some specific functionality please specify what is it. This will allow me to give you better suggestions.
I hope this helps. Should you have any other questions do not hesitate to ask.
Dimitar
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.