小编Ben*_* K.的帖子

使用鼠标事件获得ScrollViewer的PanningMode行为

我试图以与在PDF文档中平移相同的方式平移ScrollViewer的内容(滚动到放大/缩小,单击+拖动以平移)ScrollViewer具有为触摸事件内置的此功能(PanningMode) ,但这似乎并没有转化为Click + Drag事件.有没有办法告诉它/模仿这个功能?

wpf scrollviewer panning

9
推荐指数
1
解决办法
2268
查看次数

C#MEF:导出一种类型的多个对象,并导入特定的对象

我有一个应用程序,它导出同一个类的几个对象,以及只导入特定类的插件.例如

public class Part
{
  string name;
  public Part(string nm)
  {
    name = nm;
  }
}

public class Car //Exports ALL Parts of the Car
{
  [Export(typeof(Part))]
  public Part steeringWheel = new Part("SteeringWheel");

  [Export(typeof(Part))]
  public Part engine = new Part("Engine");

  [Export(typeof(Part))]
  public Part brakes = new Part("Brakes");
}

public class SystemMonitorPlugin //Imports only SOME Parts from the Car
{
  [Import(typeof(Part))]
 public Part engine;

  [Import(typeof(Part))]
  public Part brakes;
}
Run Code Online (Sandbox Code Playgroud)

有人可以解释我是如何实现这种行为的吗?

c# wpf import mef export

3
推荐指数
1
解决办法
4939
查看次数

标签 统计

wpf ×2

c# ×1

export ×1

import ×1

mef ×1

panning ×1

scrollviewer ×1