UI/FindHandleWindow.xaml

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Find Handle or DLL Substring"
        Height="540" Width="820" MinHeight="420" MinWidth="680"
        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="#F1F5F9"/>
        <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="#F1F5F9"/>
        <SolidColorBrush x:Key="BrushRowSelectedBg" Color="#006CBE"/>
        <SolidColorBrush x:Key="BrushRowSelectedFg" Color="#FFFFFF"/>
 
        <Style x:Key="RightTabularText" TargetType="TextBlock">
            <Setter Property="TextAlignment" Value="Right"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Padding" Value="4,0,6,0"/>
            <Setter Property="Typography.NumeralAlignment" Value="Tabular"/>
        </Style>
 
        <Style x:Key="EllipsisCellText" TargetType="TextBlock">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
            <Setter Property="Padding" Value="4,0"/>
        </Style>
 
        <Style x:Key="ActionButtonStyle" TargetType="Button">
            <Setter Property="Padding" Value="10,4"/>
            <Setter Property="Margin" Value="4,0"/>
            <Setter Property="FontSize" Value="11.5"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <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="Cursor" Value="Hand"/>
        </Style>
    </Window.Resources>
 
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
 
        <!-- Search Header Strip -->
        <Border Grid.Row="0" Background="{DynamicResource BrushToolbarBg}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1" CornerRadius="3" Padding="8,6" Margin="0,0,0,8">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
 
                <TextBlock Grid.Row="0" Grid.Column="0" Text="Handle or DLL substring:" VerticalAlignment="Center" FontWeight="SemiBold" Margin="0,0,8,0"/>
                <TextBox Grid.Row="0" Grid.Column="1" x:Name="TxtSearchHandle" Height="26" VerticalContentAlignment="Center" Padding="4,0" Background="{DynamicResource BrushSurfaceBg}" Foreground="{DynamicResource BrushTextPrimary}" BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1"/>
                <Button Grid.Row="0" Grid.Column="2" x:Name="BtnSearchHandle" Content="Search" Width="75" Height="26" Margin="6,0,0,0" Style="{StaticResource ActionButtonStyle}" IsDefault="True"/>
 
                <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" x:Name="TxtHandleStatus" Text="Enter a file name, folder path, DLL, or registry key to search across processes." Foreground="{DynamicResource BrushTextMuted}" FontSize="11" Margin="0,5,0,0"/>
            </Grid>
        </Border>
 
        <!-- Search Results Grid -->
        <DataGrid Grid.Row="1" x:Name="GridHandleResults"
                  AutoGenerateColumns="False" IsReadOnly="True"
                  SelectionMode="Single" SelectionUnit="FullRow"
                  HeadersVisibility="Column" GridLinesVisibility="Horizontal"
                  RowHeaderWidth="0" RowHeight="22"
                  Background="{DynamicResource BrushSurfaceBg}"
                  Foreground="{DynamicResource BrushTextPrimary}"
                  BorderBrush="{DynamicResource BrushBorderSubtle}" BorderThickness="1">
            <DataGrid.ColumnHeaderStyle>
                <Style TargetType="DataGridColumnHeader">
                    <Setter Property="Background" Value="{DynamicResource BrushHeaderBg}"/>
                    <Setter Property="Foreground" Value="{DynamicResource BrushTextPrimary}"/>
                    <Setter Property="FontWeight" Value="SemiBold"/>
                    <Setter Property="FontSize" Value="11"/>
                    <Setter Property="Padding" Value="6,2"/>
                    <Setter Property="BorderBrush" Value="{DynamicResource BrushBorderSubtle}"/>
                    <Setter Property="BorderThickness" Value="0,0,1,1"/>
                </Style>
            </DataGrid.ColumnHeaderStyle>
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Setter Property="Background" Value="Transparent"/>
                    <Setter Property="Foreground" Value="{DynamicResource BrushTextPrimary}"/>
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushRowHover}"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushRowSelectedBg}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushRowSelectedFg}"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.CellStyle>
                <Style TargetType="DataGridCell">
                    <Setter Property="BorderThickness" Value="0"/>
                    <Setter Property="Padding" Value="4,0"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="{DynamicResource BrushRowSelectedBg}"/>
                            <Setter Property="Foreground" Value="{DynamicResource BrushRowSelectedFg}"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.CellStyle>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Process" Binding="{Binding ProcessName}" Width="150" FontWeight="SemiBold"/>
                <DataGridTextColumn Header="PID" Binding="{Binding PID}" Width="70" ElementStyle="{StaticResource RightTabularText}"/>
                <DataGridTextColumn Header="Type" Binding="{Binding Type}" Width="85" FontWeight="SemiBold"/>
                <DataGridTextColumn Header="Handle" Binding="{Binding Handle}" Width="90" ElementStyle="{StaticResource RightTabularText}"/>
                <DataGridTextColumn Header="Object Name / Path" Binding="{Binding Name}" Width="*" ElementStyle="{StaticResource EllipsisCellText}"/>
            </DataGrid.Columns>
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <MenuItem x:Name="CtxCloseHandle" Header="Close Selected Handle..." InputGestureText="Del"/>
                    <MenuItem x:Name="CtxGoToProcess" Header="Go to Process in Tree" InputGestureText="Enter" FontWeight="Bold"/>
                    <Separator/>
                    <MenuItem x:Name="CtxCopyPath" Header="Copy Object Path" InputGestureText="Ctrl+C"/>
                </ContextMenu>
            </DataGrid.ContextMenu>
        </DataGrid>
 
        <!-- Bottom Action Strip -->
        <DockPanel Grid.Row="2" Margin="0,8,0,0">
            <Button x:Name="BtnCloseHandle" DockPanel.Dock="Left" Content="Close Selected Handle" Style="{StaticResource ActionButtonStyle}" ToolTip="Forcibly close the selected handle in the target process (Del)"/>
            <Button x:Name="BtnGoToProcess" DockPanel.Dock="Left" Content="Go to Process in Tree" Style="{StaticResource ActionButtonStyle}" ToolTip="Select this process in the main process tree (Enter)"/>
            <Button x:Name="BtnCopyPath" DockPanel.Dock="Left" Content="Copy Path" Style="{StaticResource ActionButtonStyle}"/>
            <Button x:Name="BtnCloseDlg" DockPanel.Dock="Right" Content="Close" Width="75" Style="{StaticResource ActionButtonStyle}"/>
        </DockPanel>
    </Grid>
</Window>