### Install FlexiPane.WPF via Package Manager Console Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md This snippet shows how to install the FlexiPane.WPF library using the Package Manager Console in Visual Studio. ```powershell Install-Package FlexiPane.WPF ``` -------------------------------- ### Install FlexiPane.WPF via .NET CLI Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md This snippet demonstrates how to add the FlexiPane.WPF package to your project using the .NET Command Line Interface. ```bash dotnet add package FlexiPane.WPF ``` -------------------------------- ### Minimal Configuration Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Provides the simplest possible XAML setup for FlexiPane. It highlights that the panel works out-of-the-box, displaying instructions and handling basic split functionality automatically. ```xml ``` -------------------------------- ### Selection and Focus Management Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Details how to get the currently selected panel, set selection programmatically, and track selection changes within FlexiPane. Includes examples for accessing the selected item and handling the SelectionChanged event. ```csharp // Get the currently selected panel var selected = flexiPanel.SelectedItem; // Set selection programmatically somePane.IsSelected = true; // Track selection changes flexiPanel.SelectionChanged += (s, e) => { Console.WriteLine($"Selected: {e.NewSelection?.Title}"); }; ``` -------------------------------- ### Programmatic Panel Splitting Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Demonstrates how to split panels vertically and horizontally using the FlexiPane API. Includes examples for splitting at a specific ratio and with custom content. ```csharp // Split vertically at 50% flexiPanel.SplitSelectedVertically(0.5); // Split horizontally with custom content var customContent = new TextBlock { Text = "New Panel" }; flexiPanel.SplitSelectedHorizontally(0.3, customContent); ``` -------------------------------- ### Programmatic Splitting with FlexiPanel Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/architecture.md Illustrates how to programmatically initiate screen splits using the FlexiPanel control. It shows examples of splitting the selected pane vertically and horizontally with a specified ratio and optional custom content. ```csharp flexiPanel.SplitSelectedVertically(0.5, customContent); flexiPanel.SplitSelectedHorizontally(0.5, customContent); ``` -------------------------------- ### Hierarchical Split Information Example Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Provides an example of a hierarchical split structure within FlexiPane, illustrating how nested containers can have different split directions and ratios, affecting the layout of child elements. ```text FlexiPaneContainer(Root, Vertical, 0.6) ├── FirstChild: FlexiPaneItem(A) [60% width] └── SecondChild: FlexiPaneContainer(Nested, Horizontal, 0.4) ├── FirstChild: FlexiPaneItem(B) [40% height] └── SecondChild: FlexiPaneItem(C) [60% height] ``` -------------------------------- ### Basic FlexiPanel XAML Usage Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md This XAML code demonstrates the basic setup of a FlexiPanel within a WPF Grid, including namespace declaration and binding to a toggle button for split mode activation. ```xaml xmlns:flexiPane="clr-namespace:FlexiPane.Controls;assembly=FlexiPane" ``` -------------------------------- ### Automatic Content Wrapping Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Explains how FlexiPane automatically wraps different content types into FlexiPaneItem for splitting. The example shows handling the ContentRequested event to provide various UI elements. ```csharp private void OnContentRequested(object sender, ContentRequestedEventArgs e) { // Return any UIElement - FlexiPanel automatically wraps it for splitting e.RequestedContent = new UserControl(); // Gets wrapped in FlexiPaneItem e.RequestedContent = new TextBlock(); // Gets wrapped in FlexiPaneItem e.RequestedContent = new FlexiPaneItem(); // Used directly } ``` -------------------------------- ### Run FlexiPane.WPF Demo Application Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Instructions to clone the repository, navigate to the project directory, and run the default demo application using the .NET CLI. This demonstrates the library's functionality in a practical setting. ```Bash git clone https://github.com/iyulab/FlexiPane.WPF.git cd FlexiPane.WPF dotnet run --project src/FlexiPane.Samples.DefaultApp/ ``` -------------------------------- ### Add FlexiPane.WPF PackageReference Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md This snippet shows how to reference the FlexiPane.WPF NuGet package in your project file. ```xml ``` -------------------------------- ### FlexiPane Basic Split Scenario Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Illustrates the transformation from a single FlexiPaneItem to a FlexiPaneContainer with two FlexiPaneItems when a split occurs. This shows the initial state and the state after the split. ```text Initial State: FlexiPanel └── RootContent: FlexiPaneItem(A) └── Content: UserContentA After Split: FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A) │ └── Content: UserContentA (existing) └── SecondChild: FlexiPaneItem(B) └── Content: UserContentB (newly created) ``` -------------------------------- ### Handling Panel Lifecycle Events Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Shows how to customize FlexiPane behavior by subscribing to lifecycle events. Covers validating panel closing, handling the last panel closing scenario, and tracking split mode changes. ```csharp // Validate panel closing flexiPanel.PaneClosing += (s, e) => { if (HasUnsavedChanges(e.Pane)) { e.Cancel = MessageBox.Show("Discard changes?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.No; } }; // Handle last panel scenario flexiPanel.LastPaneClosing += (s, e) => { e.Cancel = MessageBox.Show("Close last panel?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.No; }; // Track split mode changes flexiPanel.SplitModeChanged += (s, e) => { statusLabel.Text = $"Split Mode: {(e.IsActive ? \"ON\" : \"OFF\")}"; }; ``` -------------------------------- ### Interactive Split Mode UI Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md Illustrates enabling and controlling the interactive split mode in FlexiPane. This includes both XAML binding and programmatic control, highlighting the visual overlays and mouse interactions. ```xml ``` ```csharp flexiPanel.IsSplitModeActive = true; // Interactive split overlays and close buttons are automatically shown ``` -------------------------------- ### Basic FlexiPanel Usage in XAML Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/architecture.md Demonstrates the minimal XAML configuration required to place a FlexiPanel control within a WPF application. This serves as the entry point for using the library's screen splitting capabilities. ```xml ``` -------------------------------- ### Event-Driven Content Handling in FlexiPane Source: https://github.com/iyulab/flexipane.wpf/blob/main/README.md This C# code handles the `ContentRequested` event for a FlexiPanel, providing content for both initial pane loading and split pane operations. It demonstrates how to set the `RequestedContent` and `Handled` properties based on the `RequestType`. ```csharp // Handle all content requests - both initial and split operations private void OnContentRequested(object sender, ContentRequestedEventArgs e) { // Handle initial panel content if (e.RequestType == ContentRequestType.InitialPane) { e.RequestedContent = new Border { Background = Brushes.LightBlue, Child = new TextBlock { Text = $"Initial Panel {DateTime.Now:HH:mm:ss}", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center } }; e.Handled = true; } // Handle split panel content else if (e.RequestType == ContentRequestType.SplitPane) { e.RequestedContent = new Border { Background = Brushes.LightGreen, Child = new TextBlock { Text = $"Split Panel {DateTime.Now:HH:mm:ss}\nDirection: {(e.IsVerticalSplit == true ? "Vertical" : "Horizontal")}", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center } }; e.Handled = true; } } ``` -------------------------------- ### FlexiPane Final Simplification Scenario Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Shows the final simplification step where removing the last child of the root container results in a single UI area. The root container itself is removed, and the remaining item is directly promoted. ```text Before Removal (2 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A) │ └── Content: UserContentA └── SecondChild: FlexiPaneItem(B) ← To be removed └── Content: UserContentB After Removing Panel B (1 area): FlexiPanel └── RootContent: FlexiPaneItem(A) ← Root container removed, A directly promoted └── Content: UserContentA ``` -------------------------------- ### FlexiPane Area Removal Algorithm Step 1 Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Details the first step of the area removal algorithm: identifying the target FlexiPaneItem to be removed and its direct parent FlexiPaneContainer. ```text Find FlexiPaneItem to remove → Find direct parent FlexiPaneContainer ``` -------------------------------- ### RootContent Handling for FlexiPaneContainer Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Explains the special handling for FlexiPanel.RootContent when it is a FlexiPaneContainer. This includes logic for single child scenarios, FlexiPaneItem, and nested FlexiPaneContainers. ```text When FlexiPanel.RootContent is FlexiPaneContainer: - If only one child remains, set that child directly as RootContent - If FlexiPaneItem, restore to single panel state - If FlexiPaneContainer, maintain hierarchical structure ``` -------------------------------- ### FlexiPane Complex Nesting Scenario Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Illustrates a more complex nesting scenario where splitting one area results in four UI areas. This shows the structure after splitting an existing area, leading to a deeper hierarchy. ```text After Splitting Area A (4 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneContainer(NestedLeft) │ ├── FirstChild: FlexiPaneItem(A1) │ │ └── Content: UserContentA1 (split from A) │ └── SecondChild: FlexiPaneItem(A2) │ └── Content: UserContentA2 (newly created) └── SecondChild: FlexiPaneContainer(NestedRight) ├── FirstChild: FlexiPaneItem(B) │ └── Content: UserContentB └── SecondChild: FlexiPaneItem(C) └── Content: UserContentC ``` -------------------------------- ### Empty Container Cleanup Logic Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Describes the process for cleaning up empty FlexiPaneContainers, including removing them from their parent and simplifying the structure of containers with only a single child. ```text - Remove empty FlexiPaneContainer - Clean up unnecessary intermediate layers - Simplify structure of containers with single child ``` -------------------------------- ### FlexiPane Intermediate Container Cleanup Scenario Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Illustrates the cleanup of an intermediate FlexiPaneContainer when one of its children is removed, reducing the UI areas from four to three. This shows the promotion of the remaining child to the parent. ```text Before Removal (4 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneContainer(NestedLeft) │ ├── FirstChild: FlexiPaneItem(A1) │ └── SecondChild: FlexiPaneItem(A2) ← To be removed └── SecondChild: FlexiPaneContainer(NestedRight) ├── FirstChild: FlexiPaneItem(B) └── SecondChild: FlexiPaneItem(C) After Removing Panel A2 (3 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A1) ← NestedLeft removed, A1 promoted │ └── Content: UserContentA1 └── SecondChild: FlexiPaneContainer(NestedRight) ├── FirstChild: FlexiPaneItem(B) │ └── Content: UserContentB └── SecondChild: FlexiPaneItem(C) └── Content: UserContentC ``` -------------------------------- ### Execute Structure Change Steps Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Outlines the sequence of operations for executing structural changes within FlexiPane, including detaching the sibling, replacing the parent with the sibling in the grandparent, and cleaning up the parent container. ```text 1. Detach sibling element from parent container 2. Replace parent container with sibling element in GrandParent 3. Clean up parent container and removal target ``` -------------------------------- ### FlexiPane Nested Split Scenario Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Demonstrates how a nested split operation increases the number of UI areas from two to three. It shows the state before splitting an existing area and the resulting structure after the split. ```text Before Split (2 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A) │ └── Content: UserContentA └── SecondChild: FlexiPaneItem(B) └── Content: UserContentB After Splitting Area B (3 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A) │ └── Content: UserContentA └── SecondChild: FlexiPaneContainer(Nested) ├── FirstChild: FlexiPaneItem(B) │ └── Content: UserContentB (existing) └── SecondChild: FlexiPaneItem(C) └── Content: UserContentC (newly created) ``` -------------------------------- ### Empty Container Identification and Handling Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Defines the condition for an empty FlexiPaneContainer (both children are null) and outlines the handling process, which involves removing it from its parent and cleaning up associated resources. ```text FlexiPaneContainer is empty when: - FirstChild == null && SecondChild == null Handling: - Remove from parent - Clean up resources ``` -------------------------------- ### FlexiPane Resource Management Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Covers essential resource management practices for FlexiPane, including disconnecting event handlers for removed items, memory cleanup for empty containers, and ensuring synchronization between the Visual Tree and Logical Tree. ```text - Disconnect event handlers of removed FlexiPaneItem - Memory cleanup of empty FlexiPaneContainer - Visual Tree and Logical Tree synchronization ``` -------------------------------- ### FlexiPane Control Hierarchy Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Defines the basic tree structure for FlexiPane's screen splitting. It shows the top-level FlexiPanel, the root content, and how FlexiPaneItems and FlexiPaneContainers form a hierarchy for managing UI areas. ```text FlexiPanel (Top-level container) └── RootContent: UIElement ├── FlexiPaneItem (Single panel) └── FlexiPaneContainer (Split container) ├── FirstChild: UIElement └── SecondChild: UIElement ``` -------------------------------- ### Single Child Container Promotion Logic Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Details the logic for promoting a container's single child to the parent level when the container itself has only one child, effectively removing the intermediate container. ```text When FlexiPaneContainer has only one child: - (FirstChild != null && SecondChild == null) or - (FirstChild == null && SecondChild != null) Handling: - Promote the only child to parent level - Remove current container ``` -------------------------------- ### FlexiPane Leaf Panel Removal Scenario Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Demonstrates the process of removing a leaf FlexiPaneItem, reducing the UI areas from three to two. It highlights the core rule: promoting the sibling to the parent container when a container is left with only one child. ```text Before Removal (3 areas): FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A) │ └── Content: UserContentA └── SecondChild: FlexiPaneContainer(Nested) ├── FirstChild: FlexiPaneItem(B) │ └── Content: UserContentB └── SecondChild: FlexiPaneItem(C) ← To be removed └── Content: UserContentC After Removing Panel C (2 areas) - Correct Behavior: FlexiPanel └── RootContent: FlexiPaneContainer(Root) ├── FirstChild: FlexiPaneItem(A) │ └── Content: UserContentA └── SecondChild: FlexiPaneItem(B) ← Nested container removed, B promoted └── Content: UserContentB ``` -------------------------------- ### FlexiPane Validation Logic Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Outlines the validation rules implemented in FlexiPane to maintain structural integrity, such as ensuring at least one panel remains, validating parent-child relationships, and preventing circular references. ```text - Maintain minimum 1 panel (prevent last panel removal) - Parent-child relationship integrity validation - Circular reference prevention ``` -------------------------------- ### FlexiPane Event Propagation Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Details how events propagate within the FlexiPane structure, specifically mentioning routed event bubbling from FlexiPaneItem to FlexiPanel and state inheritance through Attached Properties. ```text - FlexiPaneItem → FlexiPanel Routed Event bubbling - State inheritance through Attached Properties ``` -------------------------------- ### FlexiPane Split Ratio Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Describes the `SplitRatio` property, which defines the size proportion of the first child within a FlexiPane, with values ranging from 0.1 to 0.9. ```text - SplitRatio: First child size ratio in range 0.1 ~ 0.9 ``` -------------------------------- ### Determine Sibling Element in FlexiPane Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Illustrates how to identify the sibling element within a FlexiPaneContainer, crucial for structural changes. This logic is fundamental for operations like reordering or replacing elements. ```text FlexiPaneContainer ├── FirstChild: FlexiPaneItem(target) → sibling is SecondChild └── SecondChild: FlexiPaneItem(sibling) or FlexiPaneContainer ├── FirstChild: FlexiPaneItem(sibling) └── SecondChild: FlexiPaneItem(target) → sibling is FirstChild ``` -------------------------------- ### Check Grandparent for Structure Change Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Details the process of checking the grandparent element (FlexiPaneContainer or FlexiPanel) to facilitate structural changes. This involves identifying the parent and target sibling to promote the sibling to the grandparent level. ```text GrandParent (FlexiPaneContainer or FlexiPanel) └── Child: FlexiPaneContainer(parent) ├── FirstChild: FlexiPaneItem(target) └── SecondChild: FlexiPaneItem(sibling) → Promote this sibling to GrandParent ``` -------------------------------- ### FlexiPane Split Direction Source: https://github.com/iyulab/flexipane.wpf/blob/main/docs/splitting-mechanism.md Explains how the `IsVerticalSplit` property determines the orientation of the split within a FlexiPane, differentiating between vertical (left-right) and horizontal (top-bottom) splits. ```text - IsVerticalSplit = true: Vertical split (left-right) - IsVerticalSplit = false: Horizontal split (top-bottom) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.