Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling selection on enter, not movement. #3468

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,137 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="DevHome.SetupFlow.Views.Environments.SelectEnvironmentProviderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:setupControls="using:DevHome.SetupFlow.Controls"
xmlns:toolKit="using:CommunityToolkit.WinUI.Controls"
xmlns:EnvironmentViewModels="using:DevHome.SetupFlow.ViewModels.Environments"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:winUIBehaviors="using:CommunityToolkit.WinUI.Behaviors"
Loaded="OnLoaded">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DevHome.Common/Environments/Templates/EnvironmentsTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:BoolToVisibilityConverter x:Key="CollapsedWhenTrueBoolToVisibilityConverter" TrueValue="Collapsed" FalseValue="Visible"/>

<!--
<?xml version="1.0" encoding="utf-8" ?>
<UserControl
x:Class="DevHome.SetupFlow.Views.Environments.SelectEnvironmentProviderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EnvironmentViewModels="using:DevHome.SetupFlow.ViewModels.Environments"
xmlns:converters="using:CommunityToolkit.WinUI.Converters"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:setupControls="using:DevHome.SetupFlow.Controls"
xmlns:toolKit="using:CommunityToolkit.WinUI.Controls"
xmlns:winUIBehaviors="using:CommunityToolkit.WinUI.Behaviors"
Loaded="OnLoaded">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///DevHome.Common/Environments/Templates/EnvironmentsTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:BoolToVisibilityConverter
x:Key="CollapsedWhenTrueBoolToVisibilityConverter"
FalseValue="Visible"
TrueValue="Collapsed" />

<!--
Override SettingsCard default resources. This is used because the default
SettingsCardHeaderIconMaxSize value for settings cards is 20. This makes
the icons sent from extensions in the creation flow appear too small and pixelated.
So we override it here, to make sure they are bigger.
-->
<x:Double x:Key="SettingsCardHeaderIconMaxSize">40</x:Double>

<!-- Template for the compute system providers that we were able to retrieve from all the extensions -->
<DataTemplate x:Key="ProviderItemTemplate" x:DataType="EnvironmentViewModels:ComputeSystemProviderViewModel">
<ItemContainer
AutomationProperties.Name="{x:Bind DisplayName, Mode=OneWay}"
IsSelected="{x:Bind IsSelected}">
<toolKit:SettingsCard
HorizontalAlignment="Stretch"
HeaderIcon="{x:Bind Icon}"
Header="{x:Bind DisplayName}">
</toolKit:SettingsCard>
</ItemContainer>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>

<!--- Show the Select environment header on the page. -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<setupControls:SetupShell
Title="{x:Bind ViewModel.PageTitle}"
x:Uid="SelectEnvironmentPage"
Orchestrator="{x:Bind ViewModel.Orchestrator, Mode=OneWay}"
Foreground="{ThemeResource TextFillColorSecondary}"
Grid.Row="0"
ContentVisibility="Collapsed">
</setupControls:SetupShell>
<ScrollViewer
MaxWidth="{ThemeResource MaxPageContentWidth}"
Margin="{ThemeResource ContentPageMargin}"
Grid.Row="1">
<Grid RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--- Show the Select environment subtitle on the page. -->
<TextBlock
Grid.Row="0"
x:Uid="SelectEnvironmentSubtitle"
x:Name="LabelForItemsView"
Foreground="{ThemeResource TextFillColorSecondary}"/>

<!--- List of Compute system providers the user can choose from when they're loaded. -->
<ItemsView
x:Name="ComputeSystemProviderViewModelsList"
Grid.Row="1"
AutomationProperties.LabeledBy="{Binding ElementName=LabelForItemsView, Mode=OneWay}"
ItemsSource="{x:Bind ViewModel.ProvidersViewModels, Mode=OneWay}"
ItemTemplate="{StaticResource ProviderItemTemplate}"
Visibility="{x:Bind ViewModel.AreProvidersLoaded, Mode=OneWay}">
<ItemsView.Layout>
<StackLayout Spacing="5" />
</ItemsView.Layout>
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="SelectionChanged">
<ic:InvokeCommandAction
Command="{Binding ItemsViewSelectionChangedCommand, Mode=OneWay}"
CommandParameter="{Binding SelectedItem, ElementName=ComputeSystemProviderViewModelsList, Mode=OneWay}"/>
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ItemsView>

<Grid
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{x:Bind ViewModel.AreProvidersLoaded, Mode=OneWay, Converter={StaticResource CollapsedWhenTrueBoolToVisibilityConverter}}">
<ProgressRing
IsActive="True"
Width="25"
Height="25"/>
</Grid>

