feat: add function to set selected item from outside and sync to UI.
This commit is contained in:
@@ -265,7 +265,7 @@ public class NavMenuItem: HeaderedSelectingItemsControl
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected void SelectItem(NavMenuItem item)
|
||||
internal void SelectItem(NavMenuItem item)
|
||||
{
|
||||
if (item == this)
|
||||
{
|
||||
@@ -329,4 +329,24 @@ public class NavMenuItem: HeaderedSelectingItemsControl
|
||||
|
||||
return logical != null ? result : @default;
|
||||
}
|
||||
|
||||
internal IEnumerable<NavMenuItem> GetLeafMenus()
|
||||
{
|
||||
if (this.ItemCount == 0)
|
||||
{
|
||||
yield return this;
|
||||
yield break;
|
||||
}
|
||||
foreach (var child in LogicalChildren)
|
||||
{
|
||||
if (child is NavMenuItem item)
|
||||
{
|
||||
var items = item.GetLeafMenus();
|
||||
foreach (var i in items)
|
||||
{
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user