/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Views/Settings/LayoutPage.xaml
190 строк
9 KB
yair100
Feature: Added setting to auto size columns to fit (#18699)
08 июл 2026, 19:11
Не верифицирован
08 июл 2026, 19:11
646de8b
Код
Авторство
О чём код?
<!-- Copyright (c) Files Community. Licensed under the MIT License. --> <Page x:Class="Files.App.Views.Settings.LayoutPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="using:CommunityToolkit.WinUI.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:helpers="using:Files.App.Helpers" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:uc="using:Files.App.UserControls" xmlns:vm="using:Files.App.ViewModels.Settings" xmlns:wctcontrols="using:CommunityToolkit.WinUI.Controls" mc:Ignorable="d"> <Page.Resources> <ResourceDictionary> <converters:BoolNegationConverter x:Key="BoolNegationConverter" /> </ResourceDictionary> </Page.Resources> <Page.DataContext> <vm:LayoutViewModel x:Name="ViewModel" /> </Page.DataContext> <Grid> <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Spacing="4"> <!-- Title --> <TextBlock Padding="0,0,0,12" Style="{StaticResource App.Theme.SubtitleTextBlockStyle}" Text="{helpers:ResourceString Name=Layout}" /> <!-- Folder Overrides --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=SyncFolderPreferencesAcrossDirectories}"> <wctcontrols:SettingsCard.HeaderIcon> <FontIcon Glyph="" /> </wctcontrols:SettingsCard.HeaderIcon> <ToggleSwitch x:Name="SyncPreferencesToggleSwitch" AutomationProperties.Name="{helpers:ResourceString Name=SyncFolderPreferencesAcrossDirectories}" IsOn="{x:Bind ViewModel.SyncFolderPreferencesAcrossDirectories, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <!-- Layout Type --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=LayoutType}"> <wctcontrols:SettingsCard.HeaderIcon> <FontIcon Glyph="" /> </wctcontrols:SettingsCard.HeaderIcon> <uc:ComboBoxEx AutomationProperties.Name="{helpers:ResourceString Name=LayoutType}" SelectedIndex="{x:Bind ViewModel.SelectedDefaultLayoutModeIndex, Mode=TwoWay}"> <ComboBoxItem Content="{helpers:ResourceString Name=Details}" /> <ComboBoxItem Content="{helpers:ResourceString Name=List}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Cards}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Columns}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Grid}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Adaptive}" IsEnabled="{x:Bind ViewModel.SyncFolderPreferencesAcrossDirectories, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}" /> </uc:ComboBoxEx> </wctcontrols:SettingsCard> <!-- Sorting & grouping --> <TextBlock Padding="0,16,0,4" FontSize="16" FontWeight="Medium" Text="{helpers:ResourceString Name=SortingAndGrouping}" /> <!-- Default sorting options --> <wctcontrols:SettingsExpander Header="{helpers:ResourceString Name=SortBy}"> <wctcontrols:SettingsExpander.HeaderIcon> <FontIcon Glyph="" /> </wctcontrols:SettingsExpander.HeaderIcon> <uc:ComboBoxEx AutomationProperties.Name="{helpers:ResourceString Name=SortBy}" SelectedIndex="{x:Bind ViewModel.SelectedDefaultSortingIndex, Mode=TwoWay}"> <ComboBoxItem Content="{helpers:ResourceString Name=Name}" /> <ComboBoxItem Content="{helpers:ResourceString Name=DateModifiedLowerCase}" /> <ComboBoxItem Content="{helpers:ResourceString Name=DateCreated}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Size}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Type}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Tag}" /> </uc:ComboBoxEx> <wctcontrols:SettingsExpander.Items> <!-- Sort in Descending order --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=SortInDescendingOrder}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=SortInDescendingOrder}" IsOn="{x:Bind ViewModel.SortInDescendingOrder, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <!-- Sort Priority --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=SortPriority}"> <uc:ComboBoxEx AutomationProperties.Name="{helpers:ResourceString Name=SortPriority}" SelectedIndex="{x:Bind ViewModel.SelectedDefaultSortPriorityIndex, Mode=TwoWay}"> <ComboBoxItem Content="{helpers:ResourceString Name=SortFoldersFirst}" /> <ComboBoxItem Content="{helpers:ResourceString Name=SortFilesFirst}" /> <ComboBoxItem Content="{helpers:ResourceString Name=SortFilesAndFoldersTogether}" /> </uc:ComboBoxEx> </wctcontrols:SettingsCard> </wctcontrols:SettingsExpander.Items> </wctcontrols:SettingsExpander> <!-- Default grouping options --> <wctcontrols:SettingsExpander Header="{helpers:ResourceString Name=GroupBy}"> <wctcontrols:SettingsExpander.HeaderIcon> <FontIcon Glyph="" /> </wctcontrols:SettingsExpander.HeaderIcon> <uc:ComboBoxEx AutomationProperties.Name="{helpers:ResourceString Name=GroupBy}" SelectedIndex="{x:Bind ViewModel.SelectedDefaultGroupingIndex, Mode=TwoWay}"> <ComboBoxItem Content="{helpers:ResourceString Name=None}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Name}" /> <ComboBoxItem Content="{helpers:ResourceString Name=DateModifiedLowerCase}" /> <ComboBoxItem Content="{helpers:ResourceString Name=DateCreated}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Size}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Type}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Tag}" /> </uc:ComboBoxEx> <wctcontrols:SettingsExpander.Items> <!-- Group in Descending order --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=GroupInDescendingOrder}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=GroupInDescendingOrder}" IsEnabled="{x:Bind ViewModel.IsDefaultGrouped, Mode=OneWay}" IsOn="{x:Bind ViewModel.GroupInDescendingOrder, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <!-- Group by date unit --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=GroupByDateUnit}"> <uc:ComboBoxEx AutomationProperties.Name="{helpers:ResourceString Name=GroupByDateUnit}" IsEnabled="{x:Bind ViewModel.IsGroupByDate, Mode=OneWay}" SelectedIndex="{x:Bind ViewModel.SelectedDefaultGroupByDateUnitIndex, Mode=TwoWay}"> <ComboBoxItem Content="{helpers:ResourceString Name=Year}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Month}" /> <ComboBoxItem Content="{helpers:ResourceString Name=Day}" /> </uc:ComboBoxEx> </wctcontrols:SettingsCard> </wctcontrols:SettingsExpander.Items> </wctcontrols:SettingsExpander> <!-- Details View --> <TextBlock Padding="0,16,0,4" FontSize="16" FontWeight="Medium" Text="{helpers:ResourceString Name=DetailsView}" /> <!-- Auto-fit Columns --> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=AutoSizeColumnsInDetailsLayout}"> <wctcontrols:SettingsCard.HeaderIcon> <FontIcon Glyph="" /> </wctcontrols:SettingsCard.HeaderIcon> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=AutoSizeColumnsInDetailsLayout}" IsOn="{x:Bind ViewModel.AutoSizeColumnsInDetailsLayout, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <!-- Columns --> <wctcontrols:SettingsExpander Header="{helpers:ResourceString Name=Columns}"> <wctcontrols:SettingsExpander.HeaderIcon> <FontIcon Glyph="" /> </wctcontrols:SettingsExpander.HeaderIcon> <wctcontrols:SettingsExpander.Items> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=TagColumn}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=TagColumn}" IsOn="{x:Bind ViewModel.ShowFileTagColumn, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=SizeColumn}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=SizeColumn}" IsOn="{x:Bind ViewModel.ShowSizeColumn, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=TypeColumn}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=TypeColumn}" IsOn="{x:Bind ViewModel.ShowTypeColumn, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=DateColumn}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=DateColumn}" IsOn="{x:Bind ViewModel.ShowDateColumn, Mode=TwoWay}" /> </wctcontrols:SettingsCard> <wctcontrols:SettingsCard Header="{helpers:ResourceString Name=DateCreatedColumn}"> <ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=DateCreatedColumn}" IsOn="{x:Bind ViewModel.ShowDateCreatedColumn, Mode=TwoWay}" /> </wctcontrols:SettingsCard> </wctcontrols:SettingsExpander.Items> </wctcontrols:SettingsExpander> </StackPanel> <!-- Adaptive Layout Disabled Teaching Tip --> <TeachingTip CloseButtonContent="{helpers:ResourceString Name=OK}" IsLightDismissEnabled="True" IsOpen="{x:Bind ViewModel.ShowAdaptiveDisabledTeachingTip, Mode=TwoWay}" Subtitle="{helpers:ResourceString Name=AdaptiveLayoutDisabledNotification}" Target="{x:Bind SyncPreferencesToggleSwitch}" /> </Grid> </Page>