Hi all,
I am having problems with what I thought would be a pretty simple task. I have
a DataGrid which includes a CheckBox column. I am populating this dynamically
as follows:
dg.AutoGenerateColumns = false;
List<Part> prts = new List<Part>();
prts = Parts.GetPartsFromDbNotInMgo();
dg.ItemsSource = prts;
dataGridRowCount = prts.Count;
DataGridCheckBoxColumn chkColumn = new
DataGridCheckBoxColumn();
chkColumn.Header = "Delete";
chkColumn.Binding = new Binding("Selected");
dg.Columns.Add(chkColumn);
DataGridTextColumn prtNumColumn = new
DataGridTextColumn();
prtNumColumn.Header = "Part Number";
prtNumColumn.Binding = new Binding("PartNumber");
dg.Columns.Add(prtNumColumn);
DataGridTextColumn prtDescColumn = new
DataGridTextColumn();
prtDescColumn.Header = "Desc";
prtDescColumn.Binding = new Binding("PartDesc");
dg.Columns.Add(prtDescColumn);
DataGridTextColumn prtSuppColumn = new
DataGridTextColumn();
prtSuppColumn.Header = "Supplier";
prtSuppColumn.Binding = new Binding("Supplier");
dg.Columns.Add(prtSuppColumn);
DataGridTextColumn prtCmntColumn = new
DataGridTextColumn();
prtCmntColumn.Header = "Comment";
prtCmntColumn.Binding = new Binding("Comment");
dg.Columns.Add(prtCmntColumn);
I tried using a DataSet as the source for the DataGrid but couldn't get that
working either....
Now I have two issues -
I want a way to check/uncheck all the checkboxes in the column - using a
"select all" button or similar
And I need a way to cycle through the DataGrid and select only the checked
records for further action.
These probably will be very similar.
I tried setting the underlying values:
foreach (Part pt in dg.ItemsSource)
{
pt.Selected = chk;
}
And:
for (int x = 0; x < dataGridRowCount; x++)
{
((Part)dg.Items[x]).Selected = chk;
}
But this does not affect the actual checkboxes.
I have searched the web for hours and found lots of Web-based solutions but
cannot get anything that works here.
Can anyone point me in the right direction?
MICHAEL KING
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf