我想在WPF中实现一个拖放机制,但它不起作用...使用Windows-Forms工作,...
首先,我将AllowDrop设置为True.在Windows窗体中,您可以将项目拖动到richtextbox中并更改光标.
使用WPF ......没有任何反应.
nexT要点:实现DragEnter和DragDrop方法.我这样做就像在线手册所说的那样.(好吧,我不得不尝试更多的东西,因为在WPF中不存在DragDrop)我认为拖放的所有教程仅适用于Windowsforms,WPF没有任何内容......
richtextbox有问题吗?如果我将其更改为"allowDrop" - 没有任何反应.光标仍然是不允许的符号.
希望有人可以帮忙:)
我阅读的教程中的示例代码:
richTextBox1.AllowDrop = true;
void richTextBox1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.None;
if (e.Data.GetDataPresent(DataFormats.XXX))
{
e.Effect = DragDropEffects.Copy;
}
}
void richTextBox1_DragDrop(object sender, DragEventArgs e)
{
//intert in richtextbox ...
richTextBox1.methodeXY();
}
Run Code Online (Sandbox Code Playgroud) 我这样做:https : //stackoverflow.com/questions/12069002/autofac-resolve-with-and-without-named-parameter
我注册了一个接口。对于初始化,需要一个参数。第一次调用将传递此参数。
在另一个地方,我也想解析这个接口实例,但我不能传递这个参数。是否可以检查此接口是否已解析(在当前范围内。我使用 ASP.NET WEB API)?如果我在没有参数的情况下解决它,我会得到一个例外。
我需要检查当前 HttpRequest-scope 中是否已经解析(所以我可以在不传递参数的情况下获取它,因为如果它已经解析,注册的创建委托将不会被调用两次)
m_builder.Register<IMyClass((c, p) =>
{
//...
return new MyClass;
}).InstancePerHttpRequest();//.InstancePerApiRequest();
Run Code Online (Sandbox Code Playgroud) 是否有支持自助和网络托管(同时)的最佳做法?
我必须解决许多问题.在自托管autofac下无法正常工作,因为未设置HttpContext.Current并且无法在自托管中访问GlobalConfiguration.
是否还有其他问题需要注意?
我有这样的方法:
public JObject Get(int id)
{
return new JObject(new JProperty("Test", "Test"));
}
Run Code Online (Sandbox Code Playgroud)
如果我请求JSON,它工作正常,但如果我请求XML,我从web api框架获得HTTP-Errorcode 500(没有例外).XMLformatter似乎认为他可以编写json.我可以测试它:
bool test = GlobalConfiguration.Configuration.Formatters.XmlFormatter.CanWriteType(typeof(JArray));
bool test2 = GlobalConfiguration.Configuration.Formatters.XmlFormatter.CanWriteType(typeof(JObject));
bool test3 = GlobalConfiguration.Configuration.Formatters.XmlFormatter.CanWriteType(typeof(JProperty));
bool test4 = GlobalConfiguration.Configuration.Formatters.XmlFormatter.CanWriteType(typeof(JValue));
Run Code Online (Sandbox Code Playgroud)
它总是返回"true".我不想删除xmlformatter,但服务器抛出HTTP错误500是不可接受的,我不会生成并且无法解决.最好的是XMLformatter可以序列化对象......
是否可以禁用OData支持?
我不想要这种自动化,因为过滤应该在数据库级别完成,我想自己做.