Styling MenuAdv
I'm trying to implementing following type of Menu in my update using syncfusion MenuAdv
So far I'm able to implement following
Here is my Code
/// <summary>
/// Menu Item Base Class
/// </summary>
public partial class MItem : ObservableObject
{
public enum ItemType { None = 0, Entry, Report, MItem };
[ObservableProperty] string icon;
[ObservableProperty] string ctlName;
[ObservableProperty] string title;
[ObservableProperty] string group;
[ObservableProperty] ItemType type = ItemType.None;
[ObservableProperty] PDMBase.VType eType;
[ObservableProperty] PDMBase.RptType rType;
[ObservableProperty] PDMBase.MenuItemType mType;
[ObservableProperty] List<MItem> subItems;
public MItem(PDMBase.VType VType, string Group, PDMBase.UType MinUserLevel)
{
if ((int)PDMBase.CurUType > (int)MinUserLevel) return;
EType = VType;
Type = ItemType.Entry;
Title = PDMBase.VTypeMenuTitle[(int)EType];
CtlName = $"EType_{(int)EType}";
this.Group = Group;
}
public MItem(PDMBase.RptType RptType, string Group, PDMBase.UType MinUserLevel)
{
if ((int)PDMBase.CurUType > (int)MinUserLevel) return;
RType = RptType;
Type = ItemType.Report;
Title = PDMBase.RptTitle[(int)RType];
CtlName = $"RType_{(int)RType}";
this.Group = Group;
}
public MItem(PDMBase.MenuItemType MenuType, string Group, PDMBase.UType MinUserLevel)
{
if ((int)PDMBase.CurUType > (int)MinUserLevel) return;
MType = MenuType;
Type = ItemType.MItem;
Title = PDMBase.MenuItemTitle[(int)MType];
CtlName = $"MType_{(int)MType}";
this.Group = Group;
}
public MItem(string Name, List<MItem> SubItem)
{
Type = ItemType.None;
Title = Name;
SubItems = SubItem;
}
}
//ViewModel
public partial class Menu : ObservableObject
{
[ObservableProperty] List<MItem> items = new List<MItem>();
[ObservableProperty] MItem selItem;
public Menu() { InitializeData(); }
public void InitializeData()
{
List<MItem> TItem = null;
List<MItem> SubItems = null;
//Master
TItem =
[
new MItem(PDMBase.MenuItemType.Acc, "Master", PDMBase.UType.Admin),
new MItem(PDMBase.MenuItemType.CP, "Master", PDMBase.UType.Admin),
new MItem(PDMBase.MenuItemType.PG, "Master", PDMBase.UType.Admin),
new MItem(PDMBase.MenuItemType.Prod, "Master", PDMBase.UType.Admin)
];
if (TItem.Count > 0) Items.Add(new MItem("Master", TItem));
//Daily Entries
//Inward Register
SubItems = [];
TItem =
[
new MItem(PDMBase.VType.Inward, "Inward Register", PDMBase.UType.Supervisor),
new MItem(PDMBase.RptType.Pending_RM_Analysis, "Inward Register", PDMBase.UType.Supervisor)
];
if (TItem.Count > 0) SubItems.Add(new MItem("Inward Register", TItem));
//Packing Register
TItem =
[
new MItem(PDMBase.VType.Packing, "Packing Register", PDMBase.UType.Supervisor),
new MItem(PDMBase.VType.PackingToProcess, "Packing Register", PDMBase.UType.Supervisor)
];
if (TItem.Count > 0) SubItems.Add(new MItem("Packing Register", TItem));
//Outward Register
TItem =
[
new MItem(PDMBase.VType.Outward, "Outward Register", PDMBase.UType.Supervisor),
new MItem(PDMBase.VType.OutwardReturn, "Outward Register", PDMBase.UType.Supervisor)
];
if (TItem.Count > 0) SubItems.Add(new MItem("Outward Register", TItem));
if (SubItems.Count > 0) Items.Add(new MItem("Daily Entries", SubItems));
}
}
<sync:MenuAdv x:Name="M2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Orientation="Vertical"
ItemsSource="{Binding Items}">
<sync:MenuAdv.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<TextBlock Text="{Binding Title}"/>
</HierarchicalDataTemplate>
</sync:MenuAdv.ItemTemplate>
</sync:MenuAdv>
How can I achieve this style i.e. 1st two levels visible and 3rd level visible on mouse click
SIGN IN To post a reply.
2 Replies
AS
Amit Saraf
June 13, 2024 06:30 AM UTC
I've tried SfTreeNavigator and decided to continue with it.
Thanks for
PV
Priyanka Vijayasankar
Syncfusion Team
June 13, 2024 01:51 PM UTC
Hi Amit Saraf,
We hope the reported issue has been fixed on your end. Please get back to us if you need further assistance.
Regards,
Priyanka Vijayasankar
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
AS Amit Saraf
- Jun 12, 2024 12:22 PM UTC
- Jun 13, 2024 01:51 PM UTC