This is a migrated thread and some comments may be shown as answers.

Editable string list/collection

2 Answers 200 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Philipp Kraft
Top achievements
Rank 1
Philipp Kraft asked on 16 Mar 2010, 10:36 AM
Hi,

Is it possible to bind a string list to a gridView such that new entries can be created and the entries can be edited in the grid?
I am using Version 2009.3.1314.35.

Thank you.

Philipp

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 16 Mar 2010, 11:41 AM
Hi Philipp Kraft,

Yes it is possible but you have to create a simple wrapper around the string data:

public Window1()
{
    InitializeComponent();
  
    var wrappedData =
        from str in this.StringData()
        select new StringWrapper { Text = str };
  
    this.playersGrid.ItemsSource = wrappedData.ToList();
}
  
// same string data
public IEnumerable<string> StringData()
{
    return new List<string>() { "one", "two", "three"};
}
  
// wrapper class for string
public class StringWrapper
{
    public string Text { get; set; }
}

Once you bind the grid to the wrapped data you will be able to edit the strings and also you will be able to insert new data by pressing the Insert key.

Hope this helps.

Greetings,
Milan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Philipp Kraft
Top achievements
Rank 1
answered on 16 Mar 2010, 02:05 PM
This helps indeed.
Many thanks.
Philipp
Tags
GridView
Asked by
Philipp Kraft
Top achievements
Rank 1
Answers by
Milan
Telerik team
Philipp Kraft
Top achievements
Rank 1
Share this question
or