I am attempting to use a GridView to display the contents of a delimited file. Initially the application reads the 1st 20 lines of the file and displays these in a single column with one row per line. The user then selects the field delimiter to use to parse the rows into columns.
My problem is when the 1st 20 rows are displayed only the first character from each row is displayed in the single column of the GridView;
I have confirmed that "csvImport.GetLine" is returning a single line from the text file (anything from ~400 to ~1500 characters) and that these are added correctly to the ObservableCollection.
How can I get the GridView to display the entire string for each row?
Thanks in advance for any help anyone can provide.
My problem is when the 1st 20 rows are displayed only the first character from each row is displayed in the single column of the GridView;
private
void
PreviewFile(
string
importFile)
{
string
line =
null
;
string
[] colData = {
"Column 1"
};
ObservableCollection<
string
> colRows =
new
ObservableCollection<
string
>();
FileImport.CSV csvImport =
new
FileImport.CSV(fileName);
for
(
int
iIndex = 0; iIndex < 20; iIndex++)
{
line = csvImport.GetLine();
if
(line ==
null
)
break
;
colRows.Add(line);
}
this
.gvText.ItemsSource = colRows;
this
.AddColumns(gvText, colData);
//this.gvText.ShowColumnHeaders = true;
}
private
void
AddColumns(RadGridView gv,
string
[] columnNames)
{
gv.Columns.Clear();
for
(
int
i = 0; i < columnNames.Length; i++)
{
gv.Columns.Add(
new
GridViewDataColumn
{
Header = columnNames[i],
DataMemberBinding =
new
Binding(String.Format(
"[{0}]"
, i)),
Width =
new
GridViewLength(1, GridViewLengthUnitType.Star)
//MaxWidth = maxWidth
});
}
}
I have confirmed that "csvImport.GetLine" is returning a single line from the text file (anything from ~400 to ~1500 characters) and that these are added correctly to the ObservableCollection.
How can I get the GridView to display the entire string for each row?
Thanks in advance for any help anyone can provide.