Skip to content

Commit

Permalink
Cleanup/prepare xaml pages for additional changes (#3910)
Browse files Browse the repository at this point in the history
  • Loading branch information
krschau authored Sep 30, 2024
1 parent c0936f9 commit 5e75f86
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<converters:DoubleToVisibilityConverter x:Key="CountToVisibilityConverter" GreaterThan="0" FalseValue="Visible" TrueValue="Collapsed" />
</Page.Resources>

<ScrollViewer VerticalAlignment="Top" VerticalScrollBarVisibility="Auto">
<ScrollViewer
VerticalAlignment="Top">
<Grid MaxWidth="{ThemeResource MaxPageContentWidth}" Margin="{ThemeResource ContentPageMargin}">
<StackPanel>
<ItemsRepeater ItemsSource="{x:Bind ViewModel.ExperimentalFeatures}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ public void Initialize(StackedNotificationsBehavior notificationQueue)
_notificationsHelper = new(notificationQueue);
}

[RelayCommand]
private async Task OnLoadedAsync()
{
await LoadModelAsync();
}

[RelayCommand]
public async Task SyncButton()
{
Expand Down
25 changes: 19 additions & 6 deletions tools/Environments/DevHome.Environments/Views/LandingPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
xmlns:winUIBehaviors="using:CommunityToolkit.WinUI.Behaviors"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:views="using:DevHome.Common.Views"
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never"
Loaded="OnLoaded">
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never">

<commonviews:ToolPage.Resources>
<ResourceDictionary Source="ms-appx:///DevHome.Common/Environments/Templates/EnvironmentsTemplates.xaml" />
</commonviews:ToolPage.Resources>

<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="Loaded">
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
Expand All @@ -31,7 +37,6 @@
<!-- Adding unshared resources/templates here-->
<Grid.Resources>

<converters:EmptyCollectionToObjectConverter x:Key="EmptyCollectionVisibilityConverter" EmptyValue="Collapsed" NotEmptyValue="Visible"/>
<converters:BoolToVisibilityConverter x:Key="NegatedBoolToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible" />

<!-- Launch Button template -->
Expand Down Expand Up @@ -196,7 +201,8 @@
</Grid>
</DataTemplate>

<selectors:CardItemTemplateSelector x:Key="CardItemTemplateSelector"
<selectors:CardItemTemplateSelector
x:Key="CardItemTemplateSelector"
ComputeSystemTemplate="{StaticResource ComputeSystemTemplate}"
CreateComputeSystemOperationTemplate="{StaticResource CreateComputeSystemOperationTemplate}"/>

Expand Down Expand Up @@ -235,7 +241,13 @@
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<!-- Search field -->
<AutoSuggestBox Grid.Column="0" x:Uid="SearchTextBox" x:Name="SearchTextBox" Width="230" HorizontalAlignment="Left" VerticalAlignment="Center">
<AutoSuggestBox
Grid.Column="0"
x:Uid="SearchTextBox"
x:Name="SearchTextBox"
Width="230"
HorizontalAlignment="Left"
VerticalAlignment="Center">
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="TextChanged">
<ic:InvokeCommandAction
Expand Down Expand Up @@ -305,7 +317,8 @@
</Grid>

<!-- Per VM/Compute System card -->
<ScrollViewer Grid.Row="3" Style="{StaticResource EnvironmentScrollViewerStyle}" MaxWidth="{ThemeResource MaxPageContentWidth}" Margin="{ThemeResource ContentPageMargin}">
<ScrollViewer Grid.Row="3" Style="{StaticResource EnvironmentScrollViewerStyle}"
MaxWidth="{ThemeResource MaxPageContentWidth}" Margin="{ThemeResource ContentPageMargin}">
<Grid>
<StackPanel>
<ListView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Input;
using DevHome.Common.Extensions;
using DevHome.Common.Views;
using DevHome.Environments.ViewModels;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

namespace DevHome.Environments.Views;

Expand All @@ -21,9 +18,4 @@ public LandingPage()
InitializeComponent();
ViewModel.Initialize(NotificationQueue);
}

private async void OnLoaded(object sender, RoutedEventArgs e)
{
await ViewModel.LoadModelAsync();
}
}
Loading

0 comments on commit 5e75f86

Please sign in to comment.