更改 WF4 ActivityDesigner 主题
我想将重新托管的活动更改为:
需要在不使用 WorkflowViewElement
的情况下执行此操作,因为我不想丢失它的行为(断点、扩展)。
如果不可能,有没有办法更改 ActivityDesigner
标题背景颜色?
I want to change my rehosted activities look to:
Already tried ActivityDesignerTheme
Need to do it without using WorkflowViewElement
because I don't want to lose it's behaviors (breakpoint, expanding).
If it's not possible, is there a way to change ActivityDesigner
header background color?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@威尔
我也对编辑 DisplayName 时 ActivityDesigner 标头的默认行为感到恼火(尤其是将插入符号放置在字符串开头的部分)。我使用 Reflector 来查看 (System.Activities.Presentation.dll) 的实现,我注意到其中一些行为是在 OnApplyTemplate 中定义的。通过在我的自定义设计器类中重写此方法而不调用 base.OnApplyTemplate(),我能够使 DisplayName 在标头中只读(在我的情况下,这就是我所需要的,但我认为可以使用一些自定义那里的事件处理程序并调整行为)。
@Davi Fiamenghi)。我想更改标题颜色的一种方法是尝试在应用程序中“重新创建”此模板,并在自定义活动设计器中明确设置它。当然,它比仅仅复制它更复杂,因为它似乎引用了该程序集中定义的其他资源。
在同一程序集中使用 Reflector 进行更多挖掘,我发现 OnApplyTemplate 中使用的控件定义在 system/activities/presentation/workflowelementdesignerdefaulttemplate.baml (System.Activities.Presentation.g.resources) 下。这似乎是 ActivityDesigner 使用的默认控件模板(
希望这有帮助。
@Will
I was annoyed too by the default behavior of the ActivityDesigner header when editing the DisplayName (especially the part where it positions the caret at the beginning of the string). I used Reflector to peek (System.Activities.Presentation.dll) at the implementation and I noticed that some of this behavior is defined in OnApplyTemplate. By just overriding this method in my custom designer class and NOT calling base.OnApplyTemplate(), I was able to make the DisplayName read only in the header (in my case that was all I needed, but I think one can play with some custom event handlers in there and tweak the behavior).
@Davi Fiamenghi
Digging around some more with Reflector in the same assembly, I found the controls used in OnApplyTemplate defined under system/activities/presentation/workflowelementdesignerdefaulttemplate.baml (System.Activities.Presentation.g.resources). That seems to be the default control template used for ActivityDesigner (<ControlTemplate x:Key="WorkflowElementDesignerDefaultTemplate" x:Uid="ControlTemplate_1" ControlTemplate.TargetType="{x:Type swd:ActivityDesigner}">). I guess one way to change the header color would be to try to "re-create" this template in your application and set it explicitly in your custom activity designer. Of course it's more involved than just copying it, since it appears to be referencing other resources defined in that assembly.
Hope this helps.