<StackPanel
Grid.Row="2"
Visibility="{x:Bind ViewModel.CallToActionText, Mode=OneWay, Converter={StaticResource EmptyObjectToObjectConverter}}"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<TextBlock
Text="{x:Bind ViewModel.CallToActionText, Mode=OneWay}"
HorizontalAlignment="Center"
TextWrapping="WrapWholeWords"
HorizontalTextAlignment="Center" />
<HyperlinkButton
Grid.Column="3"
HorizontalAlignment="Center"
Content="{x:Bind ViewModel.CallToActionHyperLinkButtonText, Mode=OneWay}"
Command="{x:Bind ViewModel.CallToActionButtonCommand}" />
</StackPanel>

<InfoBar
MaxWidth="480"
Margin="24"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Grid.Row="3">
<i:Interaction.Behaviors>
<winUIBehaviors:StackedNotificationsBehavior x:Name="NotificationQueue" />
</i:Interaction.Behaviors>
</InfoBar>
</Grid>
</ScrollViewer>
</Grid>
</UserControl>
-->
<x:Double x:Key="SettingsCardHeaderIconMaxSize">40</x:Double>

<!-- Template for the compute system providers that we were able to retrieve from all the extensions -->
<DataTemplate x:Key="ProviderItemTemplate" x:DataType="EnvironmentViewModels:ComputeSystemProviderViewModel">
<ItemContainer AutomationProperties.Name="{x:Bind DisplayName, Mode=OneWay}" IsTabStop="False">
<toolKit:SettingsCard
Margin="0,0,0,5"
HorizontalAlignment="Stretch"
Header="{x:Bind DisplayName}"
HeaderIcon="{x:Bind Icon}"
IsTabStop="False" />
</ItemContainer>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>

<!-- - Show the Select environment header on the page. -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<setupControls:SetupShell
x:Uid="SelectEnvironmentPage"
Title="{x:Bind ViewModel.PageTitle}"
Grid.Row="0"
ContentVisibility="Collapsed"
Foreground="{ThemeResource TextFillColorSecondary}"
Orchestrator="{x:Bind ViewModel.Orchestrator, Mode=OneWay}" />
<ScrollViewer
Grid.Row="1"
MaxWidth="{ThemeResource MaxPageContentWidth}"
Margin="{ThemeResource ContentPageMargin}">
<Grid RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- - Show the Select environment subtitle on the page. -->
<TextBlock
x:Name="LabelForItemsView"
x:Uid="SelectEnvironmentSubtitle"
Grid.Row="0"
Foreground="{ThemeResource TextFillColorSecondary}" />

<!-- - List of Compute system providers the user can choose from when they're loaded. -->
<!-- Use negative 5 on bottom-margin to offset manual spacing of the items.-->
<ListView
x:Name="ComputeSystemProviderViewModelsList"
Grid.Row="1"
AutomationProperties.LabeledBy="{Binding ElementName=LabelForItemsView, Mode=OneWay}"
ItemTemplate="{StaticResource ProviderItemTemplate}"
ItemsSource="{x:Bind ViewModel.ProvidersViewModels, Mode=OneWay}"
SelectionMode="Single"
SingleSelectionFollowsFocus="False"
Visibility="{x:Bind ViewModel.AreProvidersLoaded, Mode=OneWay}"
Margin="0, 0, 0, -5">
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="SelectionChanged">
<ic:InvokeCommandAction Command="{Binding ItemsViewSelectionChangedCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem, ElementName=ComputeSystemProviderViewModelsList, Mode=OneWay}" />
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ListView>

<Grid
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{x:Bind ViewModel.AreProvidersLoaded, Mode=OneWay, Converter={StaticResource CollapsedWhenTrueBoolToVisibilityConverter}}">
<ProgressRing
Width="25"
Height="25"
IsActive="True" />
</Grid>

<StackPanel
Grid.Row="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{x:Bind ViewModel.CallToActionText, Mode=OneWay, Converter={StaticResource EmptyObjectToObjectConverter}}">
<TextBlock
HorizontalAlignment="Center"
HorizontalTextAlignment="Center"
Text="{x:Bind ViewModel.CallToActionText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
<HyperlinkButton
Grid.Column="3"
HorizontalAlignment="Center"
Command="{x:Bind ViewModel.CallToActionButtonCommand}"
Content="{x:Bind ViewModel.CallToActionHyperLinkButtonText, Mode=OneWay}" />
</StackPanel>

<InfoBar
Grid.Row="3"
MaxWidth="480"
Margin="24"
HorizontalAlignment="Right"
VerticalAlignment="Bottom">
<i:Interaction.Behaviors>
<winUIBehaviors:StackedNotificationsBehavior x:Name="NotificationQueue" />
</i:Interaction.Behaviors>
</InfoBar>
</Grid>
</ScrollViewer>
</Grid>
</UserControl>
Loading