常见的WPF工具栏 [英] Common WPF toolbar

查看:419
本文介绍了常见的WPF工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在许多视图中使用常用工具栏。我的想法是:


工具栏是用户控件:  

< Grid> 
< dxb:MainMenuControl Horizo​​ntalAlignment =" Left"余量= QUOT; 0,0,0,0" VerticalAlignment = QUOT;陀螺" >
< dxb:BarButtonItem Content =" BarButtonItem"项目单击= QUOT; OnMenuAdd" Glyph =" {dx:DXImage Image = Add_16x16.png}" LargeGlyph =" {dx:DXImage Image = Add_32x32.png}" />
< dxb:BarButtonItem Content =" BarButtonItem"项目单击= QUOT; OnMenuEdit" Glyph =" {dx:DXImage Image = EditName_16x16.png}" LargeGlyph =" {dx:DXImage Image = EditName_32x32.png}" />
< dxb:BarButtonItem Content =" BarButtonItem" Glyph =" {dx:DXImage Image = Reset_16x16.png}" LargeGlyph =" {dx:DXImage Image = Reset_32x32.png}"项目单击= QUOT; OnMenuReturn" />
< / dxb:MainMenuControl>
< / Grid>

并在视图中插入:

< includeViews: GridMenu x:Name =" StatusFooterView" Grid.Row = QUOT; 0">< / includeViews:GridMenu> 

但我遇到了麻烦 如何将动作从工具栏传播到视图。我正在使用消息 

 Messenger.Default.Send ... 

但我不确定这是最好的方式。


任何人都可以建议更好的解决方案如何传播一个动作,或者工具栏如何更好地分享?


事先谢谢。 Tom 


解决方案


传播动作是什么意思?你的行为怎么样?您使用的是视图模型吗? 


但是这应该转移到WPF ...


问候,Chris


Hi,

I want to use common toolbar for many views. My idea is:

The toolbar is as user control: 

  <Grid>
    <dxb:MainMenuControl HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" >
      <dxb:BarButtonItem Content="BarButtonItem" ItemClick="OnMenuAdd" Glyph="{dx:DXImage Image=Add_16x16.png}" LargeGlyph="{dx:DXImage Image=Add_32x32.png}" />
      <dxb:BarButtonItem Content="BarButtonItem" ItemClick="OnMenuEdit" Glyph="{dx:DXImage Image=EditName_16x16.png}" LargeGlyph="{dx:DXImage Image=EditName_32x32.png}"/>
      <dxb:BarButtonItem Content="BarButtonItem" Glyph="{dx:DXImage Image=Reset_16x16.png}" LargeGlyph="{dx:DXImage Image=Reset_32x32.png}" ItemClick="OnMenuReturn"  />
    </dxb:MainMenuControl>
  </Grid>

and in view is inserted as:

    <includeViews:GridMenu x:Name="StatusFooterView" Grid.Row="0"></includeViews:GridMenu>

But I have a trouble  how propagate an action from toolbar to view. I'm use message 

Messenger.Default.Send ...

but I'm not sure that it is the best way.

Can anybody advise better solution how propagate an action, or how the toolbar better shared?

Thanks beforehand. Tom 

解决方案

Hi,

what do you mean by propagate an action? How is your action looking like? Are you using view models? 

But this should be moved to WPF...

Greeting, Chris


这篇关于常见的WPF工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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