mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
commit
6b138317ce
4 changed files with 17 additions and 6 deletions
|
@ -1,10 +1,11 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
public class CalculatorList<TType>
|
||||
public class CalculatorList<TType> : IEnumerable<TType>, IEnumerable
|
||||
{
|
||||
List<TType> m_vector;
|
||||
|
||||
|
@ -128,5 +129,13 @@ namespace CalculatorApp
|
|||
suffix = " =";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerator<TType> GetEnumerator()
|
||||
=> m_vector.GetEnumerator();
|
||||
|
||||
/// <inheritdoc />
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
=> GetEnumerator();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ namespace CalculatorApp
|
|||
string categoryName = resProvider.GetResourceString(nameResourceKey + "Text");
|
||||
string categoryAutomationName = LocalizationStringUtil.GetLocalizedString(navCategoryItemAutomationNameFormat, categoryName, m_Name);
|
||||
|
||||
m_Categories.Append( new NavCategory(
|
||||
m_Categories.Add( new NavCategory(
|
||||
categoryName,
|
||||
categoryAutomationName,
|
||||
(categoryInitializer.Value.glyph),
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
DataContext="{x:Bind Model}"
|
||||
IsSettingsVisible="False"
|
||||
Loaded="OnNavLoaded"
|
||||
MenuItemsSource="{x:Bind CreateUIElementsForCategories(Model.Categories), Mode=OneWay}"
|
||||
MenuItemsSource="{x:Bind UIElementsForCategories, Mode=OneWay}"
|
||||
OpenPaneLength="{StaticResource SplitViewOpenPaneLength}"
|
||||
SelectionChanged="OnNavSelectionChanged"
|
||||
TabIndex="1"
|
||||
|
|
|
@ -427,9 +427,11 @@ namespace CalculatorApp
|
|||
}
|
||||
}
|
||||
|
||||
public List<object> CreateUIElementsForCategories(ObservableCollection<NavCategoryGroup> categories)
|
||||
public CalculatorList<object> UIElementsForCategories => CreateUIElementsForCategories(Model.Categories);
|
||||
|
||||
public CalculatorList<object> CreateUIElementsForCategories(ObservableCollection<NavCategoryGroup> categories)
|
||||
{
|
||||
var menuCategories = new List<object>();
|
||||
var menuCategories = new CalculatorList<object>();
|
||||
|
||||
foreach (var group in categories)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue