<ui:Page xmlns:props="clr-namespace:Ink_Canvas.Properties"
          x:Class="Ink_Canvas.Windows.SettingsViews.Pages.BoardToolbarPage"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews.Pages"
          xmlns:helpers="clr-namespace:Ink_Canvas.Windows.SettingsViews.Helpers"
          xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
          xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
          xmlns:dd="urn:gong-wpf-dragdrop"
          xmlns:board="clr-namespace:Ink_Canvas.Controls.Toolbar.BoardToolbar"
          xmlns:touch="clr-namespace:Ink_Canvas.Helpers"
          mc:Ignorable="d"
          Title="{x:Static props:FloatingBarStrings.BoardToolbarPage_Title}">

    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Helpers/SharedSettingsResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <local:BoardIdToDisplayNameConverter x:Key="IdToNameConverter"/>
            <local:BoardIdToIconKeyConverter x:Key="IdToIconKeyConverter"/>
            <local:BoardIdToIconVisibilityConverter x:Key="IdToIconVisibilityConverter"/>
            <helpers:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
            <local:BoardAreaNameConverter x:Key="AreaNameConverter"/>
            <local:BoardGroupNameConverter x:Key="GroupNameConverter"/>
            <local:BoardPositionNameConverter x:Key="PositionNameConverter"/>
            <helpers:StringToGeometryConverter x:Key="StringToGeometryConverter"/>
            <local:BoardIdToPathDataConverter x:Key="IdToPathDataConverter"/>

        <DataTemplate x:Key="GroupChildItemTemplate" DataType="{x:Type board:BoardToolbarComponentEntry}">
            <Border Cursor="Hand">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    <ui:FontIcon touch:TouchAwareDragDropHelper.IsGripHandle="True"
                                 Icon="{x:Static ui:FluentSystemIcons.ReOrder_16_Regular}" FontSize="16"
                                 Cursor="SizeAll" VerticalAlignment="Center" Margin="-6,0,0,0"
                                 RenderTransformOrigin="0.5,0.5">
                        <ui:FontIcon.RenderTransform>
                            <RotateTransform Angle="90"/>
                        </ui:FontIcon.RenderTransform>
                    </ui:FontIcon>
                    <Grid Width="16" Height="16" Margin="2,0,4,0" VerticalAlignment="Center">
                        <Path Data="{Binding Id, Converter={StaticResource IdToPathDataConverter}}" Width="16" Height="16" Stretch="Uniform"
                              Fill="{DynamicResource {x:Static ui:ThemeKeys.TextFillColorPrimaryBrushKey}}"
                              Visibility="{Binding Id, Converter={StaticResource IdToIconVisibilityConverter}}"/>
                        <ui:FontIcon Icon="{Binding Id, Converter={StaticResource IdToIconKeyConverter}}" FontSize="16"
                                     Visibility="{Binding Id, Converter={StaticResource IdToIconVisibilityConverter}, ConverterParameter=fontIcon}"/>
                    </Grid>
                    <TextBlock Text="{Binding Id, Converter={StaticResource IdToNameConverter}}"
                               VerticalAlignment="Center" FontSize="13"/>
                    <Button Click="RemoveGroupChildItem_Click"
                            x:Name="BtnRemoveGroupChild"
                            Style="{StaticResource BorderlessIconButtonStyle}"
                            VerticalAlignment="Center"
                            Cursor="Hand"
                            Visibility="Collapsed">
                        <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Delete_16_Regular}" FontSize="16" Foreground="IndianRed"/>
                    </Button>
                </StackPanel>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="LibraryItemTemplate">
            <Border BorderThickness="0"
                    CornerRadius="6" Padding="10,8"
                    HorizontalAlignment="Stretch"
                    Cursor="Hand">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <ui:FontIcon Grid.Column="0" touch:TouchAwareDragDropHelper.IsGripHandle="True"
                                 Icon="{x:Static ui:FluentSystemIcons.ReOrderDotsVertical_24_Filled}" FontSize="16"
                                 Cursor="SizeAll" Margin="-1,0,2,0" VerticalAlignment="Center"/>
                    <Grid Grid.Column="1" Width="20" Height="20" Margin="0,0,8,0" VerticalAlignment="Center">
                        <Path Data="{Binding Id, Converter={StaticResource IdToPathDataConverter}}" Width="20" Height="20" Stretch="Uniform"
                              Fill="{DynamicResource {x:Static ui:ThemeKeys.TextFillColorPrimaryBrushKey}}"
                              Visibility="{Binding Id, Converter={StaticResource IdToIconVisibilityConverter}}"/>
                        <ui:FontIcon Icon="{Binding Id, Converter={StaticResource IdToIconKeyConverter}}" FontSize="20"
                                     Visibility="{Binding Id, Converter={StaticResource IdToIconVisibilityConverter}, ConverterParameter=fontIcon}"/>
                    </Grid>
                    <StackPanel Grid.Column="2">
                        <TextBlock Text="{Binding DisplayName}" FontWeight="Medium" FontSize="13"/>
                        <TextBlock Text="{Binding Description}" Opacity="0.65" FontSize="12"
                                   TextWrapping="Wrap" Margin="0,2,0,0"/>
                    </StackPanel>
                    <Button Grid.Column="3" Content="&#xE710;" FontFamily="Segoe MDL2 Assets" FontSize="12"
                            Click="AddLibraryItem_Click" x:Name="BtnAddItem"
                            Background="Transparent" BorderThickness="0"
                            Padding="6,4" VerticalAlignment="Center"
                            ToolTip="{x:Static props:FloatingBarStrings.ToolbarPage_AddToAdded}"
                            Cursor="Hand" Visibility="Collapsed"/>
                </Grid>
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="GroupEntryTemplate" DataType="{x:Type board:BoardToolbarGroupEntry}">
            <Border Background="{DynamicResource CardBackgroundFillColorSecondaryBrush}"
                    BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
                    BorderThickness="1"
                    CornerRadius="8" Padding="8" Margin="0,4">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <ui:FontIcon Grid.Column="0" touch:TouchAwareDragDropHelper.IsGripHandle="True"
                                 touch:TouchAwareDragDropHelper.IsExplicitVisible="True"
                                 Icon="{x:Static ui:FluentSystemIcons.ReOrder_20_Regular}" FontSize="16"
                                 Cursor="SizeAll" Margin="-2,0,4,0" VerticalAlignment="Stretch"
                                 RenderTransformOrigin="0.5,0.5">
                        <ui:FontIcon.RenderTransform>
                            <RotateTransform Angle="90"/>
                        </ui:FontIcon.RenderTransform>
                    </ui:FontIcon>
                    <ListView Grid.Column="1" ItemsSource="{Binding Components}"
                             ItemTemplate="{StaticResource GroupChildItemTemplate}"
                             dd:DragDrop.IsDragSource="True"
                             dd:DragDrop.IsDropTarget="True"
                             dd:DragDrop.DropHandler="{Binding DataContext.GroupDropHandler, RelativeSource={RelativeSource AncestorType=ui:Page}}"
                             touch:TouchAwareDragDropHelper.IsEnabled="True"
                             Background="Transparent" BorderThickness="0"
                             SelectionChanged="GroupChildList_SelectionChanged"
                             MinHeight="32">
                        <ListView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel Orientation="Horizontal"/>
                            </ItemsPanelTemplate>
                        </ListView.ItemsPanel>
                    </ListView>
                    <Border Grid.Column="2" VerticalAlignment="Top" HorizontalAlignment="Right"
                            Padding="4" Margin="4,0,0,0" CornerRadius="4"
                            Background="{DynamicResource ControlFillColorDefaultBrush}">
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                            <Button Click="InsertGroupBelow_Click" Padding="4,2" Margin="0,0,2,0"
                                    Background="Transparent" BorderThickness="0"
                                    ToolTip="{x:Static props:FloatingBarStrings.BoardToolbarPage_AddGroup2}"
                                    Cursor="Hand">
                                <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Add_16_Regular}" FontSize="12"/>
                            </Button>
                            <Button Click="RemoveGroup_Click" Padding="4,2"
                                    Background="Transparent" BorderThickness="0"
                                    ToolTip="{x:Static props:FloatingBarStrings.BoardToolbarPage_DeleteProfile}"
                                    Cursor="Hand">
                                <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Delete_16_Regular}" FontSize="12"/>
                            </Button>
                        </StackPanel>
                    </Border>
                </Grid>
            </Border>
        </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>

    <Grid Margin="24,0,24,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto" MinHeight="58"/>
            <RowDefinition Height="6"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- ===== Section 1: 配置文件 + 区域选择 ===== -->
        <StackPanel Grid.Row="0" Margin="0,36,0,6">
            <TextBlock Text="{x:Static props:FloatingBarStrings.BoardToolbarPage_ConfigProfiles}"
                       FontSize="14" FontWeight="SemiBold" Margin="0,0,0,6"/>
            <DockPanel Margin="0,0,0,4">
                <ComboBox x:Name="ComboBoxConfigFile" SelectionChanged="ComboBoxConfigFile_SelectionChanged"
                          DockPanel.Dock="Left" VerticalAlignment="Center"/>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right">
                    <Button Click="ButtonRefreshConfig_Click" Style="{StaticResource BorderlessIconButtonStyle}" Padding="8,6" Margin="0,0,4,0"
                            ToolTip="{x:Static props:FloatingBarStrings.ToolbarPage_RefreshProfile}">
                        <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.ArrowSync_16_Regular}"/>
                    </Button>
                    <Button Click="ButtonNewConfig_Click" Style="{StaticResource BorderlessIconButtonStyle}" Padding="8,6" Margin="0,0,4,0"
                            ToolTip="{x:Static props:FloatingBarStrings.ToolbarPage_NewProfile}">
                        <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Add_16_Regular}"/>
                    </Button>
                    <Button Click="ButtonDuplicateConfig_Click" Style="{StaticResource BorderlessIconButtonStyle}" Padding="8,6" Margin="0,0,4,0"
                            ToolTip="{x:Static props:FloatingBarStrings.ToolbarPage_DuplicateProfile}">
                        <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Copy_16_Regular}"/>
                    </Button>
                    <Button Click="ButtonDeleteConfig_Click" Style="{StaticResource BorderlessIconButtonStyle}" Padding="8,6" Margin="0,0,4,0"
                            ToolTip="{x:Static props:FloatingBarStrings.ToolbarPage_DeleteProfile}">
                        <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Delete_16_Regular}"/>
                    </Button>
                    <Button Click="ButtonOpenConfigFolder_Click" Style="{StaticResource BorderlessIconButtonStyle}" Padding="8,6"
                            ToolTip="{x:Static props:FloatingBarStrings.ToolbarPage_OpenConfigFolder}">
                        <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.FolderOpen_16_Regular}"/>
                    </Button>
                </StackPanel>
            </DockPanel>

            <!-- 区域选择 -->
            <TextBlock Text="{x:Static props:FloatingBarStrings.BoardToolbarPage_Areas}"
                       FontSize="14" FontWeight="SemiBold" Margin="0,12,0,6"/>
            <WrapPanel Orientation="Horizontal" Margin="0,0,0,4">
                <RadioButton x:Name="RadioAreaLeft" Content="{x:Static props:FloatingBarStrings.BoardToolbarPage_LeftArea}"
                             Checked="AreaRadioButton_Changed" Margin="0,0,16,0" FontSize="13" FontWeight="Medium"/>
                <RadioButton x:Name="RadioAreaCenter" Content="{x:Static props:FloatingBarStrings.BoardToolbarPage_CenterArea}"
                             Checked="AreaRadioButton_Changed" Margin="0,0,16,0" FontSize="13" FontWeight="Medium"/>
                <RadioButton x:Name="RadioAreaRight" Content="{x:Static props:FloatingBarStrings.BoardToolbarPage_RightArea}"
                             Checked="AreaRadioButton_Changed" FontSize="13" FontWeight="Medium"/>
            </WrapPanel>
        </StackPanel>

        <!-- ===== Section 2: 当前区域的分组 ===== -->
        <DockPanel Grid.Row="1" LastChildFill="True" ClipToBounds="True">
            <TextBlock Text="{x:Static props:FloatingBarStrings.BoardToolbarPage_AreaGroups}"
                       FontSize="14" FontWeight="SemiBold" Margin="0,0,0,4"
                       DockPanel.Dock="Top"/>
            <StackPanel Orientation="Horizontal" Margin="0,0,0,6" DockPanel.Dock="Top">
                <Button Content="{x:Static props:FloatingBarStrings.BoardToolbarPage_AddGroup2}"
                        Click="ButtonAddGroup_Click" Padding="10,5" FontSize="12"/>
            </StackPanel>
            <ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="VerticalFirst">
                <ui:ListView x:Name="AreaGroupsControl"
                              ItemTemplate="{StaticResource GroupEntryTemplate}"
                              dd:DragDrop.IsDragSource="True"
                              dd:DragDrop.IsDropTarget="True"
                              dd:DragDrop.DropHandler="{Binding DataContext.GroupListDropHandler, RelativeSource={RelativeSource AncestorType=ui:Page}}"
                              touch:TouchAwareDragDropHelper.IsEnabled="True"
                              Background="Transparent" BorderThickness="0"
                              SelectionMode="Single">
                    <ui:ListView.ItemContainerStyle>
                        <Style TargetType="ui:ListViewItem">
                            <Setter Property="Padding" Value="0"/>
                            <Setter Property="MinHeight" Value="0"/>
                            <Setter Property="Margin" Value="0"/>
                            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        </Style>
                    </ui:ListView.ItemContainerStyle>
                    <ui:ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel/>
                        </ItemsPanelTemplate>
                    </ui:ListView.ItemsPanel>
                </ui:ListView>
            </ScrollViewer>
        </DockPanel>

        <!-- ===== GridSplitter ===== -->
        <GridSplitter Grid.Row="2" Height="6" HorizontalAlignment="Stretch"
                      Background="{DynamicResource ControlStrokeColorDefaultBrush}"
                      ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"
                      Cursor="SizeNS" Margin="0,1,0,1"/>

        <!-- ===== Section 3: 组件库 / 组件设置 ===== -->
        <TabControl Grid.Row="3" x:Name="SettingsTabControl" Margin="0,4,0,0"
                    Style="{StaticResource {x:Static ui:ThemeKeys.TabControlPivotStyleKey}}"
                    SelectedIndex="{Binding SettingsTabIndex}">

            <!-- Tab 1: 组件库 -->
            <TabItem Header="{x:Static props:FloatingBarStrings.ToolbarPage_ComponentLibrary}">
                <ScrollViewer PanningMode="VerticalFirst" VerticalScrollBarVisibility="Auto">
                    <ikw:SimpleStackPanel Spacing="4" Margin="0,8,0,0">
                        <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_ComponentLibraryHint}"
                                   Opacity="0.65" FontSize="12" Margin="0,0,0,8"/>
                        <ui:ListView ItemsSource="{Binding AvailableItems}"
                                 ItemTemplate="{StaticResource LibraryItemTemplate}"
                                 dd:DragDrop.IsDragSource="True"
                                 touch:TouchAwareDragDropHelper.IsEnabled="True"
                                 Background="Transparent" BorderThickness="0"
                                 SelectionMode="Single"
                                 SelectionChanged="LibraryList_SelectionChanged">
                            <ui:ListView.ItemContainerStyle>
                                <Style TargetType="ui:ListViewItem">
                                    <Setter Property="Padding" Value="0"/>
                                    <Setter Property="MinHeight" Value="0"/>
                                    <Setter Property="Margin" Value="1.5"/>
                                    <EventSetter Event="Loaded" Handler="ListViewItem_Loaded"/>
                                </Style>
                            </ui:ListView.ItemContainerStyle>
                            <ui:ListView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel Orientation="Horizontal"
                                               helpers:WrapPanelAutoResize.TargetWidth="225"/>
                                </ItemsPanelTemplate>
                            </ui:ListView.ItemsPanel>
                        </ui:ListView>
                    </ikw:SimpleStackPanel>
                </ScrollViewer>
            </TabItem>

            <!-- Tab 2: 组件设置 -->
            <TabItem Header="{x:Static props:FloatingBarStrings.ToolbarPage_ComponentSettings}">
                <TabItem.Visibility>
                    <Binding Path="SelectedEntry" Converter="{StaticResource NullToVisibilityConverter}"/>
                </TabItem.Visibility>
                <ScrollViewer PanningMode="VerticalFirst" VerticalScrollBarVisibility="Auto">
                    <ikw:SimpleStackPanel Spacing="4" Margin="0,8,0,0">

                        <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_ComponentProperties}" FontSize="14" FontWeight="SemiBold" Margin="0,0,0,8"/>

                        <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_Size}" FontSize="14" FontWeight="SemiBold" Margin="0,12,0,4"/>
                        <Grid Margin="0,0,0,4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,4,4">
                                <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_FixedWidth}" FontSize="12" Opacity="0.7" Margin="0,0,0,2"/>
                                <TextBox x:Name="TextBoxFixedWidth" Width="80" HorizontalAlignment="Left"
                                         TextChanged="ComponentSetting_TextChanged"/>
                            </StackPanel>
                            <StackPanel Grid.Row="0" Grid.Column="1" Margin="4,0,0,4">
                                <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_FixedHeight}" FontSize="12" Opacity="0.7" Margin="0,0,0,2"/>
                                <TextBox x:Name="TextBoxFixedHeight" Width="80" HorizontalAlignment="Left"
                                         TextChanged="ComponentSetting_TextChanged"/>
                            </StackPanel>
                            <StackPanel Grid.Row="1" Grid.Column="0" Margin="0,0,4,0">
                                <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_MinWidth}" FontSize="12" Opacity="0.7" Margin="0,0,0,2"/>
                                <TextBox x:Name="TextBoxMinWidth" Width="80" HorizontalAlignment="Left"
                                         TextChanged="ComponentSetting_TextChanged"/>
                            </StackPanel>
                            <StackPanel Grid.Row="1" Grid.Column="1" Margin="4,0,0,0">
                                <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_MinHeight}" FontSize="12" Opacity="0.7" Margin="0,0,0,2"/>
                                <TextBox x:Name="TextBoxMinHeight" Width="80" HorizontalAlignment="Left"
                                         TextChanged="ComponentSetting_TextChanged"/>
                            </StackPanel>
                        </Grid>

                        <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_Appearance}" FontSize="14" FontWeight="SemiBold" Margin="0,8,0,4"/>
                        <Grid Margin="0,0,0,4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Column="0" Margin="0,0,4,0">
                                <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_FontSize}" FontSize="12" Opacity="0.7" Margin="0,0,0,2"/>
                                <TextBox x:Name="TextBoxFontSize" Width="60" HorizontalAlignment="Left"
                                         TextChanged="ComponentSetting_TextChanged"/>
                            </StackPanel>
                            <StackPanel Grid.Column="1" Margin="4,0,0,0">
                                <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_Opacity}" FontSize="12" Opacity="0.7" Margin="0,0,0,2"/>
                                <TextBox x:Name="TextBoxOpacity" Width="60" HorizontalAlignment="Left"
                                         TextChanged="ComponentSetting_TextChanged"/>
                            </StackPanel>
                        </Grid>

                        <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_Margin}" FontSize="14" FontWeight="SemiBold" Margin="0,8,0,4"/>
                        <TextBlock Text="{x:Static props:FloatingBarStrings.ToolbarPage_MarginHint}" FontSize="12" Opacity="0.65" Margin="0,0,0,4"/>
                        <Grid Margin="0,0,0,4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="TextBoxMarginLeft" Grid.Column="0" Margin="0,0,2,0"
                                     TextChanged="ComponentSetting_TextChanged"/>
                            <TextBox x:Name="TextBoxMarginTop" Grid.Column="1" Margin="2,0,2,0"
                                     TextChanged="ComponentSetting_TextChanged"/>
                            <TextBox x:Name="TextBoxMarginRight" Grid.Column="2" Margin="2,0,2,0"
                                     TextChanged="ComponentSetting_TextChanged"/>
                            <TextBox x:Name="TextBoxMarginBottom" Grid.Column="3" Margin="2,0,0,0"
                                     TextChanged="ComponentSetting_TextChanged"/>
                        </Grid>

                        <Button Content="{x:Static props:FloatingBarStrings.ToolbarPage_ResetComponentSettings}" Click="ButtonResetComponentSettings_Click"
                                Padding="12,6" HorizontalAlignment="Left" Margin="0,8,0,0"/>

                    </ikw:SimpleStackPanel>
                </ScrollViewer>
            </TabItem>
        </TabControl>

        <!-- ===== Section 4: 恢复默认布局 ===== -->
        <Button Grid.Row="4" Content="{x:Static props:FloatingBarStrings.BoardToolbarPage_ResetDefault}" Click="ButtonReset_Click"
                Padding="20,10" HorizontalAlignment="Left" Margin="0,12,0,16"/>
    </Grid>
</ui:Page>
