什么净/ WPF功能,你会错过做在Silverlight中工作时? [英] What .Net/WPF features do you miss when working in Silverlight?

查看:160
本文介绍了什么净/ WPF功能,你会错过做在Silverlight中工作时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我开始使用Silverlight的工作,并立即注意到Silverlight的BCL和完整的.NET和WPF之间的区别。对于其中一些我找到了大解决方案的其他开发人员发布到网上,和其他人更复杂。哪些功能/类人,你感到惊讶/失望地发现,缺席Silverlight的类库,并努力你做了他们身边?

I recently started working with Silverlight and immediately noticed the difference between the Silverlight BCL and the full .Net and WPF. For some of them I've found great solutions posted online by other developers, and others were more complicated. What features/classes were you surprised/disappointed to find absent from the Silverlight class libraries, and what did you do to work around them?

有些雷人:

  1. 否事件触发动画 - 我创建了静态方法一个辅助类,用于连接每种类型的动画我用故事板的共享库,并在应用层面创建类的静态方法把它们放在一起,因为我将不得不在XAML中,如果工作在WPF。到目前为止,这一直是让我的动画组织了一个很好的解决方案和逻辑从我的事件处理程序。
  2. 的ScrollViewer不支持鼠标滚轮 - 亚当·库珀创建一个优秀的类库,增加了这一功能,需要最低限度的code。在任何Silverlight项目来实现。他的网站似乎是下降的时刻,所以这里有一个链接到蒂姆·豪雅的博客,介绍和链接到它(因此这将是可用的,当他的网站重新上线)。 添加鼠标滚轮支持的ScrollViewer在Silverlight
  3. SortedDictionary&LT; T,K&GT; 丢失我发现<一href="http://blogs.microsoft.co.il/blogs/tamir/archive/2007/10/15/sorted-dictionary-class-for-silverlight.aspx">this帖子包含一个实现,但使用它自己,我并没有结束。
  4. ResourceDictionary.MergedDictionaries不可 - 再次...发现谁实现这一点,并公布源$ C ​​$ C的人,但它似乎有点复杂。我会通过它可能工作一点点,但还没有做到这一点。 MergedDictionaries在Silverlight
  5. zIndex的附加属性仅在Canvas对象上。我张贴这是这里的SO一个问题,有人做了一个伟大的建议来包装我的容器中,收集,如果这是什么需要。感觉有点草率,但你必须做你必须做的。我的容器是嵌套的三个层次深,所以我可能需要弯曲他们都在画布对象和设置Canvas.ZIndex三次,每次事件。丑陋的罪过,但如果它是唯一的办法,那就这样吧。
  1. No event triggered animations - I created a helper class with static methods for attaching each type of animation I've used to storyboards in a shared library, and at the application level I create classes with static methods to put them all together as I would have in XAML if working in WPF. So far, this has been a good solution for keeping my animations organized and the logic out of my event handlers.
  2. ScrollViewer doesn't support the mouse wheel - Adam Cooper created an excellent class library that adds this functionality that requires the bare minimum of code to implement in any Silverlight project. His site seems to be down at the moment, so here's a link to Tim Heuer's blog that explains and links to it (so it'll be available when his site is back online). Add mouse wheel support to ScrollViewer in Silverlight
  3. SortedDictionary<T, K> is missing. I found this post that contains an implementation, but I didn't end up using it myself.
  4. ResourceDictionary.MergedDictionaries is not available - Again...found someone who implemented this and posted the source code, but it seemed to be a little complicated. I'll probably work through it a little bit, but have yet to do so. MergedDictionaries in Silverlight
  5. ZIndex attached property is only available on the Canvas object. I posted this as a question here on SO, and someone made a great suggestion to wrap my containers in a collection if that's what it takes. It feels a little sloppy, but you gotta do what you gotta do. My containers are nested three levels deep, so I may need to warp them all in Canvas objects and set the Canvas.ZIndex three times for each event. Ugly as sin, but if it's the only way, then so be it.

我很感兴趣,看看有什么其他常见问题的经验更丰富的Silverlight开发人员所遇到的和你做了什么来解决这些问题。

I'm interested to see what other common issues the more experienced Silverlight developers have come across and what you've done to fix them.

推荐答案

我从哪里开始? :)

Where do I begin? :)

  • MultiBinding
  • 的ElementName =结合
  • TemplateBinding ,只能是指直接性,不附加DP的
  • 的RelativeSource 结合
  • 绑定到子属性 - 例如, {绑定路径= Foo.Bar [0] .Baz}
  • 没有能力订阅更改了任意依赖属性的事件 - 类作者有明确定义的事件(在大多数情况下,只有一个或两个的SL控件的属性实际上做)
  • 视觉状态管理器需要控件作者知道所有样式可以状态时,控制写入,这完全打破的故事通过样式/模板,没有继承扩展的WPF促进
  • 没有装饰器
  • 在没有导航
  • 在没有依赖项属性继承
  • 在外部ResourceDictionaries否/苏茨基支持/合并词典
  • 验证故事很烂(这只是略好于WPF)
  • 印刷
  • &LT;二传手..值={结合...}/&GT; 不支持
  • No MultiBinding
  • No ElementName= binding
  • TemplateBinding can only refer to direct properties, not attached DP's
  • No RelativeSource binding
  • No binding to child properties - e.g, {Binding Path=Foo.Bar[0].Baz}
  • No ability to subscribe to changed events on any arbitrary dependency property - the class author has to explicitly define an event (and in most cases, only one or two properties in SL controls actually do)
  • The Visual State Manager requires the control author to know all style-able states when the control is written, which completely breaks the "extension through styles/templates, not inheritance" story that WPF promotes
  • No Adorners
  • No Navigation
  • No dependency property inheritance
  • No/sucky support for external ResourceDictionaries/merged dictionaries
  • Validation story sucks (it's only marginally better in WPF)
  • Printing
  • <Setter .. Value="{Binding ...}" /> is not supported

在那一些方法签名的变化没有充分的理由之上。例如,IIRC,在重载Dispatcher.Invoke是不是SL不同,只是忽略了参数,它可能尚未办理。或者,作为另一个例子,在的ObservableCollection WPF可以提高添加,删除,替换和移动事件 - 在SL这只是前三。

On top of that a number of method signatures changed for no good reason. E.g., IIRC, the overloads for Dispatcher.Invoke are different, instead of SL just ignoring the parameters it can't yet handle. Or as another example, ObservableCollection in WPF can raise Add, Remove, Replace and Move events - in SL it's only the first three.

由于我写code工作在这两个平台上,code最终被散落在战略模式和的#ifdefs。感觉像C ++一遍: - )

Since I write code to work on both platforms, the code ends up being littered in strategy patterns and #ifdefs. Feels like C++ all over again :-)

这篇关于什么净/ WPF功能,你会错过做在Silverlight中工作时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