I have read you can use this to manually invoke the context menu.
this
.radGridView1.ContextMenuManager.ShowContextMenu(radGridView1.CurrentCell)
)
private
void
toolstripMenuCopy_Click(
object
sender, EventArgs e)
{
string
temp =
""
;
for
(
int
i = 0; i < radListView.SelectedItems.Count; i++)
{
temp = temp + listItem[radListView.SelectedIndex].ToString() + Environment.NewLine;
}
Clipboard.SetText(temp);
}
//listItem[] ={ "http://www.picasa.........", ...}
I have a List called “myResults”. When the list contains at least one item, I’m trying to populate a RadGridView w/ info for the list; the GridView is called “gvMyResults”. However, sometimes, during this update of the DataSource, I get an exception saying, “Bounds cannot be changed while locked”, and a red X is displayed across my GridView. I added this Dispatcher wrapper around my update, but I’m still seeing the same error sometimes. It’s difficult to troubleshoot, because it does not happen every time. I've tried fixing this two separate ways, but they both still show the occasional error. Does anyone know how to stop this “bounds cannot be changed while locked” error?
First attempt to fix this problem:
Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate()
{
this.gvMyResults.DataSource = myResults;
});
Second attempt to fix this problem:
_Context.Send(x =>
{
this.gvMyResults.DataSource = myResults;
}, null);
using
(OracleConnection oraConn =
new
OracleConnection(sConn))
{
OracleCommand sasCommand = oraConn.CreateCommand();
sasCommand.CommandType = CommandType.Text;
sasCommand.CommandText = sSQL;
OracleDataAdapter da =
new
OracleDataAdapter(sasCommand);
DataTable dt =
new
DataTable();
try
{
oraConn.Open();
da.Fill(dt);
radGridView1.DataSource = dt;
}
catch
{
}
}
this.radGridView1.Relations.AddSelfReference(this.radGridView1.MasterTemplate, "id", "parentid");