更新 DSL 中 DragOver 上的隔室形状轮廓颜色
我希望能够验证用户是否想要进行有效的拖放,并通过目标 CompartmentShape 的颜色来指示这一点,我已经完成了以下操作,这使我能够正确验证,我只需要更新UI
public override void OnDragDrop(DslDiagrams.DiagramDragEventArgs e)
{
BCSDataSourceTypes dataSourceType = GetDataSourceType(e.Data);
if (dataSourceType == BCSDataSourceTypes.Unknown)
{
return;
}
FieldInfo info = e.Data.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
object obj = info.GetValue(e.Data);
info = obj.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
System.Windows.DataObject dataObj = info.GetValue(obj) as System.Windows.DataObject;
if (dataObj != null)
{
SqlStoredProcedure storedProcedure = dataObj.GetData(typeof(SqlStoredProcedure)) as SqlStoredProcedure;
if (storedProcedure != null)
{
MessageBox.Show(string.Format("{0} is valid here", storedProcedure.Name));
}
}
e.Handled = true;
}
我的问题是我无法获得任何关于轮廓颜色的参考,非常感谢任何帮助。
I am looking to be able to validate if user is looking to make a valid drag drop and have this indicated by the colour of the destination CompartmentShape, I have done the following which gives me the ability to validate correctly, I just need to update the UI
public override void OnDragDrop(DslDiagrams.DiagramDragEventArgs e)
{
BCSDataSourceTypes dataSourceType = GetDataSourceType(e.Data);
if (dataSourceType == BCSDataSourceTypes.Unknown)
{
return;
}
FieldInfo info = e.Data.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
object obj = info.GetValue(e.Data);
info = obj.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
System.Windows.DataObject dataObj = info.GetValue(obj) as System.Windows.DataObject;
if (dataObj != null)
{
SqlStoredProcedure storedProcedure = dataObj.GetData(typeof(SqlStoredProcedure)) as SqlStoredProcedure;
if (storedProcedure != null)
{
MessageBox.Show(string.Format("{0} is valid here", storedProcedure.Name));
}
}
e.Handled = true;
}
My issue is that I am not able to get any reference to the Outline colour, any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加一个暴露的属性(右键单击形状并选择“添加暴露”)
祝好
You need to add an exposed property (right click on the shape and choose "Add Exposed")
Best regards