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