### Cursor and Selection Operations Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Methods for getting and setting cursor position, and calculating selection positions. ```APIDOC ## GetCursorPosition() ### Description Returns the current screen position of the cursor. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response - **Position** (object) - The screen coordinates of the cursor. ``` ```APIDOC ## SetCursorPosition(int lineNumber, int characterPos, bool scrollIntoView = true, bool autoClamp = true) ### Description Sets the cursor to a specific line and character position within the text. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **lineNumber** (int) - Required - The line number to move the cursor to. - **characterPos** (int) - Required - The character position on the specified line. - **scrollIntoView** (bool) - Optional - Whether to scroll the view to make the cursor visible. Defaults to true. - **autoClamp** (bool) - Optional - Whether to automatically clamp the position if it's out of bounds. Defaults to true. ### Response None ``` ```APIDOC ## CalculateSelectionPosition() ### Description Calculates and retrieves position information related to the current text selection. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response - **SelectionPositionInfo** (object) - Information about the selection's position. ``` -------------------------------- ### Text Manipulation Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Provides methods for loading, setting, getting, and manipulating the text content within the TextControlBox. ```APIDOC ## Text Manipulation - `LoadText(string text)`: Loads text into the control. - `SetText(string text)`: Sets the text content. - `GetText()`: Returns the current content. - `LoadLines(IEnumerable lines, LineEnding lineEnding = LineEnding.CRLF)`: Loads multiple lines. - `GetLineText(int line)`: Returns the text of a line. - `GetLinesText(int startLine, int length)`: Returns a range of lines. - `SetLineText(int line, string text)`: Replaces the text of a line. - `DeleteLine(int line)`: Deletes a specific line. - `AddLine(int line, string text)`: Adds a new line at a position. - `AddLines(int start, string[] lines)`: Adds the array of lines at the given position. - `DuplicateLine(int line)`: Duplicates the specified line. ``` -------------------------------- ### Basic Usage Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Demonstrates the fundamental steps to initialize and use the TextControlBox, including loading text and enabling core features. ```APIDOC ## Basic Usage ```csharp TextControlBox textBox = new TextControlBox(); textBox.LoadText("Hello, world!"); extBox.ShowLineNumbers = true; extBox.EnableSyntaxHighlighting = true; ``` ``` -------------------------------- ### Initialize and Load Text in TextControlBox Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Demonstrates basic initialization of the TextControlBox, loading initial text, and enabling line numbers and syntax highlighting. ```csharp TextControlBox textBox = new TextControlBox(); textBox.LoadText("Hello, world!"); textBox.ShowLineNumbers = true; textBox.EnableSyntaxHighlighting = true; ``` -------------------------------- ### Syntax Highlighting Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Methods for setting and retrieving syntax highlighting configurations. ```APIDOC ## SelectSyntaxHighlightingById(SyntaxHighlightID languageId) ### Description Sets the syntax highlighting for the text control using a predefined language ID. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **languageId** (SyntaxHighlightID) - Required - The ID of the syntax highlighting language to apply. ### Response None ``` ```APIDOC ## GetSyntaxHighlightingFromID(SyntaxHighlightID languageId) ### Description Retrieves the syntax highlighting configuration associated with a given language ID. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **languageId** (SyntaxHighlightID) - Required - The ID of the syntax highlighting language. ### Response - **SyntaxHighlighting** (object) - The syntax highlighting configuration. ``` ```APIDOC ## GetSyntaxHighlightingFromJson(string json) ### Description Loads and applies syntax highlighting configuration from a JSON string. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **json** (string) - Required - A JSON string representing the syntax highlighting configuration. ### Response - **SyntaxHighlighting** (object) - The loaded syntax highlighting configuration. ``` -------------------------------- ### Static Properties Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Static properties providing access to syntax highlighting definitions. ```APIDOC ## SyntaxHighlightings ### Description Static dictionary containing predefined syntax highlighting languages. ### Method Property Access ### Endpoint N/A (Property Access) ### Parameters None ### Response - **Dictionary** (object) - A dictionary mapping language IDs to syntax highlighting configurations. ``` -------------------------------- ### Formatting and Styling Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Covers properties for customizing the appearance of the text, including font, size, colors, and syntax highlighting. ```APIDOC ## Formatting and Styling - `FontFamily`: Gets or sets the font family. - `FontSize`: Gets or sets the base font size. - `RenderedFontSize`: Gets the final rendered font size. - `CornerRadius`: Gets or sets the control's corner radius. - `RequestedTheme`: Gets or sets the UI theme. - `Design`: Gets or sets visual settings like line numbers and highlighting. - `ShowLineNumbers`: Toggles line number visibility. - `ShowLineHighlighter`: Toggles current line highlighting. - `EnableSyntaxHighlighting`: Enables or disables syntax highlighting. - `SyntaxHighlighting`: Gets or sets the current syntax highlighting language. - `LineEnding`: Gets or sets the line ending mode. - `SpaceBetweenLineNumberAndText`: Spacing between line numbers and text. - `ZoomFactor`: Gets or sets the zoom factor. - `UseSpacesInsteadTabs`: Enables space-based tabulation. - `NumberOfSpacesForTab`: Sets number of spaces per tab. - `ShowWhitespaceCharacters`: Gets or sets whether spaces and tabs are visually shown. - `ActualLineHeight`: Returns the rendered height of a single line in pixel. - `HighlightLineWhenNotFocused`: Controls whether the line is still highlighted when control is not focused. - `HighlightLinks`: Gets or sets whether links inside the text are highlighted and clickable. ``` -------------------------------- ### Selection and Cursor Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Details properties and methods related to text selection and cursor positioning within the editor. ```APIDOC ## Selection and Cursor - `SelectedText`: Gets the currently selected text. - `CurrentSelection`, `CurrentSelectionOrdered`: Provides selection metadata. - `HasSelection`: Indicates if any text is currently selected. - `CursorPosition`: Gets the current cursor position. - `CurrentLineIndex`: Index of the line containing the cursor. - `SetSelection(int start, int length)`: Selects a specific text range. - `SelectAll()`: Selects all text. - `ClearSelection()`: Clears any text selection. - `SelectLine(int line)`: Selects a specific line. - `SelectLines(int start, int count)`: Selects a range of lines. - `GoToLine(int line)`: Moves the cursor to a specific line. ``` -------------------------------- ### Enable Syntax Highlighting in TextControlBox Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Use this method to enable syntax highlighting for a specific programming language. Ensure you use the correct SyntaxHighlightID corresponding to the language you want to highlight. ```csharp textBox.SelectSyntaxHighlightingById(SyntaxHighlightID.CSharp); ``` -------------------------------- ### Scrolling and Navigation Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Methods and properties for controlling the scroll position and navigating through the document. ```APIDOC ## Scrolling and Navigation - `VerticalScroll`, `HorizontalScroll`: Gets or sets scroll offsets. - `VerticalScrollSensitivity`, `HorizontalScrollSensitivity`: Adjust scroll speed. - `ScrollLineToCenter(int line)`: Scrolls a line to center. - `ScrollOneLineUp()`: Scrolls one line vertically up. - `ScrollOneLineDown()`: Scrolls one line vertically down. - `ScrollLineIntoView(int line)`: Brings a line into view. - `ScrollTopIntoView()`: Scrolls to the top of the document. - `ScrollBottomIntoView()`: Scrolls to the bottom of the document. - `ScrollPageUp()`: Scrolls a full page up. - `ScrollPageDown()`: Scrolls a full page down. - `ScrollIntoViewHorizontally()`: Scrolls horizontally into view. ``` -------------------------------- ### Include TextControlBox Namespace Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Add this using statement to your C# file to access the TextControlBox functionality. ```csharp using TextControlBoxNS; ``` -------------------------------- ### UI and Interaction Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Properties and methods related to the user interface and interaction aspects of the TextControlBox. ```APIDOC ## UI and Interaction - `SearchIsOpen`: Indicates whether the search panel is open. - `ContextFlyout`: Gets or sets the context menu flyout. - `ContextFlyoutDisabled`: Disables the context menu. - `IsReadonly`: Determines if the control is read-only. - `CursorSize`: Gets or sets the cursor size. - `SelectionScrollStartBorderDistance`: Gets or sets the mouse distance from the text box edge that triggers auto-scroll during selection. - `Focus(FocusState state)`: Sets focus to the control. ``` -------------------------------- ### Text Statistics and Formatting Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Methods for counting characters and words, and reformatting tabs and spaces. ```APIDOC ## CharacterCount() ### Description Returns the total number of characters in the text control. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response - **Count** (int) - The total character count. ``` ```APIDOC ## WordCount() ### Description Returns the total number of words in the text control. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response - **Count** (int) - The total word count. ``` ```APIDOC ## RewriteTabsSpaces(int spaces, bool useSpacesInsteadTabs) ### Description Reformats the indentation of the text, converting tabs to spaces or vice versa, to a specified number of spaces. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **spaces** (int) - Required - The number of spaces to use for indentation. - **useSpacesInsteadTabs** (bool) - Required - True to use spaces instead of tabs, false to use tabs. ### Response None ``` ```APIDOC ## DetectTabsSpaces() ### Description Detects the current indentation settings (tabs or spaces and their count) used in the text. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response - **IndentationInfo** (tuple) - A tuple containing information about the detected indentation. ``` -------------------------------- ### Control Management and History Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Methods for unloading the control, clearing history, and managing text changes. ```APIDOC ## Unload() ### Description Unloads the text control. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response None ``` ```APIDOC ## ClearUndoRedoHistory() ### Description Clears the undo and redo history of the text control. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response None ``` -------------------------------- ### Editing and Actions Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Functionality for editing text, including clipboard operations, undo/redo, and text pairing. ```APIDOC ## Editing and Actions - `DoAutoPairing`: Enables auto-pairing of brackets/quotes. - `ControlW_SelectWord`: Enables Ctrl+W to select the current word. - `CanDragDropText`: Enables drag-and-drop support. - `Paste()`: Pastes clipboard content. - `Copy()`: Copies the selection to clipboard. - `Cut()`: Cuts the selected text. - `UndoRedoEnabled`: Enables/disables undo/redo functionality. - `IsGroupingActions`: Gets whether grouping of undo redo is enabled or disabled. - `BeginActionGroup`: Starts the grouping of undo redo items. - `EndActionGroup`: Ends the grouping of undo redo items. - `CanUndo`: Gets whether undo could be executed. - `CanRedo`: Gets whether redo could be executed. - `Undo()`: Undoes the last action. - `Redo()`: Redoes the last undone action. - `SurroundSelectionWith(string text)`: Surrounds selection with a string. - `SurroundSelectionWith(string text1, string text2)`: Surrounds selection with a prefix and suffix. ``` -------------------------------- ### Text Manipulation Methods Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Methods for duplicating lines, replacing text, and managing search functionality. ```APIDOC ## DuplicateCurrentLine() ### Description Duplicates the current line of text. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response None ``` ```APIDOC ## ReplaceAll(string word, string replaceWord, bool matchCase, bool wholeWord) ### Description Replaces all occurrences of a specified word with another word, with options for case sensitivity and whole word matching. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **word** (string) - Required - The word to search for. - **replaceWord** (string) - Required - The word to replace with. - **matchCase** (bool) - Required - True to perform case-sensitive matching, false otherwise. - **wholeWord** (bool) - Required - True to match whole words only, false otherwise. ### Response None ``` ```APIDOC ## ReplaceNext(string replaceWord) ### Description Replaces the next occurrence of the searched word with the specified replacement word. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **replaceWord** (string) - Required - The word to replace with. ### Response None ``` ```APIDOC ## FindNext() ### Description Navigates to the next search result. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response None ``` ```APIDOC ## FindPrevious() ### Description Navigates to the previous search result. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response None ``` ```APIDOC ## BeginSearch(string word, bool wholeWord, bool matchCase) ### Description Starts a search for a specified word with options for whole word matching and case sensitivity. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters - **word** (string) - Required - The word to search for. - **wholeWord** (bool) - Required - True to match whole words only, false otherwise. - **matchCase** (bool) - Required - True to perform case-sensitive matching, false otherwise. ### Response None ``` ```APIDOC ## EndSearch() ### Description Ends the current search operation. ### Method Method Call ### Endpoint N/A (Method Call) ### Parameters None ### Response None ``` -------------------------------- ### Events Source: https://github.com/frozenassassine/textcontrolbox-winui/blob/master/README.md Events that are triggered by changes in the text control's state. ```APIDOC ## TextChanged ### Description Event triggered whenever the text content of the control is modified. ### Method Event ### Endpoint N/A (Event) ### Parameters None ### Response None ``` ```APIDOC ## SelectionChanged ### Description Event triggered when the user changes the text selection within the control. ### Method Event ### Endpoint N/A (Event) ### Parameters None ### Response None ``` ```APIDOC ## ZoomChanged ### Description Event triggered when the zoom level of the text control is changed. ### Method Event ### Endpoint N/A (Event) ### Parameters None ### Response None ``` ```APIDOC ## GotFocus ### Description Event triggered when the text control receives input focus. ### Method Event ### Endpoint N/A (Event) ### Parameters None ### Response None ``` ```APIDOC ## LostFocus ### Description Event triggered when the text control loses input focus. ### Method Event ### Endpoint N/A (Event) ### Parameters None ### Response None ``` ```APIDOC ## Loaded ### Description Event triggered when the text control has been loaded into the UI. ### Method Event ### Endpoint N/A (Event) ### Parameters None ### Response None ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.