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

Replace toggle split button with two separate buttons in DSC page #2859

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
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
Expand Up @@ -1050,11 +1050,11 @@
</data>
<data name="SetUpAsAdmin.Content" xml:space="preserve">
<value>Set up as admin</value>
<comment>Text shown on a split button for setting up configuration as admin</comment>
<comment>Text shown on a button for setting up configuration as admin</comment>
</data>
<data name="SetUpAsNonAdmin.Text" xml:space="preserve">
<data name="SetUpAsNonAdmin.Content" xml:space="preserve">
<value>Set up as non-admin</value>
<comment>Text shown on a split button for setting up configuration as non-admin</comment>
<comment>Text shown on a button for setting up configuration as non-admin</comment>
</data>
<data name="SummaryPageAppsDownloadedCount" xml:space="preserve">
<value>Applications installed</value>
Expand Down
25 changes: 9 additions & 16 deletions tools/SetupFlow/DevHome.SetupFlow/Views/ConfigurationFileView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,15 @@
IsChecked="{x:Bind ViewModel.ReadAndAgree, Mode=TwoWay}"/>
</setupFlowBehaviors:SetupFlowNavigationBehavior.ContentTemplate>
<setupFlowBehaviors:SetupFlowNavigationBehavior.NextTemplate>
<ToggleSplitButton
x:Name="SetUpButton"
IsEnabled="{x:Bind ViewModel.ReadAndAgree, Mode=OneWay}"
IsEnabledChanged="SetUpButton_IsEnabledChanged"
IsCheckedChanged="SetUpButton_IsCheckedChanged"
Command="{x:Bind ViewModel.ConfigureAsAdminCommand, Mode=OneWay}"
x:Uid="ms-resource:///DevHome.SetupFlow/Resources/SetUpAsAdmin">
<SplitButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem
x:Uid="ms-resource:///DevHome.SetupFlow/Resources/SetUpAsNonAdmin"
Command="{x:Bind ViewModel.ConfigureAsNonAdminCommand}">
</MenuFlyoutItem>
</MenuFlyout>
</SplitButton.Flyout>
</ToggleSplitButton>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}">
<Setter Property="Margin" Value="6,0" />
</Style>
</StackPanel.Resources>
<Button x:Uid="SetUpAsNonAdmin" Command="{x:Bind ViewModel.ConfigureAsNonAdminCommand}"/>
<Button x:Uid="SetUpAsAdmin" Command="{x:Bind ViewModel.ConfigureAsAdminCommand}"/>
</StackPanel>
</setupFlowBehaviors:SetupFlowNavigationBehavior.NextTemplate>

<UserControl.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ public ConfigurationFileView()
this.InitializeComponent();
}

private void SetUpButton_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
// Align the checked state with the enabled state.
SetUpButton.IsChecked = SetUpButton.IsEnabled;
}

private void SetUpButton_IsCheckedChanged(ToggleSplitButton sender, ToggleSplitButtonIsCheckedChangedEventArgs args)
{
// When the toggle button is invoked, its state is changed.
// Always mark the toggle button as checked to ensure it visually looks toggled ON.
SetUpButton.IsChecked = true;
}

private async void Dependency_Click(Hyperlink sender, HyperlinkClickEventArgs args)
{
var textBlock = sender?.ContentStart?.VisualParent as TextBlock;
Expand Down
8 changes: 4 additions & 4 deletions tools/SetupFlow/DevHome.SetupFlow/Views/SetupFlowPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@
<HyperlinkButton
AutomationProperties.AutomationControlType="Button"
Command="{x:Bind ViewModel.CancelCommand, Mode=OneWay}"
MinWidth="120" Margin="4,0"
MinWidth="120" Margin="6,0"
x:Uid="ms-resource:///DevHome.SetupFlow/Resources/Cancel"
Visibility="{x:Bind ViewModel.Orchestrator.ShouldShowDoneButton, Mode=OneWay, Converter={StaticResource NegatedBoolToVisibilityConverter}}"/>
<Button
Command="{x:Bind ViewModel.CancelCommand, Mode=OneWay}"
MinWidth="120" Margin="4,0"
MinWidth="120" Margin="6,0"
x:Uid="ms-resource:///DevHome.SetupFlow/Resources/DoneButton"
Visibility="{x:Bind ViewModel.Orchestrator.ShouldShowDoneButton, Mode=OneWay}"/>
</Grid>
</setupFlowBehaviors:SetupFlowNavigationBehavior.DefaultCancelTemplate>
<setupFlowBehaviors:SetupFlowNavigationBehavior.DefaultPreviousTemplate>
<Button
Command="{x:Bind ViewModel.Orchestrator.GoToPreviousPageCommand, Mode=OneWay}"
MinWidth="120" Margin="4,0"
MinWidth="120" Margin="6,0"
Visibility="{x:Bind ViewModel.Orchestrator.HasPreviousPage, Mode=OneWay}"
x:Uid="ms-resource:///DevHome.SetupFlow/Resources/Previous" />
</setupFlowBehaviors:SetupFlowNavigationBehavior.DefaultPreviousTemplate>
Expand All @@ -126,7 +126,7 @@
<Button
Command="{x:Bind ViewModel.Orchestrator.GoToNextPageCommand, Mode=OneWay}"
Style="{StaticResource AccentButtonStyle}"
MinWidth="120" Margin="4,0"
MinWidth="120" Margin="6,0"
Content="{x:Bind ViewModel.Orchestrator.CurrentPageViewModel.NextPageButtonText, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind ViewModel.Orchestrator.CurrentPageViewModel.NextPageButtonToolTipText, Mode=OneWay}" />
</Grid>
Expand Down
Loading