Hi Guys,
Sorry about bringing up a probably n00b question.
I have a string which is in the format of a csv. I have parsed the csv and want to show the contents in a RadGridView.
This is what I have done and a bit lost at the moment.
C#
XAML:
I call this GridView from the following code:
C#
The output is shown as shown int he attachment.
Not exactly the output I was looking for.
Since the string[] keeps changing each time I call the GridView depending on the parameters. How do I dynamically build the RadGridView. ?? Any helps is appreciated.
Sorry about bringing up a probably n00b question.
I have a string which is in the format of a csv. I have parsed the csv and want to show the contents in a RadGridView.
This is what I have done and a bit lost at the moment.
C#
//COnstructor accepting string
public
ucCsvEditor(
string
csv)
{
InitializeComponent();
using
(StringReader sr =
new
StringReader(csv))
{
var reader =
new
CsvReader(sr);
//CSVReader will now read the whole file into an enumerable
while
(reader.Read())
{
string
[] records = reader.CurrentRecord;
string
[] headers = reader.FieldHeaders;
variablesValue.Add(records);
variablesHeader.Add(headers);
}
//ObservableCollection<string[]> myCollection = new ObservableCollection<string[]>(variablesValue);
radGridView.ItemsSource = variablesValue;
//reader.FieldHeaders
}
}
XAML:
<
Grid
>
<
telerik:RadGridView
x:Name
=
"radGridView"
Grid.Row
=
"0"
AutoGenerateColumns
=
"True"
IsReadOnly
=
"False"
CanUserDeleteRows
=
"False"
/>
</
Grid
>
I call this GridView from the following code:
C#
if
(!
string
.IsNullOrEmpty(csvData))
{
RadWindow winCsvEditor =
new
RadWindow();
ucCsvEditor temp =
new
ucCsvEditor(csvData);
winCsvEditor.Content = temp;
winCsvEditor.Header =
"CSV Editor"
;
winCsvEditor.Owner =
this
;
winCsvEditor.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
winCsvEditor.CanClose =
true
;
winCsvEditor.ShowDialog();
}
else
{
MessageBox.Show(
"No Variables available to edit"
);
}
The output is shown as shown int he attachment.
Not exactly the output I was looking for.
Since the string[] keeps changing each time I call the GridView depending on the parameters. How do I dynamically build the RadGridView. ?? Any helps is appreciated.