Skip to content

A Swiss Army knife for developers.

Added Grid to MAUI Blazor

Etienne Baudouxcad93c0f8456
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index f45ef1a3e..57e871e2e 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -13,6 +13,7 @@
<UnoWasmBootstrapVersion>8.0.0-dev.65</UnoWasmBootstrapVersion>
<WebView2Version>1.0.1462.37</WebView2Version>
<MicrosoftTypeScriptMSBuildVersion>4.9.4</MicrosoftTypeScriptMSBuildVersion>
+ <WpfGridLayoutBlazorVersion>1.2.0</WpfGridLayoutBlazorVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CommunityToolkit.Common" Version="$(CommunityToolkitVersion)" />
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/App.xaml b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/App.xaml
index 06de9422a..bff581631 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/App.xaml
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/App.xaml
@@ -5,22 +5,6 @@
x:Class="DevToys.MauiBlazor.App">
<Application.Resources>
<ResourceDictionary>
-
- <Color x:Key="PageBackgroundColor">#512bdf</Color>
- <Color x:Key="PrimaryTextColor">White</Color>
-
- <Style TargetType="Label">
- <Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
- <Setter Property="FontFamily" Value="OpenSansRegular" />
- </Style>
-
- <Style TargetType="Button">
- <Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
- <Setter Property="FontFamily" Value="OpenSansRegular" />
- <Setter Property="BackgroundColor" Value="#2b0b98" />
- <Setter Property="Padding" Value="14,10" />
- </Style>
-
</ResourceDictionary>
</Application.Resources>
</Application>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/Alignment.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/Alignment.cs
new file mode 100644
index 000000000..a2b5f1c5c
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/Alignment.cs
@@ -0,0 +1,12 @@
+namespace DevToys.MauiBlazor.Components;
+
+public static class Alignment
+{
+ public static CssAlignment Start => new("start");
+
+ public static CssAlignment Center => new("center");
+
+ public static CssAlignment End => new("end");
+
+ public static CssAlignment Stretch => new("stretch");
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/ColumnDefinition.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/ColumnDefinition.razor
new file mode 100644
index 000000000..d449ec1e0
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/ColumnDefinition.razor
@@ -0,0 +1,27 @@
+@namespace DevToys.MauiBlazor.Components
+
+@code {
+ [CascadingParameter]
+ private Grid Parent { get; set; }
+
+ [Parameter]
+ public string Width { get; set; } = "*";
+
+ [Parameter]
+ public string MinWidth { get; set; } = null;
+
+ [Parameter]
+ public string MaxWidth { get; set; } = null;
+
+ protected override void OnInitialized()
+ {
+ if(Parent == null)
+ {
+ throw new ArgumentException("Parent not defined. Make sure your component is in a grid element");
+ }
+
+ Parent.AddColumn(Width, MinWidth, MaxWidth);
+ base.OnInitialized();
+ StateHasChanged();
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/CssAlignment.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/CssAlignment.cs
new file mode 100644
index 000000000..7c3455ede
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/CssAlignment.cs
@@ -0,0 +1,11 @@
+namespace DevToys.MauiBlazor.Components;
+
+public class CssAlignment
+{
+ public string Css { get; }
+
+ public CssAlignment(string css)
+ {
+ Css = css;
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/Grid.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/Grid.razor
new file mode 100644
index 000000000..fe7f0685f
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/Grid.razor
@@ -0,0 +1,54 @@
+@namespace DevToys.MauiBlazor.Components
+
+<CascadingValue Value="this">
+ @ColumnDefinitions
+ @RowDefinitions
+
+ <div style="@_wrapper.Css @_wrapper.RowGap(RowGap) @_wrapper.ColumnGap(ColumnGap)">
+ @Content
+ </div>
+</CascadingValue>
+
+@code {
+ [Parameter]
+ public RenderFragment ColumnDefinitions { get; set; }
+
+ [Parameter]
+ public RenderFragment RowDefinitions { get; set; }
+
+ [Parameter]
+ public RenderFragment Content { get; set; }
+
+ [Parameter]
+ public double ColumnGap { get; set; } = 0;
+
+ [Parameter]
+ public double RowGap { get; set; } = 0;
+
+ [Parameter]
+ public double? Width { get; set; }
+
+ [Parameter]
+ public double? Height { get; set; }
+
+ private readonly GridWrapper _wrapper = new GridWrapper();
+
+ public void AddColumn(string width, string min, string max)
+ {
+ _wrapper.AddColumn(width, min, max);
+ StateHasChanged();
+ }
+
+ public void AddRow(string height, string min, string max)
+ {
+ _wrapper.AddRow(height, min, max);
+ StateHasChanged();
+ }
+
+ protected override void OnParametersSet()
+ {
+ _wrapper.SetWidth(Width);
+ _wrapper.SetHeight(Height);
+ base.OnParametersSet();
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridElement.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridElement.razor
new file mode 100644
index 000000000..080719745
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridElement.razor
@@ -0,0 +1,56 @@
+@namespace DevToys.MauiBlazor.Components
+
+<div style="
+display: grid;
+grid-row: @Row / @RowSpan;
+grid-column: @Column / @ColumnSpan;
+justify-items: @HorizontalAlignment.Css;
+align-items: @VerticalAlignment.Css;">
+ @ChildContent
+</div>
+
+@code {
+
+ [CascadingParameter]
+ private Grid Parent { get; set; }
+
+ [Parameter]
+ public int Column { get; set; } = 1;
+
+ [Parameter]
+ public int Row { get; set; } = 1;
+
+ [Parameter]
+ public int RowSpan
+ {
+ get => (_rowSpan ?? Row) + 1;
+ set => _rowSpan = value;
+ }
+
+ [Parameter]
+ public int ColumnSpan
+ {
+ get => (_columnSpan ?? Column) + 1;
+ set => _columnSpan = value;
+ }
+
+ [Parameter]
+ public CssAlignment HorizontalAlignment { get; set; } = Alignment.Stretch;
+
+ [Parameter]
+ public CssAlignment VerticalAlignment { get; set; } = Alignment.Stretch;
+
+
+ [Parameter]
+ public RenderFragment ChildContent { get; set; }
+
+ protected override void OnInitialized()
+ {
+ if (Parent == null)
+ throw new ArgumentException("Parent not defined. Make sure your component is in a grid element");
+ base.OnInitialized();
+ }
+
+ private int? _rowSpan;
+ private int? _columnSpan;
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridLayoutException.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridLayoutException.cs
new file mode 100644
index 000000000..542b56bec
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridLayoutException.cs
@@ -0,0 +1,9 @@
+namespace DevToys.MauiBlazor.Components;
+
+public class GridLayoutException : Exception
+{
+ public GridLayoutException(string data)
+ : base($"'{data} is not a valid unit. Accepted values are *, auto or a number'")
+ {
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridTemplateConverter.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridTemplateConverter.cs
new file mode 100644
index 000000000..8945d03f3
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridTemplateConverter.cs
@@ -0,0 +1,59 @@
+using System.Collections;
+using System.Text.RegularExpressions;
+
+namespace DevToys.MauiBlazor.Components;
+
+public class GridTemplateConverter : IEnumerable<string>
+{
+ private readonly List<string> _convertedData = new();
+ private readonly Regex _proportionPattern = new("^[0-9]*\\*$");
+ private readonly Regex _fixedSizePattern = new("^[0-9]*$");
+
+ public void AddData(string data, string? min = null, string? max = null)
+ {
+ if (!string.IsNullOrWhiteSpace(min) || !string.IsNullOrWhiteSpace(max))
+ {
+ _convertedData.Add($"minmax({ConvertToCss(!string.IsNullOrWhiteSpace(min) ? min : "1")},{ConvertToCss(!string.IsNullOrWhiteSpace(max) ? max : "*")})");
+ }
+ else
+ {
+ _convertedData.Add(ConvertToCss(data));
+ }
+ }
+
+ private string ConvertToCss(string data)
+ {
+ if (string.IsNullOrWhiteSpace(data))
+ {
+ return "1fr";
+ }
+
+ if (data == "*")
+ {
+ return "1fr";
+ }
+
+ if (data.ToLower() == "auto")
+ {
+ return "auto";
+ }
+
+ if (_fixedSizePattern.IsMatch(data))
+ {
+ return data + "px";
+ }
+
+ if (_proportionPattern.IsMatch(data))
+ {
+ return data.Replace("*", "fr");
+ }
+
+ throw new GridLayoutException(data);
+ }
+
+ public IEnumerator<string> GetEnumerator()
+ => _convertedData.GetEnumerator();
+
+ IEnumerator IEnumerable.GetEnumerator()
+ => GetEnumerator();
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridWrapper.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridWrapper.cs
new file mode 100644
index 000000000..e811a2381
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/GridWrapper.cs
@@ -0,0 +1,43 @@
+namespace DevToys.MauiBlazor.Components;
+
+public class GridWrapper
+{
+ private readonly GridTemplateConverter _columns = new();
+ private readonly GridTemplateConverter _rows = new();
+
+ private double? _width;
+ private double? _height;
+
+ public string Css
+ => $"display: grid; {Width()}{Height()}{GenerateTemplateColumnsIfAny()}{GenerateTemplateRowsIfAny()}".TrimEnd();
+
+ private string GenerateTemplateColumnsIfAny()
+ => _columns.Any()
+ ? $"grid-template-columns: {string.Join(" ", _columns)}; "
+ : string.Empty;
+
+ private string GenerateTemplateRowsIfAny()
+ => _rows.Any()
+ ? $"grid-template-rows: {string.Join(" ", _rows)};"
+ : string.Empty;
+
+ private string Width()
+ => $"width: {(_width.HasValue ? _width.Value.ToString() + "px;" : "100%;")} ";
+ private string Height()
+ => $"height: {(_height.HasValue ? _height.Value.ToString() + "px;" : "100%;")} ";
+
+ public void AddColumn(string width, string? min = null, string? max = null)
+ => _columns.AddData(width, min, max);
+
+ public void AddRow(string height, string? min = null, string? max = null)
+ => _rows.AddData(height, min, max);
+
+ public void SetWidth(double? value) => _width = value;
+ public void SetHeight(double? value) => _height = value;
+
+ public string RowGap(double gap)
+ => gap > 0 ? $"grid-row-gap: {gap}px;" : string.Empty;
+
+ public string ColumnGap(double gap)
+ => gap > 0 ? $"grid-column-gap: {gap}px;" : string.Empty;
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/README.md b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/README.md
new file mode 100644
index 000000000..81cd9a03a
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/README.md
@@ -0,0 +1,5 @@
+Comes from https://github.com/aboudoux/WpfGridLayout.Blazor
+
+The difference is that we removed the ZIndex support.
+
+License: https://github.com/aboudoux/WpfGridLayout.Blazor/blob/40f5c265ac15e46507c3df291d7368f00e9773da/README.md?plain=1#L260
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/RowDefinition.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/RowDefinition.razor
new file mode 100644
index 000000000..49832aa9f
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/Grid/RowDefinition.razor
@@ -0,0 +1,27 @@
+@namespace DevToys.MauiBlazor.Components
+
+@code {
+
+ [CascadingParameter]
+ private Grid Parent { get; set; }
+
+ [Parameter]
+ public string Height { get; set; } = "*";
+
+ [Parameter]
+ public string MinHeight { get; set; } = null;
+
+ [Parameter]
+ public string MaxHeight { get; set; } = null;
+
+ protected override void OnInitialized()
+ {
+ if (Parent == null)
+ {
+ throw new ArgumentException("Parent not defined. Make sure your component is in a grid element");
+ }
+
+ Parent.AddRow(Height, MinHeight, MaxHeight);
+ base.OnInitialized();
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor
index 10f97010d..c4d35add5 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor
@@ -1,24 +1,40 @@
@inherits FluentComponentBase
-<div>
- <CascadingValue Value="this" IsFixed=true Name="NavigationView">
- <FluentTreeView Class="@ClassValue"
- Style="@StyleValue"
- id="@Id">
- @*
- <FluentButton Appearance="Appearance.Lightweight"
- Class="navmenu-main-button"
- @onclick="OnHamburgerButtonClickAsync"
- title="@Title">
- <FluentIcon Name="@(FluentIcons.Navigation)" Size="IconSize.Size20" Slot="start" />
- </FluentButton>*@
- <FluentSearch Placeholder="Type to search for tools..." Style="margin-left: 22px; margin-right: 22px" />
- <NavigationViewItem Text="All tools" Icon="@(FluentIcons.Home)" />
- <FluentDivider />
- @MenuItemsSource
- <div style="position: absolute; bottom: 0px; width:@Width;">
- @FooterMenuItemsSource
- </div>
- </FluentTreeView>
- </CascadingValue>
-</div>
\ No newline at end of file
+<CascadingValue Value="this" IsFixed=false Name="NavigationView">
+ <Grid>
+ <RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </RowDefinitions>
+ <ColumnDefinitions>
+ <ColumnDefinition Width="320" />
+ <ColumnDefinition Width="*" />
+ </ColumnDefinitions>
+ <Content>
+ @* Search Bar *@
+ <GridElement Row="1" Column="1" HorizontalAlignment="@Alignment.Stretch" VerticalAlignment="@Alignment.Start">
+ <FluentSearch Placeholder="Type to search for tools..." Style="margin-left: 22px; margin-right: 22px" />
+ </GridElement>
+
+ @* Top Menu *@
+ <GridElement Row="2" Column="1" HorizontalAlignment="@Alignment.Stretch" VerticalAlignment="@Alignment.Start">
+ <StackPanel Orientation="@Orientation.Vertical">
+ @MenuItemsSource
+ </StackPanel>
+ </GridElement>
+
+ @* Bottom Menu *@
+ <GridElement Row="3" Column="1" HorizontalAlignment="@Alignment.Stretch" VerticalAlignment="@Alignment.End">
+ <StackPanel Orientation="@Orientation.Vertical">
+ @FooterMenuItemsSource
+ </StackPanel>
+ </GridElement>
+
+ @* Content of the Navigation View *@
+ <GridElement Row="1" RowSpan="3" Column="2" HorizontalAlignment="@Alignment.Stretch" VerticalAlignment="@Alignment.Stretch">
+ @Content
+ </GridElement>
+ </Content>
+ </Grid>
+</CascadingValue>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.cs
index 2205a6f5f..d36162343 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.cs
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.cs
@@ -24,11 +24,17 @@ public partial class NavigationView : FluentComponentBase
[Parameter]
public RenderFragment? FooterMenuItemsSource { get; set; }
+ /// <summary>
+ /// Gets or sets the content of the navigation view.
+ /// </summary>
+ [Parameter]
+ public RenderFragment? Content { get; set; }
+
/// <summary>
/// Gets or sets the selected item.
/// </summary>
[Parameter]
- public NavigationViewItem? SelectedItem { get; set; }
+ public FluentTreeItem? SelectedTreeItem { get; set; }
/// <summary>
/// Gets or sets a reasonably unique ID
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.css b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.css
index 68f07d95b..5f282702b 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.css
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationView.razor.css
@@ -1,48 +1 @@
-.navmenu {
- background-color: var(--neutral-layer-1);
-}
-
-::deep .navmenu-main-button {
- width: 20px;
- color: var(--neutral-fill-strong-active);
-}
-
- ::deep .navmenu-main-button::part(start) {
- margin-inline-end: 0px;
- }
-
-/*From main layout component*/
-.main-layout-navmenu {
- height: 100%;
- max-height: 100%;
- border-right: 1px solid var(--neutral-stroke-divider-rest);
- overflow-y: auto;
-}
-
-::deep .navmenu-group::part(start) {
- margin-inline-end: 5px;
-}
-
-::deep .navmenu-group:not([aria-expanded])::part(start) {
- margin-inline-start: -25px;
- width: 24px;
-}
-
-::deep .navmenu-link::part(start) {
- margin-inline-start: -25px;
-}
-
-::deep .navmenu-link-nogroup::part(start) {
- margin-inline-start: -10px;
-}
-
-/* Item Collasped */
-::deep fluent-tree-item.navmenu-group:not([aria-expanded]) svg[state="expanded"],
-::deep fluent-tree-item.navmenu-group[aria-expanded="false"] svg[state="expanded"] {
- display: none;
-}
-
-/* Item Expanded */
-::deep fluent-tree-item.navmenu-group[aria-expanded="true"] svg[state="collapsed"] {
- display: none;
-}
+
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor
deleted file mode 100644
index 6ec5c365e..000000000
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor
+++ /dev/null
@@ -1,25 +0,0 @@
-@namespace DevToys.MauiBlazor.Components
-
-@inherits FluentComponentBase
-<FluentTreeItem @ref="@_treeItem"
- Id="@Id"
- Class="@ClassValue"
- Style="@StyleValue"
- Expanded="@IsExpanded"
- tabindex="-1"
- Text="@Text"
- Selected="@IsSelected"
- @onclick="@OnClickHandlerAsync">
- @if (HasIcon)
- {
- <FluentIcon Name="@Icon" Size="@IconSize.Size20" Slot="start" />
- }
- else
- {
- <div style="width:20px;" slot="start" />
- }
-
- @ChildContent
-
-
-</FluentTreeItem>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor.cs
deleted file mode 100644
index 8a8394b99..000000000
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Web;
-using Microsoft.Fast.Components.FluentUI;
-using Microsoft.Fast.Components.FluentUI.Utilities;
-
-namespace DevToys.MauiBlazor.Components;
-
-public partial class NavigationViewItem : FluentComponentBase
-{
- private bool _expanded = false;
- private FluentTreeItem? _treeItem;
-
- /// <summary>
- /// Gets or sets a unique identifier.
- /// </summary>
- [Parameter]
- public string Id { get; set; } = Identifier.NewId();
-
- /// <summary>
- /// Gets or sets a value that indicates whether a tree node is expanded. Ignored if there are no menu items.
- /// </summary>
- [Parameter]
- public bool IsExpanded { get; set; }
-
- /// <summary>
- /// Gets the value that indicates whether or not descendant item is selected.
- /// </summary>
- public bool IsChildSelected { get; }
-
- /// <summary>
- /// Gets or sets the text of the item
- /// </summary>
- [Parameter]
- public string Text { get; set; } = string.Empty;
-
- /// <summary>
- /// Gets or sets the name of the icon to display.
- /// </summary>
- [Parameter]
- public string Icon { get; set; } = string.Empty;
-
- /// <summary>
- /// Gets or sets whether the item is selected
- /// </summary>
- [Parameter]
- public bool IsSelected { get; set; }
-
- /// <summary>
- /// Gets or sets the content to be rendered inside the component.
- /// </summary>
- [Parameter]
- public RenderFragment? ChildContent { get; set; }
-
- private bool HasIcon => !string.IsNullOrWhiteSpace(Icon);
-
- [CascadingParameter(Name = "NavigationView")]
- public NavigationView NavigationView { get; set; } = default!;
-
- /// <summary>
- /// Callback function for when the item is clicked
- /// </summary>
- [Parameter]
- public EventCallback<MouseEventArgs> OnClick { get; set; }
-
- /// <summary>
- /// Callback function for when the item is expanded
- /// </summary>
- [Parameter]
- public EventCallback<bool> OnExpandedChanged { get; set; }
-
- protected string? ClassValue => new CssBuilder(Class)
- .AddClass("navigationviewitem")
- .Build();
-
- protected string? StyleValue => new StyleBuilder()
- .AddStyle(Style)
- .Build();
-
- protected override void OnParametersSet()
- {
- if (_expanded != IsExpanded)
- {
- _expanded = IsExpanded;
- if (OnExpandedChanged.HasDelegate)
- OnExpandedChanged.InvokeAsync(_expanded); //.SafeFireAndForget();
- }
-
- base.OnParametersSet();
- }
-
- protected async Task OnClickHandlerAsync(MouseEventArgs e)
- {
- IsSelected = true;
-
- if (OnClick.HasDelegate)
- {
- await OnClick.InvokeAsync(e);
- }
- }
-}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor.css b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor.css
deleted file mode 100644
index 38b4f9b0e..000000000
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Components/NavigationViewItem.razor.css
+++ /dev/null
@@ -1,4 +0,0 @@
-.navigation-view-item-expander-icon {
- position: absolute;
- right: 12px;
-}
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Pages/Index.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Pages/Index.razor
index 321e016b3..eed8673ef 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Pages/Index.razor
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Pages/Index.razor
@@ -7,4 +7,24 @@ Welcome to your new app.
<FluentButton Style="margin:24px">Click Me</FluentButton>
-<MonacoEditor Language="csharp" IsDarkMode="false" />
\ No newline at end of file
+<MonacoEditor Language="csharp" IsDarkMode="false" />
+
+<p>Neutral and Neutral with Disabled</p>
+<FluentButton Appearance="Appearance.Neutral">Button</FluentButton>
+<FluentButton Appearance="Appearance.Neutral" Disabled="true">Button</FluentButton>
+
+<p>Accent and Accent with Disabled</p>
+<FluentButton Appearance="Appearance.Accent">Button</FluentButton>
+<FluentButton Appearance="Appearance.Accent" Disabled="true">Button</FluentButton>
+
+<p>Lightweight and Lightweight with Disabled</p>
+<FluentButton Appearance="Appearance.Lightweight">Button</FluentButton>
+<FluentButton Appearance="Appearance.Lightweight" Disabled="true">Button</FluentButton>
+
+<p>Outline and Ouline with Disabled</p>
+<FluentButton Appearance="Appearance.Outline">Button</FluentButton>
+<FluentButton Appearance="Appearance.Outline" Disabled="true">Button</FluentButton>
+
+<p>Stealth and Stealth with Disabled</p>
+<FluentButton Appearance="Appearance.Stealth">Button</FluentButton>
+<FluentButton Appearance="Appearance.Stealth" Disabled="true">Button</FluentButton>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Platforms/Windows/App.xaml.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Platforms/Windows/App.xaml.cs
index be705e7d6..10d69e813 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Platforms/Windows/App.xaml.cs
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Platforms/Windows/App.xaml.cs
@@ -1,4 +1,5 @@
using Microsoft.UI.Xaml;
+using Windows.UI.ViewManagement;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor
index d92104763..70a76513c 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor
@@ -2,35 +2,19 @@
<FluentDesignSystemProvider BaseLayerLuminance=@_baseLayerLuminanceValue>
<div id="container">
- <StackPanel Orientation="Orientation.Horizontal" Width="100%">
- <div>
- <NavigationView Width="320">
- <MenuItemsSource>
- <NavigationViewItem Text="Never" Icon="@(FluentIcons.LeafOne)" />
- <NavigationViewItem Text="Gonna" Icon="@(FluentIcons.LeafOne)" />
- <NavigationViewItem Text="Give" Icon="@(FluentIcons.LeafOne)">
- <NavigationViewItem Text="You" Icon="@(FluentIcons.LeafOne)" />
- <NavigationViewItem Text="Up" Icon="@(FluentIcons.LeafTwo)" />
- </NavigationViewItem>
- <NavigationViewItem Text="Never" Icon="@(FluentIcons.LeafOne)">
- <NavigationViewItem Text="Gonna" Icon="@(FluentIcons.LeafOne)" />
- <NavigationViewItem Text="Let" Icon="@(FluentIcons.LeafOne)" />
- </NavigationViewItem>
- <NavigationViewItem Text="You" Icon="@(FluentIcons.LeafOne)">
- <NavigationViewItem Text="Down" Icon="@(FluentIcons.LeafTwo)" />
- </NavigationViewItem>
- </MenuItemsSource>
- <FooterMenuItemsSource>
- <NavigationViewItem Text="Settings" Icon="@(FluentIcons.Settings)" />
- </FooterMenuItemsSource>
- </NavigationView>
- </div>
-
- <main>
- <article>
+ <NavigationView>
+ <MenuItemsSource>
+ <FluentButton Appearance="Appearance.Stealth">Hello</FluentButton>
+ <FluentButton Appearance="Appearance.Stealth">There</FluentButton>
+ </MenuItemsSource>
+ <FooterMenuItemsSource>
+ <FluentButton Appearance="Appearance.Stealth">Bottom</FluentButton>
+ </FooterMenuItemsSource>
+ <Content>
+ <main>
@Body
- </article>
- </main>
- </StackPanel>
+ </main>
+ </Content>
+ </NavigationView>
</div>
</FluentDesignSystemProvider>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css
index 4ec9a3289..7b8fc5759 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/Shared/MainLayout.razor.css
@@ -4,9 +4,11 @@
position: fixed;
top: 0;
left: 0;
- background-color: var(--neutral-layer-4);
+ background-color: var(--neutral-layer-3);
}
main {
width: 100%;
+ background-color: var(--neutral-layer-2);
+ border-top-left-radius: 8px 8px;
}
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/wwwroot/css/app.css b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/wwwroot/css/app.css
index a33f2d102..f17279e31 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/wwwroot/css/app.css
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/wwwroot/css/app.css
@@ -37,4 +37,5 @@ html, body {
.blazor-error-boundary::after {
content: "An error has occurred."
- }
\ No newline at end of file
+ }
+