|
Posted
over 10 years
ago
by
ksukat
Didn't see project example or documentation describing how to create a grid like the appointment grid shown on sourcegrid.codeplex.com. Anyone have any pointers ?
Also, the install says to copy the sourcegrid.dll file. First I am using visual
... [More]
studio 2010 professional. Second, the zip download doesn't seem to have that file. It has sourcegrid2.dll under sourcegrid project bin/release, should that be used ? If so, should that be copied to my project directory, or somewhere else?
thanks.
[Less]
|
|
Posted
over 10 years
ago
by
brightak
And the hits keep coming.
So, SourceGrid does have a DrapDrop event, you just have to remember to enable AllowDrop (ooops).
void MyGrid_DragDrop(object sender, DragEventArgs e)
{
Point p =
... [More]
this.PointToClient(new Point(e.X, e.Y));
int _X = this.Location.X;
int _Y = this.Location.Y;
int c = -1;
int r = -1;
while (_X < p.X)
_X += this.Columns[++c].Width;
while (_Y < p.Y)
_Y += this.Rows[++r].Height;
//Selected cell is this[r, c].
Console.WriteLine(" row = " + r + " col = " + c);
}
[Less]
|
|
Posted
over 10 years
ago
by
brightak
And the hits keep coming.
So, SourceGrid does have a DrapDrop event, you just have to remember to enable AllowDrop (ooops).
void MyGrid_DragDrop(object sender, DragEventArgs e)
{
Point p =
... [More]
this.PointToClient(new Point(e.X, e.Y));
int _X = this.Location.X;
int _Y = this.Location.Y;
int c = -1;
int r = -1;
while (_X < p.X)
_X += this.Columns[++c].Width;
while (_Y < p.Y)
_Y += this.Rows[++r].Height;
//Selected cell is this[r, c].
Console.WriteLine(" row = " + r + " col = " + c);
}
[Less]
|
|
Posted
over 10 years
ago
by
brightak
I spoke too soon. MouseUp doesn't help if you're dragging and dropping.
In case you were curious, here is my Hittest solution:
int _MouseX = e.Location.X;
int _MouseY = e.Location.Y;
int _X =
... [More]
this.Location.X;
int _Y = this.Location.Y;
int c = -1;
int r = -1;
while (_X < _MouseX)
_X += this.Columns[++c].Width;
while (_Y < _MouseY)
_Y += this.Rows[++r].Height;
//Selected cell is this[r, c].
Console.WriteLine(" row = " + r + " col = " + c);
[Less]
|
|
Posted
over 10 years
ago
by
brightak
I spoke too soon. MouseUp doesn't help if you're dragging and dropping.
In case you were curious, here is my Hittest solution:
int _MouseX = e.Location.X;
int _MouseY = e.Location.Y;
int _X =
... [More]
this.Location.X;
int _Y = this.Location.Y;
int c = -1;
int r = -1;
while (_X < _MouseX)
_X += this.Columns[++c].Width;
while (_Y < _MouseY)
_Y += this.Rows[++r].Height;
//Selected cell is this[r, c].
Console.WriteLine(" row = " + r + " col = " + c);
[Less]
|
|
Posted
over 10 years
ago
by
brightak
I get that SourceGrid does not support a DropDrop event (booo!) but it does support a MouseUp event. If I can figure out which cell is being dropped to, I'm almost home. Any ideas?
Thanks in advance.
|
|
Posted
over 10 years
ago
by
brightak
I get that SourceGrid does not support a DropDrop event (booo!) but it does support a MouseUp event. If I can figure out which cell is being dropped to, I'm almost home. Any ideas?
Thanks in advance.
|
|
Posted
over 10 years
ago
by
BitterBiped
Hi, I am making the transition from SourceGrid 2 to SourceGrid 4.
I need to validate a cells value before the cell's Edit Ended is called.
The IController does not have an equivalent OnEditEnding for OnEditStarting. So there seems to be no way
... [More]
to cancel an edit end event if the value is not valid.
In SourceGrid 2 I could attach a SourceGrid2.PositionCancelEventHandler onto the BehavioulModel EditEnded event, and set Cancel = true, but I do not know how to do this in SourceGrid 4.
Can anyone help?
Thanks.
[Less]
|
|
Posted
over 10 years
ago
by
BitterBiped
Hi, I am making the transition from SourceGrid 2 to SourceGrid 4.
I need to validate a cells value before the cell's Edit Ended is called.
The IController does not have an equivalent OnEditEnding for OnEditStarting. So there seems to be no way
... [More]
to cancel an edit end event if the value is not valid.
In SourceGrid 2 I could attach a SourceGrid2.PositionCancelEventHandler onto the BehavioulModel EditEnded event, and set Cancel = true, but I do not know how to do this in SourceGrid 4.
Can anyone help?
Thanks.
[Less]
|
|
Posted
over 10 years
ago
by
mikey0727
Hi -
I have a sourcegrid datagrid with a table behind it. I have multiple threads (4) updating the backing table, and so - thus I have 2 copies of the table, and merge them from the UI thread.
Some things to note:
The table is guarded by a
... [More]
readerwritterlockslim. Lock contention doesn't seem to be an issue.
There is no database behind this table, its for display purposes only.
Only columns 3 or 4 can change during the times I care about performance-
With about 8000 rows, I see merge times (used high precision stopwatch to measure) of about 150 milliseconds average, 800 worst case when lots of cells change.
Would an arrayGrid be better here? Every column in the table does not have the same type, so I'm unsure how to do it properly;
I played with suspend / resume layout and Invalidate Range / Update (as shown below) but I saw worse results.
Thanks for any tips / input -
Code looks like the following:
Each Thread is doing this to update their rows -
private void UpdateGridStatusDataTableRow(int rowIndex, string stateString, string directionString)
{
_gridTableSlimLock.EnterWriteLock();
DataRow row = _gridDatasetStatusTable.Rows[rowIndex];
row.BeginEdit();
row[3] = stateString;
row[4] = directionString;
row.EndEdit();
_gridTableSlimLock.ExitWriteLock();
}
About once per second, the merge is called from the main UI thread -
public void RefreshGrid()
{
//expSetGrid.SuspendLayout();
//expSetGrid.InvalidateRange(new Range(0, 3, _lastRow, 4));
_experimentSet.MergeGridStatusDataTable(_gridSource);
//expSetGrid.Update();
//expSetGrid.ResumeLayout(false);
}
public void MergeGridStatusDataTable(DataTable uiDatatable)
{
_gridTableSlimLock.EnterWriteLock();
uiDatatable.Merge(_gridDatasetStatusTable, false);
//_gridDatasetStatusTable.AcceptChanges();
_gridTableSlimLock.ExitWriteLock();
}
The Grid is Initialized as follows:
//Disable Constraints
_gridSource.Constraints.Clear(); //DataTable
_view = _gridSource.DefaultView; //DataView
_view.AllowEdit = false;
_view.AllowDelete = false;
_view.AllowNew = false;
_bdv = new BoundDataView(_view); //BoundDataView
expSetGrid.DataSource = _bdv; //SourceGrid.DataGrid
[Less]
|