US-1889327: Updated H2 headings. (#1323)

* Updated H2 headings for US-1889327.

* Review edits.

* Apply suggestions from code review

Co-authored-by: Andy (Steve) De George <[email protected]>
This commit is contained in:
Pooja Poojari
2022-03-04 18:48:05 +00:00
committed by GitHub
co-authored by Andy De George
parent d9125bf6ea
commit 6d665a13bd
20 changed files with 78 additions and 42 deletions
@@ -1,6 +1,8 @@
---
title: "How to: Use a Custom Context Menu with a TextBox"
description: Learn how to use a Custom Context Menu with a TextBox.
ms.date: "03/30/2017"
ms.custom: devdivchpfy22
dev_langs:
- "csharp"
- "vb"
@@ -14,14 +16,14 @@ ms.assetid: 842d3cd5-6fa0-4be4-8d90-6c7466213b1c
# How to: Use a Custom Context Menu with a TextBox
This example shows how to define and implement a simple custom context menu for a <xref:System.Windows.Controls.TextBox>.
## Example
## Define a Custom Context Menu
The following [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] example defines a <xref:System.Windows.Controls.TextBox> control that includes a custom context menu.
The context menu is defined using a <xref:System.Windows.Controls.ContextMenu> element. The context menu itself consists of a series of <xref:System.Windows.Controls.MenuItem> elements and <xref:System.Windows.Controls.Separator> elements. Each <xref:System.Windows.Controls.MenuItem> element defines a command in the context menu; the <xref:System.Windows.Controls.HeaderedItemsControl.Header%2A> attribute defines the display text for the menu command, and the <xref:System.Windows.Controls.MenuItem.Click> attribute specifies a handler method for each menu item. The <xref:System.Windows.Controls.Separator> element simply causes a separating line to be rendered between the previous and subsequent menu items.
[!code-xaml[TextBox_ContextMenu#_TextBox_ContextMenuXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBox_ContextMenu/CSharp/Window1.xaml#_textbox_contextmenuxaml)]
## Example
## Implement a Custom Context Menu
The following example shows the implementation code for the preceding context menu definition, as well as the code that enables and disables the context menu. The <xref:System.Windows.Controls.ContextMenu.Opened> event is used to dynamically enable or disable certain commands depending on the current state of the <xref:System.Windows.Controls.TextBox>.
To restore the default context menu, use the <xref:System.Windows.DependencyObject.ClearValue%2A> method to clear the value of the <xref:System.Windows.FrameworkElement.ContextMenu%2A> property. To disable the context menu altogether, set the <xref:System.Windows.FrameworkElement.ContextMenu%2A> property to a null reference (`Nothing` in Visual Basic).
@@ -1,6 +1,8 @@
---
title: "How to: Use Spell Checking with a Context Menu"
description: Learn how to use Spell Checking with a Context Menu.
ms.date: "03/30/2017"
ms.custom: devdivchpfy22
dev_langs:
- "csharp"
- "vb"
@@ -13,12 +15,12 @@ ms.assetid: 61f69a20-2ff3-4056-9060-e32f4483ec5e
# How to: Use Spell Checking with a Context Menu
By default, when you enable spell checking in an editing control like <xref:System.Windows.Controls.TextBox> or <xref:System.Windows.Controls.RichTextBox>, you get spell-checking choices in the context menu. For example, when users right-click a misspelled word, they get a set of spelling suggestions or the option to **Ignore All**. However, when you override the default context menu with your own custom context menu, this functionality is lost, and you need to write code to reenable the spell-checking feature in the context menu. The following example shows how to enable this on a <xref:System.Windows.Controls.TextBox>.
## Example
## Define a Context Menu
The following example shows the [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] that creates a <xref:System.Windows.Controls.TextBox> with some events that are used to implement the context menu.
[!code-xaml[TextBoxMiscSnippets_snip#SpellerCustomContextMenuExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBoxMiscSnippets_snip/csharp/speller_custom_context_menu.xaml#spellercustomcontextmenuexamplewholepage)]
## Example
## Implement a Context Menu
The following example shows the code that implements the context menu.
[!code-csharp[TextBoxMiscSnippets_snip#SpellerCustomContextMenuCodeExampleWholePage](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBoxMiscSnippets_snip/csharp/speller_custom_context_menu.xaml.cs#spellercustomcontextmenucodeexamplewholepage)]
@@ -1,6 +1,8 @@
---
title: "How to: Use the Image Element"
description: Learn how to use the Image Element.
ms.date: "03/30/2017"
ms.custom: devdivchpfy22
dev_langs:
- "csharp"
- "vb"
@@ -13,7 +15,7 @@ ms.assetid: 5b92e74b-1b56-4756-ac64-d5e9e08d9854
# How to: Use the Image Element
This example shows how to include images in an application by using the <xref:System.Windows.Controls.Image> element.
## Example
## Define an image
The following example shows how to render an image 200 pixels wide. In this [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] example, both attribute syntax and property tag syntax are used to define the image. For more information on attribute syntax and property syntax, see [Dependency Properties Overview](../advanced/dependency-properties-overview.md). A <xref:System.Windows.Media.Imaging.BitmapImage> is used to define the image's source data and is explicitly defined for the property tag syntax example. In addition, the <xref:System.Windows.Media.Imaging.BitmapImage.DecodePixelWidth%2A> of the <xref:System.Windows.Media.Imaging.BitmapImage> is set to the same width as the <xref:System.Windows.FrameworkElement.Width%2A> of the <xref:System.Windows.Controls.Image>. This is done to ensure that the minimum amount of memory is used rendering the image.
> [!NOTE]
@@ -26,7 +28,7 @@ This example shows how to include images in an application by using the <xref:Sy
[!code-xaml[ImageElementExample_snip#ImageSimpleExampleInlineMarkup](~/samples/snippets/csharp/VS_Snippets_Wpf/ImageElementExample_snip/CSharp/ImageSimpleExample.xaml#imagesimpleexampleinlinemarkup)]
## Example
## Render an image
The following example shows how to render an image 200 pixels wide using code.
> [!NOTE]
@@ -2,6 +2,7 @@
title: "How to: Position the Cursor at the Beginning or End of Text in a TextBox Control"
description: Learn how to position the cursor at the beginning or end of the text contents of a Windows Presentation Foundation TextBox control.
ms.date: "03/30/2017"
ms.custom: devdivchpfy22
dev_langs:
- "csharp"
- "vb"
@@ -14,18 +15,18 @@ ms.assetid: c771a0b8-c6b4-4240-aecd-a21d0ba51a2e
# How to: Position the Cursor at the Beginning or End of Text in a TextBox Control
This example shows how to position the cursor at the beginning or end of the text contents of a <xref:System.Windows.Controls.TextBox> control.
## Example
## Define a TextBox control
The following [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] code describes a <xref:System.Windows.Controls.TextBox> control and assigns it a Name.
[!code-xaml[TextBox_MiscCode#_MoveCursorXAML](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBox_MiscCode/CSharp/Window1.xaml#_movecursorxaml)]
## Example
## Position the cursor at the beginning
To position the cursor at the beginning of the contents of a <xref:System.Windows.Controls.TextBox> control, call the <xref:System.Windows.Controls.TextBox.Select%2A> method and specify the selection start position of 0, and a selection length of 0.
[!code-csharp[TextBox_MiscCode#_CursorToStart](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBox_MiscCode/CSharp/Window1.xaml.cs#_cursortostart)]
[!code-vb[TextBox_MiscCode#_CursorToStart](~/samples/snippets/visualbasic/VS_Snippets_Wpf/TextBox_MiscCode/VisualBasic/Window1.xaml.vb#_cursortostart)]
## Example
## Position the cursor at the end
To position the cursor at the end of the contents of a <xref:System.Windows.Controls.TextBox> control, call the <xref:System.Windows.Controls.TextBox.Select%2A> method and specify the selection start position equal to the length of the text content, and a selection length of 0.
[!code-csharp[TextBox_MiscCode#_CursorToEnd](~/samples/snippets/csharp/VS_Snippets_Wpf/TextBox_MiscCode/CSharp/Window1.xaml.cs#_cursortoend)]
@@ -1,6 +1,8 @@
---
title: "StatusBar Styles and Templates"
description: Learn about the StatusBar Styles and Templates.
ms.date: "03/30/2017"
ms.custom: devdivchpfy22
helpviewer_keywords:
- "ControlTemplate [WPF], StatusBar"
- "styles [WPF], StatusBar"
@@ -28,7 +30,7 @@ This topic describes the styles and templates for the <xref:System.Windows.Contr
## StatusBarItem Parts
The <xref:System.Windows.Controls.Primitives.StatusBarItem> control does not have any named parts.
## StatusBar States
## StatusBarItem States
The following table lists the visual states for the <xref:System.Windows.Controls.Primitives.StatusBarItem> control.
|VisualState Name|VisualStateGroup Name|Description|