Desktop
Dialogs & Settings
C# / XAML
WPF Compile & XAML Checked
WPF Settings Dialog Shell
Two-pane desktop settings dialog with left category navigation, Save/Cancel actions, Escape cancellation, and JSON-friendly settings state.
Architecture & Runtime Preview
WPF (.NET 8/10)Native Windows WPF dialog — inspect XAML and C# source tabs for clean modal dialog composition.
- 1Left-docked TabControl (General / Storage)
- 2Bound Settings Controls (CheckBox + TextBox -> AppSettingsModel)
- 3Dialog Action Footer (IsDefault Save + IsCancel Cancel)
Example Project Integration: Drop into any <UseWPF>true</UseWPF> .NET Desktop project under Views/SettingsDialog/
Source Code (2 files)
<Window x:Class="OtterLibrary.Views.SettingsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Application Settings"
Width="680"
Height="440"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Background="#F4F7FB">
<DockPanel>
<Border DockPanel.Dock="Bottom" Background="#FFFFFF" BorderBrush="#E2E8F0" BorderThickness="0,1,0,0" Padding="16,12">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Cancel" Width="92" Height="32" Margin="0,0,8,0" IsCancel="True" />
<Button Content="Save Changes" Width="116" Height="32" IsDefault="True" Click="OnSaveClick" />
</StackPanel>
</Border>
<TabControl TabStripPlacement="Left" BorderThickness="0" Background="Transparent">
<TabItem Header="General" Padding="14,10">
<StackPanel Margin="20">
<TextBlock Text="General Preferences" FontSize="18" FontWeight="SemiBold" Foreground="#0B1D36" Margin="0,0,0,12" />
<CheckBox Content="Check for offline pack updates on startup" IsChecked="{Binding CheckUpdatesOnStart}" Margin="0,0,0,10" />
<CheckBox Content="Confirm before overwriting modified files" IsChecked="{Binding ConfirmOverwrites}" />
</StackPanel>
</TabItem>
<TabItem Header="Storage" Padding="14,10">
<StackPanel Margin="20">
<TextBlock Text="Local Library Cache" FontSize="18" FontWeight="SemiBold" Foreground="#0B1D36" Margin="0,0,0,12" />
<TextBlock Text="Default Library Folder" Foreground="#475569" Margin="0,0,0,8" />
<TextBox Height="32" VerticalContentAlignment="Center" Padding="8,0" Text="{Binding LibraryPath}" />
</StackPanel>
</TabItem>
</TabControl>
</DockPanel>
</Window>
using System.Windows;
namespace OtterLibrary.Views;
public sealed class AppSettingsModel
{
public bool CheckUpdatesOnStart { get; set; } = true;
public bool ConfirmOverwrites { get; set; } = true;
public string LibraryPath { get; set; } = "~/.otter/library";
}
public partial class SettingsDialog : Window
{
public AppSettingsModel Settings { get; }
public SettingsDialog(AppSettingsModel existing)
{
InitializeComponent();
Settings = new AppSettingsModel
{
CheckUpdatesOnStart = existing.CheckUpdatesOnStart,
ConfirmOverwrites = existing.ConfirmOverwrites,
LibraryPath = existing.LibraryPath
};
DataContext = Settings;
}
private void OnSaveClick(object sender, RoutedEventArgs e)
{
DialogResult = true;
Close();
}
}
Installation & Usage
Copy SettingsDialog.xaml and SettingsDialog.xaml.cs into your WPF project under Views/.
Open modally via var dlg = new SettingsDialog(currentSettings) { Owner = this }; if (dlg.ShowDialog() == true) Save(dlg.Settings);