Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to get WPF Menu items names when window loaded?

$
0
0

I'm new in WPF and I have this :

<Grid><MenuVerticalAlignment="Top"Margin="8,13,20,0"Foreground="#FF4B5D51"Height="29"Name="baseMenu"HorizontalAlignment="Stretch"Background="{x:Null}"BorderBrush="#FF4B5D51"HorizontalContentAlignment="Right"FontFamily="Tahoma"FontSize="14"><MenuItemVisibility="Collapsed"Header="Management"x:Name="mnuManagement"Foreground="#FFE3A036"FontSize="15"><!--Employees--><MenuItemVisibility="Collapsed"Header="Employees"x:Name="EmpsMenuItem"Background="{x:Null}"FontSize="15"Foreground="#FFE3A036"BorderBrush="{x:Null}"></MenuItem><MenuItemVisibility="Collapsed"Header="Categories"x:Name="catMenuItem"Background="{x:Null}"FontSize="15"Foreground="#FFE3A036"BorderBrush="{x:Null}"></MenuItem><MenuItemVisibility="Collapsed"Header="Products"x:Name="prodMenuItem"Background="{x:Null}"FontSize="15"Foreground="#FFE3A036"BorderBrush="{x:Null}"></MenuItem></MenuItem><!--الموردين--><MenuItemVisibility="Collapsed"Header="Suppliers"x:Name="mnuSuppliers"Foreground="#FFE3A036"FontSize="15"><!--الموردين--><MenuItemVisibility="Collapsed"Header="Branches"x:Name="BranchesMenuItem"Background="{x:Null}"FontSize="15"Foreground="#FFE3A036"BorderBrush="{x:Null}"></MenuItem></MenuItem></Menu></Grid>

What I want to do is get every menu item name and put them in an array, I want to do that to give the user permission according to menu item name such as: If a i have user no. 1 & I will give him this permission: Management.isenable = true; EmpsMenuItem.isenable = false; mnuSuppliers.isenable = true: so i want to looping into this array to give him permissions ,but I don't have any idea about how to do that. How would I do this?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>