我有一份WPF申请。 我对这一应用有不同的用户,每个用户与这些用户有不同程度的联系。 拥有较高水平的护卫人员可以接触一些菜单。
是否有办法在菜单项目之间转用? 是否把单个菜单项目集中起来,能够有效地做到这一点? 是否有其他办法这样做?
我有一份WPF申请。 我对这一应用有不同的用户,每个用户与这些用户有不同程度的联系。 拥有较高水平的护卫人员可以接触一些菜单。
是否有办法在菜单项目之间转用? 是否把单个菜单项目集中起来,能够有效地做到这一点? 是否有其他办法这样做?
You could achieve this using bindings and converters. Basically if you have a property on the DataContext
of the menu (which will be inherited by the menu items) that specifies the level of permissions; then you could bind that to the visibility of the menu items.
Obviously, because the permissions would not be implicitly convertible to the Visibility
enum, you would have to create an implementation of the IValueConverter
interface, which would be specific to converting permissions to visibilities, and vice versa, based on the current permissions level. This would also require the converter having some concept of the current permissions level, so either you would want to give it access to some static property (which I would not advise), or you would need to gain hold of the converter instance (making sure you only use one instance) and pass the current permissions level to it.
这样做有几种不同的方式。 集中可见度是一种方式,但如果你想要他人阅读你的法典,我建议采用某种设计模式。
我建议采用多国机器或多国公司模式。 这将意味着你们需要为不同的用户提出不同的看法。
至于像菜单项目这样的简单东西,你可以将贵方倡议的这一部分保存到用户控制中,而在这种用户控制中,不同用户的XAML有不同。 然后,在法典中,根据用户的标记,展示正确的XAML(概览)。
是的,<代码>Visibility property work for MenuItem
。 如果你将以下代码贴在Kaxaml,你就会发现Edit menu是隐蔽的,因此也是工具与项目2。
<Menu>
<MenuItem Header="_File"/>
<MenuItem Header="_Edit" Visibility="Collapsed"/>
<MenuItem Header="_Tools">
<MenuItem Header="Item 1"/>
<MenuItem Header="Item 2" Visibility="Collapsed"/>
<MenuItem Header="Item 3"/>
</MenuItem>
</Menu>
您也可从方案的角度修改<代码>无障碍,或将其并入你的视像仪上的财产。
I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...
Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...
I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...
Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...
Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...
I ve got some code which sets up a datacontext. Often enough, the datacontext should be set to some underlying data collection, such as an ObservableCollection - but occasionally I d like to set it ...
I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...
NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...