UI/SelectColumnsWindow.xaml

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Select Process Columns"
        Height="520" Width="700"
        MinHeight="430" MinWidth="600"
        WindowStartupLocation="CenterOwner"
        ResizeMode="CanResizeWithGrip"
        Background="{DynamicResource BrushWindowBg}"
        Foreground="{DynamicResource BrushTextPrimary}"
        FontFamily="Segoe UI" FontSize="12"
        TextOptions.TextFormattingMode="Display"
        UseLayoutRounding="True" SnapsToDevicePixels="True">
 
    <Window.Resources>
        <SolidColorBrush x:Key="BrushWindowBg" Color="#F8FAFC"/>
        <SolidColorBrush x:Key="BrushToolbarBg" Color="#F1F5F9"/>
        <SolidColorBrush x:Key="BrushSurfaceBg" Color="#FFFFFF"/>
        <SolidColorBrush x:Key="BrushHeaderBg" Color="#E2E8F0"/>
        <SolidColorBrush x:Key="BrushBorderSubtle" Color="#CBD5E1"/>
        <SolidColorBrush x:Key="BrushTextPrimary" Color="#0F172A"/>
        <SolidColorBrush x:Key="BrushTextSecondary" Color="#334155"/>
        <SolidColorBrush x:Key="BrushTextMuted" Color="#64748B"/>
        <SolidColorBrush x:Key="BrushRowHover" Color="#220284C7"/>
        <SolidColorBrush x:Key="BrushRowSelectedBg" Color="#006CBE"/>
        <SolidColorBrush x:Key="BrushRowSelectedFg" Color="#FFFFFF"/>
 
        <Style TargetType="CheckBox">
            <Setter Property="Foreground" Value="{DynamicResource BrushTextPrimary}"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Background" Value="{DynamicResource BrushSurfaceBg}"/>
            <Setter Property="Foreground" Value="{DynamicResource BrushTextPrimary}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BrushBorderSubtle}"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>
        <Style TargetType="Button">
            <Setter Property="Background" Value="{DynamicResource BrushToolbarBg}"/>
            <Setter Property="Foreground" Value="{DynamicResource BrushTextPrimary}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BrushBorderSubtle}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="10,4"/>
            <Setter Property="Cursor" Value="Hand"/>
        </Style>
        <Style x:Key="PresetButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="{DynamicResource BrushSurfaceBg}"/>
            <Setter Property="Foreground" Value="{DynamicResource BrushTextPrimary}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BrushBorderSubtle}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="9,3"/>
            <Setter Property="Margin" Value="0,0,6,0"/>
            <Setter Property="FontSize" Value="11"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="Cursor" Value="Hand"/>
        </Style>
    </Window.Resources>
 
    <Grid Margin="14">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
 
        <!-- Header -->
        <DockPanel Grid.Row="0" Margin="0,0,0,10">
            <Border DockPanel.Dock="Right" Background="{DynamicResource BrushHeaderBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1" CornerRadius="3" Padding="8,3" VerticalAlignment="Center">
                <TextBlock x:Name="TxtSelectedCount" Text="10 of 30 visible" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource BrushTextSecondary}"/>
            </Border>
            <StackPanel>
                <TextBlock Text="Select Process Columns" FontWeight="Bold" FontSize="14" Foreground="{DynamicResource BrushTextPrimary}"/>
                <TextBlock Text="Toggle visible columns, reorder display positions, or apply a preset layout." Foreground="{DynamicResource BrushTextSecondary}" FontSize="11" Margin="0,2,0,0"/>
            </StackPanel>
        </DockPanel>
 
        <!-- Presets Bar -->
        <Border Grid.Row="1" Background="{DynamicResource BrushToolbarBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1" CornerRadius="3" Padding="8,6" Margin="0,0,0,10">
            <DockPanel>
                <TextBlock DockPanel.Dock="Left" Text="Presets:" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource BrushTextSecondary}" VerticalAlignment="Center" Margin="0,0,8,0"/>
                <StackPanel Orientation="Horizontal">
                    <Button x:Name="BtnPresetDefault" Content="Default (10)" Style="{StaticResource PresetButtonStyle}" ToolTip="Restore the standard PSRPM 10-column layout"/>
                    <Button x:Name="BtnPresetProcExp" Content="Process Explorer" Style="{StaticResource PresetButtonStyle}" ToolTip="Default layout plus Version and Command Line"/>
                    <Button x:Name="BtnPresetForensic" Content="Forensic / Security" Style="{StaticResource PresetButtonStyle}" ToolTip="PID, Parent PID, User, Session, Architecture, Start Time, Version, Image Path, Command Line"/>
                </StackPanel>
            </DockPanel>
        </Border>
 
        <!-- Dual Pane: Available Columns + Display Order -->
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1.45*"/>
                <ColumnDefinition Width="12"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
 
            <!-- Left Pane: Search + Grouped Columns List -->
            <Border Grid.Column="0" Background="{DynamicResource BrushSurfaceBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1" CornerRadius="3">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
 
                    <Border Grid.Row="0" Background="{DynamicResource BrushHeaderBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="0,0,0,1" Padding="8,5">
                        <TextBlock Text="Available Columns" FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource BrushTextPrimary}"/>
                    </Border>
 
                    <!-- Filter Box -->
                    <Border Grid.Row="1" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="0,0,0,1" Padding="6">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="TxtColFilter" Grid.Column="0" Padding="6,3" VerticalContentAlignment="Center" ToolTip="Filter available columns by name, category, or description"/>
                            <TextBlock Grid.Column="0" Text="Filter columns..." Foreground="{DynamicResource BrushTextMuted}" FontSize="11" Margin="8,0,0,0" VerticalAlignment="Center" IsHitTestVisible="False">
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="Visibility" Value="Collapsed"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding Text.Length, ElementName=TxtColFilter}" Value="0">
                                                <Setter Property="Visibility" Value="Visible"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                            <Button x:Name="BtnColFilterClear" Grid.Column="1" Content="Clear" Padding="7,2" Margin="6,0,0,0" FontSize="11"/>
                        </Grid>
                    </Border>
 
                    <!-- Columns CheckList -->
                    <ListBox x:Name="LstAvailableColumns" Grid.Row="2" BorderThickness="0" Background="{DynamicResource BrushSurfaceBg}" Foreground="{DynamicResource BrushTextPrimary}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                <Setter Property="Padding" Value="6,3"/>
                                <Setter Property="Visibility" Value="{Binding RowVisibility}"/>
                                <Setter Property="Focusable" Value="False"/>
                            </Style>
                        </ListBox.ItemContainerStyle>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid Margin="0,1">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <CheckBox Grid.Column="0" IsChecked="{Binding IsChecked, Mode=TwoWay}" IsEnabled="{Binding IsCheckEnabled}" VerticalAlignment="Center" Margin="0,0,6,0"/>
                                    <StackPanel Grid.Column="1" Orientation="Vertical" VerticalAlignment="Center">
                                        <TextBlock Text="{Binding Header}" FontWeight="SemiBold" FontSize="11.5" Foreground="{DynamicResource BrushTextPrimary}"/>
                                        <TextBlock Text="{Binding Hint}" FontSize="10" Foreground="{DynamicResource BrushTextMuted}" TextTrimming="CharacterEllipsis"/>
                                    </StackPanel>
                                    <Border Grid.Column="2" Background="{DynamicResource BrushToolbarBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1" CornerRadius="2" Padding="5,1" Margin="6,0,0,0" VerticalAlignment="Center">
                                        <TextBlock Text="{Binding Group}" FontSize="9.5" Foreground="{DynamicResource BrushTextSecondary}"/>
                                    </Border>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </Border>
 
            <!-- Right Pane: Active Column Order -->
            <Border Grid.Column="2" Background="{DynamicResource BrushSurfaceBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1" CornerRadius="3">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
 
                    <Border Grid.Row="0" Background="{DynamicResource BrushHeaderBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="0,0,0,1" Padding="8,5">
                        <TextBlock Text="Display Order (Visible)" FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource BrushTextPrimary}"/>
                    </Border>
 
                    <ListBox x:Name="LstColumnOrder" Grid.Row="1" BorderThickness="0" Background="{DynamicResource BrushSurfaceBg}" Foreground="{DynamicResource BrushTextPrimary}" DisplayMemberPath="OrderLabel" SelectionMode="Single" Padding="2"/>
 
                    <Border Grid.Row="2" Background="{DynamicResource BrushToolbarBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="0,1,0,0" Padding="6">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                            <Button x:Name="BtnColMoveUp" Content="Move Up" Padding="10,3" Margin="0,0,6,0" FontSize="11"/>
                            <Button x:Name="BtnColMoveDown" Content="Move Down" Padding="10,3" FontSize="11"/>
                        </StackPanel>
                    </Border>
                </Grid>
            </Border>
        </Grid>
 
        <!-- Footer -->
        <DockPanel Grid.Row="3" Margin="0,12,0,0">
            <Button x:Name="BtnColResetDefaults" DockPanel.Dock="Left" Content="Reset Defaults" Height="28" Padding="12,4"/>
            <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button x:Name="BtnColOk" Content="OK" Width="88" Height="28" Margin="0,0,8,0" IsDefault="True" FontWeight="SemiBold"/>
                <Button x:Name="BtnColCancel" Content="Cancel" Width="84" Height="28" IsCancel="True"/>
            </StackPanel>
        </DockPanel>
    </Grid>
</Window>