mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-06 07:56:06 +02:00
Links: .NET Desktop - framework\wpf (#109)
* Links: .NET Desktop - framework\wpf * Apply suggestions from code review Co-authored-by: Andy De George <[email protected]>
This commit is contained in:
co-authored by
Andy De George
parent
c1d6e1d23e
commit
674b773578
+3
-1
@@ -11,9 +11,11 @@ helpviewer_keywords:
|
||||
ms.assetid: 205099d9-2551-4302-a25e-a15af9f67e04
|
||||
---
|
||||
# How to: Create a Control That Has an Access Key and Text Wrapping
|
||||
|
||||
This example shows how to create a control that has an access key and supports text wrapping. The example uses a <xref:System.Windows.Controls.Label> control to illustrate these concepts.
|
||||
|
||||
## Example
|
||||
|
||||
**Add Text Wrapping to Your Label**
|
||||
|
||||
The <xref:System.Windows.Controls.Label> control does not support text wrapping. If you need a label that wraps across multiple lines, you can nest another element that does support text wrapping and put the element inside the label. The following example shows how to use a <xref:System.Windows.Controls.TextBlock> to make a label that wraps several lines of text.
|
||||
@@ -32,4 +34,4 @@ This example shows how to create a control that has an access key and supports t
|
||||
|
||||
## See also
|
||||
|
||||
- [How to: Set the Target Property of a Label](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms752101(v=vs.90))
|
||||
- [How to: Set the Target Property of a Label](/previous-versions/dotnet/netframework-3.5/ms752101(v=vs.90))
|
||||
|
||||
@@ -10,11 +10,13 @@ helpviewer_keywords:
|
||||
ms.assetid: c6bba109-c6e7-4cf8-bfe6-9cf8d01bb4fc
|
||||
---
|
||||
# How to: Crop an Image
|
||||
|
||||
This example shows how to crop an image using <xref:System.Windows.Media.Imaging.CroppedBitmap>.
|
||||
|
||||
<xref:System.Windows.Media.Imaging.CroppedBitmap> is primarily used when encoding a cropped version of an image to save out to a file. To crop an image for display purposes see the [How to: Create a Clip Region](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms746710(v=vs.90)) topic.
|
||||
<xref:System.Windows.Media.Imaging.CroppedBitmap> is primarily used when encoding a cropped version of an image to save out to a file. To crop an image for display purposes see the [How to: Create a Clip Region](/previous-versions/dotnet/netframework-3.5/ms746710(v=vs.90)) topic.
|
||||
|
||||
## Example
|
||||
|
||||
The following [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] defines resources used within the samples below.
|
||||
|
||||
[!code-xaml[imageelementexample#CroppedXAML1](~/samples/snippets/csharp/VS_Snippets_Wpf/ImageElementExample/CSharp/CroppedImageExample.xaml#croppedxaml1)]
|
||||
@@ -35,4 +37,4 @@ This example shows how to crop an image using <xref:System.Windows.Media.Imaging
|
||||
|
||||
## See also
|
||||
|
||||
- [How to: Create a Clip Region](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms746710(v=vs.90))
|
||||
- [How to: Create a Clip Region](/previous-versions/dotnet/netframework-3.5/ms746710(v=vs.90))
|
||||
|
||||
+3
-1
@@ -7,9 +7,11 @@ helpviewer_keywords:
|
||||
ms.assetid: 4fa694f2-a620-4b15-be78-5f4286f89361
|
||||
---
|
||||
# How to: Customize the Ticks on a Slider
|
||||
|
||||
This example shows how to create a <xref:System.Windows.Controls.Slider> control that has tick marks.
|
||||
|
||||
## Example
|
||||
|
||||
The <xref:System.Windows.Controls.Primitives.TickBar> displays when you set the <xref:System.Windows.Controls.Slider.TickPlacement%2A> property to a value other than <xref:System.Windows.Controls.Primitives.TickPlacement.None>, which is the default value.
|
||||
|
||||
The following example shows how to create a <xref:System.Windows.Controls.Slider> with a <xref:System.Windows.Controls.Primitives.TickBar> that displays tick marks. The <xref:System.Windows.Controls.Slider.TickPlacement%2A> and <xref:System.Windows.Controls.Slider.TickFrequency%2A> properties define the location of the tick marks and the interval between them. When you move the <xref:System.Windows.Controls.Primitives.Thumb>, tooltips display the value of the <xref:System.Windows.Controls.Slider>. The <xref:System.Windows.Controls.Slider.AutoToolTipPlacement%2A> property defines where the tooltips occur. The <xref:System.Windows.Controls.Primitives.Thumb> movements correspond to the location of the tick marks because <xref:System.Windows.Controls.Slider.IsSnapToTickEnabled%2A> is set to `true`.
|
||||
@@ -23,4 +25,4 @@ This example shows how to create a <xref:System.Windows.Controls.Slider> control
|
||||
- <xref:System.Windows.Controls.Slider>
|
||||
- <xref:System.Windows.Controls.Primitives.TickBar>
|
||||
- <xref:System.Windows.Controls.Slider.TickPlacement%2A>
|
||||
- [How to: Bind a Slider to a Property Value](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms788716(v=vs.90))
|
||||
- [How to: Bind a Slider to a Property Value](/previous-versions/dotnet/netframework-3.5/ms788716(v=vs.90))
|
||||
|
||||
@@ -7,9 +7,11 @@ helpviewer_keywords:
|
||||
ms.assetid: 85a4d1a7-4753-4f4a-b26d-14fa10c1ddb5
|
||||
---
|
||||
# How to: Define a GroupBox Template
|
||||
|
||||
This example shows how to create a template for a <xref:System.Windows.Controls.GroupBox> control.
|
||||
|
||||
## Example
|
||||
|
||||
The following example defines a <xref:System.Windows.Controls.GroupBox> control template by using a <xref:System.Windows.Controls.Grid> control for layout. The template uses a <xref:System.Windows.Controls.BorderGapMaskConverter> to define the border of the <xref:System.Windows.Controls.GroupBox> so that the border does not obscure the <xref:System.Windows.Controls.HeaderedContentControl.Header%2A> content.
|
||||
|
||||
[!code-xaml[GroupBoxSnippet#GroupBoxTemplate](~/samples/snippets/csharp/VS_Snippets_Wpf/GroupBoxSnippet/CS/Window1.xaml#groupboxtemplate)]
|
||||
@@ -17,4 +19,4 @@ This example shows how to create a template for a <xref:System.Windows.Controls.
|
||||
## See also
|
||||
|
||||
- <xref:System.Windows.Controls.GroupBox>
|
||||
- [How to: Create a GroupBox](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms748321(v=vs.90))
|
||||
- [How to: Create a GroupBox](/previous-versions/dotnet/netframework-3.5/ms748321(v=vs.90))
|
||||
|
||||
@@ -9,16 +9,19 @@ helpviewer_keywords:
|
||||
ms.assetid: 241c1ce2-60f8-4613-a0ec-9b9bb25fb6af
|
||||
---
|
||||
# Label
|
||||
|
||||
<xref:System.Windows.Controls.Label> controls usually provide information in the [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)]. Historically, a <xref:System.Windows.Controls.Label> has contained only text, but because the <xref:System.Windows.Controls.Label> that ships with [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] is a <xref:System.Windows.Controls.ContentControl>, it can contain either text or a <xref:System.Windows.UIElement>.
|
||||
|
||||
A <xref:System.Windows.Controls.Label> provides both functional and visual support for access keys. It is frequently used to enable quick keyboard access to controls such as a <xref:System.Windows.Controls.TextBox>. To assign a <xref:System.Windows.Controls.Label> to a <xref:System.Windows.Controls.Control>, set the <xref:System.Windows.Controls.Label.Target%2A?displayProperty=nameWithType> property to the control that should get focus when the user presses the access key.
|
||||
|
||||
The following image shows a <xref:System.Windows.Controls.Label> "Themes" that targets a <xref:System.Windows.Controls.ComboBox>. When the user presses , the <xref:System.Windows.Controls.ComboBox> receives focus. For more information, see [How to: Set the Target Property of a Label](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms752101(v=vs.90)).
|
||||
The following image shows a <xref:System.Windows.Controls.Label> "Themes" that targets a <xref:System.Windows.Controls.ComboBox>. When the user presses , the <xref:System.Windows.Controls.ComboBox> receives focus. For more information, see [How to: Set the Target Property of a Label](/previous-versions/dotnet/netframework-3.5/ms752101(v=vs.90)).
|
||||
|
||||

|
||||
|
||||
## In This Section
|
||||
|
||||
[How to: Create a Control That Has an Access Key and Text Wrapping](how-to-create-a-control-that-has-an-access-key-and-text-wrapping.md)
|
||||
|
||||
## Reference
|
||||
|
||||
<xref:System.Windows.Controls.Label>
|
||||
|
||||
@@ -9,15 +9,18 @@ helpviewer_keywords:
|
||||
ms.assetid: 15d58f1d-3db6-4cb5-88c7-8c45f19301e2
|
||||
---
|
||||
# ListBox How-to Topics
|
||||
|
||||
The topics in this section describe how to use the <xref:System.Windows.Controls.ListBox> control to display selectable lists of items.
|
||||
|
||||
## In This Section
|
||||
|
||||
[Bind a ListBox to Data](how-to-bind-a-listbox-to-data.md)
|
||||
[Get a ListBoxItem](how-to-get-a-listboxitem.md)
|
||||
[How to: Add Data to an ItemsControl](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms743602(v=vs.90))
|
||||
[How to: Add Data to an ItemsControl](/previous-versions/dotnet/netframework-3.5/ms743602(v=vs.90))
|
||||
[Improve the Scrolling Performance of a ListBox](how-to-improve-the-scrolling-performance-of-a-listbox.md)
|
||||
|
||||
## Reference
|
||||
|
||||
<xref:System.Windows.Controls.ListBox>
|
||||
|
||||
<xref:System.Windows.Controls.ListBoxItem>
|
||||
|
||||
@@ -12,6 +12,7 @@ helpviewer_keywords:
|
||||
ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
---
|
||||
# Panels Overview
|
||||
|
||||
<xref:System.Windows.Controls.Panel> elements are components that control the rendering of elements—their size and dimensions, their position, and the arrangement of their child content. The [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] provides a number of predefined <xref:System.Windows.Controls.Panel> elements as well as the ability to construct custom <xref:System.Windows.Controls.Panel> elements.
|
||||
|
||||
This topic contains the following sections.
|
||||
@@ -31,13 +32,17 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
- [Localization/Globalization Support](#Panels_global_localization)
|
||||
|
||||
<a name="Panels_view_from_10000_feet"></a>
|
||||
|
||||
## The Panel Class
|
||||
|
||||
<xref:System.Windows.Controls.Panel> is the base class for all elements that provide layout support in [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)]. Derived <xref:System.Windows.Controls.Panel> elements are used to position and arrange elements in [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] and code.
|
||||
|
||||
The [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] includes a comprehensive suite of derived panel implementations that enable many complex layouts. These derived classes expose properties and methods that enable most standard [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)] scenarios. Developers who are unable to find a child arrangement behavior that meets their needs can create new layouts by overriding the <xref:System.Windows.FrameworkElement.ArrangeOverride%2A> and <xref:System.Windows.FrameworkElement.MeasureOverride%2A> methods. For more information on custom layout behaviors, see [Custom Panel Elements](#Panels_custom_panel_elements).
|
||||
|
||||
<a name="Panels_declared_members"></a>
|
||||
|
||||
## Panel Common Members
|
||||
|
||||
All <xref:System.Windows.Controls.Panel> elements support the base sizing and positioning properties defined by <xref:System.Windows.FrameworkElement>, including <xref:System.Windows.FrameworkElement.Height%2A>, <xref:System.Windows.FrameworkElement.Width%2A>, <xref:System.Windows.FrameworkElement.HorizontalAlignment%2A>, <xref:System.Windows.FrameworkElement.VerticalAlignment%2A>, <xref:System.Windows.FrameworkElement.Margin%2A>, and <xref:System.Windows.FrameworkElement.LayoutTransform%2A>. For additional information on positioning properties defined by <xref:System.Windows.FrameworkElement>, see [Alignment, Margins, and Padding Overview](../advanced/alignment-margins-and-padding-overview.md).
|
||||
|
||||
<xref:System.Windows.Controls.Panel> exposes additional properties that are of critical importance in understanding and using layout. The <xref:System.Windows.Controls.Panel.Background%2A> property is used to fill the area between the boundaries of a derived panel element with a <xref:System.Windows.Media.Brush>. <xref:System.Windows.Controls.Panel.Children%2A> represents the child collection of elements that the <xref:System.Windows.Controls.Panel> is comprised of. <xref:System.Windows.Controls.Panel.InternalChildren%2A> represents the content of the <xref:System.Windows.Controls.Panel.Children%2A> collection plus those members generated by data binding. Both consist of a <xref:System.Windows.Controls.UIElementCollection> of child elements hosted within the parent <xref:System.Windows.Controls.Panel>.
|
||||
@@ -47,12 +52,15 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
<xref:System.Windows.Controls.Panel> also defines the <xref:System.Windows.Controls.Panel.OnRender%2A> method, which can be used to override the default presentation behavior of a <xref:System.Windows.Controls.Panel>.
|
||||
|
||||
#### Attached Properties
|
||||
|
||||
Derived panel elements make extensive use of attached properties. An attached property is a specialized form of dependency property that does not have the conventional common language runtime (CLR) property "wrapper". Attached properties have a specialized syntax in [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)], which can be seen in several of the examples that follow.
|
||||
|
||||
One purpose of an attached property is to allow child elements to store unique values of a property that is actually defined by a parent element. An application of this functionality is having child elements inform the parent how they wish to be presented in the [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)], which is extremely useful for application layout. For more information, see [Attached Properties Overview](../advanced/attached-properties-overview.md).
|
||||
|
||||
<a name="Panels_derived_elements"></a>
|
||||
|
||||
## Derived Panel Elements
|
||||
|
||||
Many objects derive from <xref:System.Windows.Controls.Panel>, but not all of them are intended for use as root layout providers. There are six defined panel classes (<xref:System.Windows.Controls.Canvas>, <xref:System.Windows.Controls.DockPanel>, <xref:System.Windows.Controls.Grid>, <xref:System.Windows.Controls.StackPanel>, <xref:System.Windows.Controls.VirtualizingStackPanel>, and <xref:System.Windows.Controls.WrapPanel>) that are designed specifically for creating application [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)].
|
||||
|
||||
Each panel element encapsulates its own special functionality, as seen in the following table.
|
||||
@@ -71,7 +79,9 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
|<xref:System.Windows.Controls.WrapPanel>|Yes|<xref:System.Windows.Controls.WrapPanel> positions child elements in sequential position from left to right, breaking content to the next line at the edge of the containing box. Subsequent ordering happens sequentially from top to bottom or right to left, depending on the value of the <xref:System.Windows.Controls.WrapPanel.Orientation%2A> property.|
|
||||
|
||||
<a name="Panels_main_UI_elements"></a>
|
||||
|
||||
## User Interface Panels
|
||||
|
||||
There are six panel classes available in [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] that are optimized to support [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)] scenarios: <xref:System.Windows.Controls.Canvas>, <xref:System.Windows.Controls.DockPanel>, <xref:System.Windows.Controls.Grid>, <xref:System.Windows.Controls.StackPanel>, <xref:System.Windows.Controls.VirtualizingStackPanel>, and <xref:System.Windows.Controls.WrapPanel>. These panel elements are easy to use, versatile, and extensible enough for most applications.
|
||||
|
||||
Each derived <xref:System.Windows.Controls.Panel> element treats sizing constraints differently. Understanding how a <xref:System.Windows.Controls.Panel> handles constraints in either the horizontal or vertical direction can make layout more predictable.
|
||||
@@ -88,17 +98,21 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
More detailed descriptions and usage examples of each of these elements can be found below.
|
||||
|
||||
<a name="Panels_overview_Canvas_subsection"></a>
|
||||
|
||||
### Canvas
|
||||
|
||||
The <xref:System.Windows.Controls.Canvas> element enables positioning of content according to absolute *x-* and *y-* coordinates. Elements can be drawn in a unique location; or, if elements occupy the same coordinates, the order in which they appear in markup determines the order in which the elements are drawn.
|
||||
|
||||
<xref:System.Windows.Controls.Canvas> provides the most flexible layout support of any <xref:System.Windows.Controls.Panel>. Height and Width properties are used to define the area of the canvas, and elements inside are assigned absolute coordinates relative to the area of the parent <xref:System.Windows.Controls.Canvas>. Four attached properties, <xref:System.Windows.Controls.Canvas.Left%2A?displayProperty=nameWithType>, <xref:System.Windows.Controls.Canvas.Top%2A?displayProperty=nameWithType>, <xref:System.Windows.Controls.Canvas.Right%2A?displayProperty=nameWithType> and <xref:System.Windows.Controls.Canvas.Bottom%2A?displayProperty=nameWithType>, allow fine control of object placement within a <xref:System.Windows.Controls.Canvas>, allowing the developer to position and arrange elements precisely on the screen.
|
||||
|
||||
#### ClipToBounds Within a Canvas
|
||||
|
||||
<xref:System.Windows.Controls.Canvas> can position child elements at any position on the screen, even at coordinates that are outside of its own defined <xref:System.Windows.FrameworkElement.Height%2A> and <xref:System.Windows.FrameworkElement.Width%2A>. Furthermore, <xref:System.Windows.Controls.Canvas> is not affected by the size of its children. As a result, it is possible for a child element to overdraw other elements outside the bounding rectangle of the parent <xref:System.Windows.Controls.Canvas>. The default behavior of a <xref:System.Windows.Controls.Canvas> is to allow children to be drawn outside the bounds of the parent <xref:System.Windows.Controls.Canvas>. If this behavior is undesirable, the <xref:System.Windows.UIElement.ClipToBounds%2A> property can be set to `true`. This causes <xref:System.Windows.Controls.Canvas> to clip to its own size. <xref:System.Windows.Controls.Canvas> is the only layout element that allows children to be drawn outside its bounds.
|
||||
|
||||
This behavior is graphically illustrated in the [Width Properties Comparison Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Elements/WidthProperties).
|
||||
|
||||
#### Defining and Using a Canvas
|
||||
|
||||
A <xref:System.Windows.Controls.Canvas> can be instantiated simply by using [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] or code. The following example demonstrates how to use <xref:System.Windows.Controls.Canvas> to absolutely position content. This code produces three 100-pixel squares. The first square is red, and its top-left (*x, y*) position is specified as (0, 0). The second square is green, and its top-left position is (100, 100), just below and to the right of the first square. The third square is blue, and its top-left position is (50, 50), thus encompassing the lower-right quadrant of the first square and the upper-left quadrant of the second. Because the third square is laid out last, it appears to be on top of the other two squares—that is, the overlapping portions assume the color of the third box.
|
||||
|
||||
[!code-csharp[CanvasOvwSample#1](~/samples/snippets/csharp/VS_Snippets_Wpf/CanvasOvwSample/CSharp/Canvas_Ovw_Sample.cs#1)]
|
||||
@@ -110,18 +124,23 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
<a name="Panels_overview_DockPanel_subsection"></a>
|
||||
|
||||
### DockPanel
|
||||
|
||||
The <xref:System.Windows.Controls.DockPanel> element uses the <xref:System.Windows.Controls.DockPanel.Dock%2A?displayProperty=nameWithType> attached property as set in child content elements to position content along the edges of a container. When <xref:System.Windows.Controls.DockPanel.Dock%2A?displayProperty=nameWithType> is set to <xref:System.Windows.Controls.Dock.Top> or <xref:System.Windows.Controls.Dock.Bottom>, it positions child elements above or below each other. When <xref:System.Windows.Controls.DockPanel.Dock%2A?displayProperty=nameWithType> is set to <xref:System.Windows.Controls.Dock.Left> or <xref:System.Windows.Controls.Dock.Right>, it positions child elements to the left or right of each other. The <xref:System.Windows.Controls.DockPanel.LastChildFill%2A> property determines the position of the final element added as a child of a <xref:System.Windows.Controls.DockPanel>.
|
||||
|
||||
You can use <xref:System.Windows.Controls.DockPanel> to position a group of related controls, such as a set of buttons. Alternately, you can use it to create a "paned" [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)], similar to that found in Microsoft Outlook.
|
||||
|
||||
#### Sizing to Content
|
||||
|
||||
If its <xref:System.Windows.FrameworkElement.Height%2A> and <xref:System.Windows.FrameworkElement.Width%2A> properties are not specified, <xref:System.Windows.Controls.DockPanel> sizes to its content. The size can increase or decrease to accommodate the size of its child elements. However, when these properties are specified and there is no longer room for the next specified child element, <xref:System.Windows.Controls.DockPanel> does not display that child element or subsequent child elements and does not measure subsequent child elements.
|
||||
|
||||
#### LastChildFill
|
||||
|
||||
By default, the last child of a <xref:System.Windows.Controls.DockPanel> element will "fill" the remaining, unallocated space. If this behavior is not desired, set the <xref:System.Windows.Controls.DockPanel.LastChildFill%2A> property to `false`.
|
||||
|
||||
#### Defining and Using a DockPanel
|
||||
|
||||
The following example demonstrates how to partition space using a <xref:System.Windows.Controls.DockPanel>. Five <xref:System.Windows.Controls.Border> elements are added as children of a parent <xref:System.Windows.Controls.DockPanel>. Each uses a different positioning property of a <xref:System.Windows.Controls.DockPanel> to partition space. The final element "fills" the remaining, unallocated space.
|
||||
|
||||
[!code-cpp[DockPanelOvwSample#1](~/samples/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp#1)]
|
||||
@@ -134,16 +153,21 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
<a name="Panels_overview_Grid_subsection"></a>
|
||||
|
||||
### Grid
|
||||
|
||||
The <xref:System.Windows.Controls.Grid> element merges the functionality of an absolute positioning and tabular data control. A <xref:System.Windows.Controls.Grid> enables you to easily position and style elements. <xref:System.Windows.Controls.Grid> allows you to define flexible row and column groupings, and even provides a mechanism to share sizing information between multiple <xref:System.Windows.Controls.Grid> elements.
|
||||
|
||||
#### How is Grid Different from Table?
|
||||
#### How is Grid Different from Table
|
||||
|
||||
<xref:System.Windows.Documents.Table> and <xref:System.Windows.Controls.Grid> share some common functionality, but each is best suited for different scenarios. A <xref:System.Windows.Documents.Table> is designed for use within flow content (see [Flow Document Overview](../advanced/flow-document-overview.md) for more information on flow content). Grids are best used inside of forms (basically anywhere outside of flow content). Within a <xref:System.Windows.Documents.FlowDocument>, <xref:System.Windows.Documents.Table> supports flow content behaviors like pagination, column reflow, and content selection while a <xref:System.Windows.Controls.Grid> does not. A <xref:System.Windows.Controls.Grid> on the other hand is best used outside of a <xref:System.Windows.Documents.FlowDocument> for many reasons including <xref:System.Windows.Controls.Grid> adds elements based on a row and column index, <xref:System.Windows.Documents.Table> does not. The <xref:System.Windows.Controls.Grid> element allows layering of child content, allowing more than one element to exist within a single "cell." <xref:System.Windows.Documents.Table> does not support layering. Child elements of a <xref:System.Windows.Controls.Grid> can be absolutely positioned relative to the area of their "cell" boundaries. <xref:System.Windows.Documents.Table> does not support this feature. Finally, a <xref:System.Windows.Controls.Grid> is lighter weight than a <xref:System.Windows.Documents.Table>.
|
||||
|
||||
#### Sizing Behavior of Columns and Rows
|
||||
|
||||
Columns and rows defined within a <xref:System.Windows.Controls.Grid> can take advantage of <xref:System.Windows.GridUnitType.Star> sizing in order to distribute remaining space proportionally. When <xref:System.Windows.GridUnitType.Star> is selected as the Height or Width of a row or column, that column or row receives a weighted proportion of remaining available space. This is in contrast to <xref:System.Windows.GridUnitType.Auto>, which will distribute space evenly based on the size of the content within a column or row. This value is expressed as `*` or `2*` when using [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)]. In the first case, the row or column would receive one times the available space, in the second case, two times, and so on. By combining this technique to proportionally distribute space with a <xref:System.Windows.FrameworkElement.HorizontalAlignment%2A> and <xref:System.Windows.FrameworkElement.VerticalAlignment%2A> value of `Stretch` it is possible to partition layout space by percentage of screen space. <xref:System.Windows.Controls.Grid> is the only layout panel that can distribute space in this manner.
|
||||
|
||||
#### Defining and Using a Grid
|
||||
|
||||
The following example demonstrates how to build a [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)] similar to that found on the Run dialog available on the Windows Start menu.
|
||||
|
||||
[!code-csharp[GridRunDialog#1](~/samples/snippets/csharp/VS_Snippets_Wpf/GridRunDialog/CSharp/window1.xaml.cs#1)]
|
||||
@@ -154,10 +178,13 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
<a name="Panels_overview_StackPanel_subsection"></a>
|
||||
|
||||
### StackPanel
|
||||
|
||||
A <xref:System.Windows.Controls.StackPanel> enables you to "stack" elements in an assigned direction. The default stack direction is vertical. The <xref:System.Windows.Controls.StackPanel.Orientation%2A> property can be used to control content flow.
|
||||
|
||||
#### StackPanel vs. DockPanel
|
||||
|
||||
Although <xref:System.Windows.Controls.DockPanel> can also "stack" child elements, <xref:System.Windows.Controls.DockPanel> and <xref:System.Windows.Controls.StackPanel> do not produce analogous results in some usage scenarios. For example, the order of child elements can affect their size in a <xref:System.Windows.Controls.DockPanel> but not in a <xref:System.Windows.Controls.StackPanel>. This is because <xref:System.Windows.Controls.StackPanel> measures in the direction of stacking at <xref:System.Double.PositiveInfinity>, whereas <xref:System.Windows.Controls.DockPanel> measures only the available size.
|
||||
|
||||
The following example demonstrates this key difference.
|
||||
@@ -172,6 +199,7 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
#### Defining and Using a StackPanel
|
||||
|
||||
The following example demonstrates how to use a <xref:System.Windows.Controls.StackPanel> to create a set of vertically-positioned buttons. For horizontal positioning, set the <xref:System.Windows.Controls.StackPanel.Orientation%2A> property to <xref:System.Windows.Controls.Orientation.Horizontal>.
|
||||
|
||||
[!code-csharp[StackPanel_ovw2#1](~/samples/snippets/csharp/VS_Snippets_Wpf/StackPanel_ovw2/CSharp/StackPanel_Ovw_Sample2.cs#1)]
|
||||
@@ -182,7 +210,9 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
<a name="Panels_overview_VirtualizingStackPanel_subsection"></a>
|
||||
|
||||
#### VirtualizingStackPanel
|
||||
|
||||
[!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] also provides a variation of the <xref:System.Windows.Controls.StackPanel> element that automatically "virtualizes" data-bound child content. In this context, the word virtualize refers to a technique by which a subset of elements are generated from a larger number of data items based upon which items are visible on-screen. It is intensive, both in terms of memory and processor, to generate a large number of UI elements when only a few may be on the screen at a given time. <xref:System.Windows.Controls.VirtualizingStackPanel> (through functionality provided by <xref:System.Windows.Controls.VirtualizingPanel>) calculates visible items and works with the <xref:System.Windows.Controls.ItemContainerGenerator> from an <xref:System.Windows.Controls.ItemsControl> (such as <xref:System.Windows.Controls.ListBox> or <xref:System.Windows.Controls.ListView>) to only create elements for visible items.
|
||||
|
||||
The <xref:System.Windows.Controls.VirtualizingStackPanel> element is automatically set as the items host for controls such as the <xref:System.Windows.Controls.ListBox>. When hosting a data bound collection, content is automatically virtualized, as long as the content is within the bounds of a <xref:System.Windows.Controls.ScrollViewer>. This greatly improves performance when hosting many child items.
|
||||
@@ -192,7 +222,9 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
[!code-xaml[VirtualizingStackPanel_Intro#1](~/samples/snippets/csharp/VS_Snippets_Wpf/VirtualizingStackPanel_Intro/CS/default.xaml#1)]
|
||||
|
||||
<a name="Panels_overview_WrapPanel"></a>
|
||||
|
||||
### WrapPanel
|
||||
|
||||
<xref:System.Windows.Controls.WrapPanel> is used to position child elements in sequential position from left to right, breaking content to the next line when it reaches the edge of its parent container. Content can be oriented horizontally or vertically. <xref:System.Windows.Controls.WrapPanel> is useful for simple flowing [!INCLUDE[TLA#tla_ui](../../../includes/tlasharptla-ui-md.md)] scenarios. It can also be used to apply uniform sizing to all of its child elements.
|
||||
|
||||
The following example demonstrates how to create a <xref:System.Windows.Controls.WrapPanel> to display <xref:System.Windows.Controls.Button> controls that wrap when they reach the edge of their container.
|
||||
@@ -207,7 +239,9 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
<a name="Panels_nested_panel_elements"></a>
|
||||
|
||||
## Nested Panel Elements
|
||||
|
||||
<xref:System.Windows.Controls.Panel> elements can be nested within each other in order to produce complex layouts. This can prove very useful in situations where one <xref:System.Windows.Controls.Panel> is ideal for a portion of a [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)], but may not meet the needs of a different portion of the [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)].
|
||||
|
||||
There is no practical limit to the amount of nesting that your application can support, however, it is generally best to limit your application to only use those panels that are actually necessary for your desired layout. In many cases, a <xref:System.Windows.Controls.Grid> element can be used instead of nested panels due to its flexibility as a layout container. This can increase performance in your application by keeping unnecessary elements out of the tree.
|
||||
@@ -222,7 +256,9 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||

|
||||
|
||||
<a name="Panels_custom_panel_elements"></a>
|
||||
|
||||
## Custom Panel Elements
|
||||
|
||||
While [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] provides an array of flexible layout controls, custom layout behaviors can also be achieved by overriding the <xref:System.Windows.FrameworkElement.ArrangeOverride%2A> and <xref:System.Windows.FrameworkElement.MeasureOverride%2A> methods. Custom sizing and positioning can be accomplished by defining new positioning behaviors within these override methods.
|
||||
|
||||
Similarly, custom layout behaviors based on derived classes (such as <xref:System.Windows.Controls.Canvas> or <xref:System.Windows.Controls.Grid>) can be defined by overriding their <xref:System.Windows.FrameworkElement.ArrangeOverride%2A> and <xref:System.Windows.FrameworkElement.MeasureOverride%2A> methods.
|
||||
@@ -233,10 +269,12 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
[!code-csharp[PlotPanel#1](~/samples/snippets/csharp/VS_Snippets_Wpf/PlotPanel/CSharp/PlotPanel.cs#1)]
|
||||
[!code-vb[PlotPanel#1](~/samples/snippets/visualbasic/VS_Snippets_Wpf/PlotPanel/VisualBasic/PlotPanel.vb#1)]
|
||||
|
||||
To view a more complex custom panel implementation, see [Create a Custom Content-Wrapping Panel Sample](https://go.microsoft.com/fwlink/?LinkID=159979).
|
||||
To view a more complex custom panel implementation, see [Create a Custom Content-Wrapping Panel Sample](/samples/browse/).
|
||||
|
||||
<a name="Panels_global_localization"></a>
|
||||
|
||||
## Localization/Globalization Support
|
||||
|
||||
[!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] supports a number of features that assist in the creation of localizable [!INCLUDE[TLA2#tla_ui](../../../includes/tla2sharptla-ui-md.md)].
|
||||
|
||||
All panel elements natively support the <xref:System.Windows.FrameworkElement.FlowDirection%2A> property, which can be used to dynamically re-flow content based on a user's locale or language settings. For more information, see <xref:System.Windows.FrameworkElement.FlowDirection%2A>.
|
||||
@@ -250,11 +288,11 @@ ms.assetid: f73644af-9941-4611-8754-6d4cef03fc44
|
||||
## See also
|
||||
|
||||
- [Walkthrough: My first WPF desktop application](../getting-started/walkthrough-my-first-wpf-desktop-application.md)
|
||||
- [WPF Layout Gallery Sample](https://go.microsoft.com/fwlink/?LinkID=160054)
|
||||
- [WPF Layout Gallery Sample](/samples/browse/)
|
||||
- [Layout](../advanced/layout.md)
|
||||
- [WPF Controls Gallery Sample](https://github.com/Microsoft/WPF-Samples/tree/master/Getting%20Started/ControlsAndLayout)
|
||||
- [Alignment, Margins, and Padding Overview](../advanced/alignment-margins-and-padding-overview.md)
|
||||
- [Create a Custom Content-Wrapping Panel Sample](https://go.microsoft.com/fwlink/?LinkID=159979)
|
||||
- [Create a Custom Content-Wrapping Panel Sample](/samples/browse/)
|
||||
- [Attached Properties Overview](../advanced/attached-properties-overview.md)
|
||||
- [Use Automatic Layout Overview](../advanced/use-automatic-layout-overview.md)
|
||||
- [Layout and Design](../advanced/optimizing-performance-layout-and-design.md)
|
||||
|
||||
@@ -12,10 +12,13 @@ helpviewer_keywords:
|
||||
ms.assetid: 94a13b94-cfdf-4b12-a1aa-90cb50c6e9b9
|
||||
---
|
||||
# ScrollViewer Overview
|
||||
|
||||
Content within a user interface is often larger than a computer screen's display area. The <xref:System.Windows.Controls.ScrollViewer> control provides a convenient way to enable scrolling of content in [!INCLUDE[TLA#tla_winclient](../../../includes/tlasharptla-winclient-md.md)] applications. This topic introduces the <xref:System.Windows.Controls.ScrollViewer> element and provides several usage examples.
|
||||
|
||||
<a name="what_is_a_scrollviewer_element"></a>
|
||||
|
||||
## The ScrollViewer Control
|
||||
|
||||
There are two predefined elements that enable scrolling in [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] applications: <xref:System.Windows.Controls.Primitives.ScrollBar> and <xref:System.Windows.Controls.ScrollViewer>. The <xref:System.Windows.Controls.ScrollViewer> control encapsulates horizontal and vertical <xref:System.Windows.Controls.Primitives.ScrollBar> elements and a content container (such as a <xref:System.Windows.Controls.Panel> element) in order to display other visible elements in a scrollable area. You must build a custom object in order to use the <xref:System.Windows.Controls.Primitives.ScrollBar> element for content scrolling. However, you can use the <xref:System.Windows.Controls.ScrollViewer> element by itself because it is a composite control that encapsulates <xref:System.Windows.Controls.Primitives.ScrollBar> functionality.
|
||||
|
||||
The <xref:System.Windows.Controls.ScrollViewer> control responds to both mouse and keyboard commands, and defines numerous methods with which to scroll content by predetermined increments. You can use the <xref:System.Windows.Controls.ScrollViewer.ScrollChanged> event to detect a change in a <xref:System.Windows.Controls.ScrollViewer> state.
|
||||
@@ -23,10 +26,13 @@ Content within a user interface is often larger than a computer screen's display
|
||||
A <xref:System.Windows.Controls.ScrollViewer> can only have one child, typically a <xref:System.Windows.Controls.Panel> element that can host a <xref:System.Windows.Controls.Panel.Children%2A> collection of elements. The <xref:System.Windows.Controls.ContentPresenter.Content%2A> property defines the sole child of the <xref:System.Windows.Controls.ScrollViewer>.
|
||||
|
||||
<a name="scrollviewer_physical_vs_logical"></a>
|
||||
|
||||
## Physical vs. Logical Scrolling
|
||||
|
||||
Physical scrolling is used to scroll content by a predetermined physical increment, typically by a value that is declared in pixels. Logical scrolling is used to scroll to the next item in the logical tree. Physical scrolling is the default scroll behavior for most <xref:System.Windows.Controls.Panel> elements. [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] supports both types of scrolling.
|
||||
|
||||
#### The IScrollInfo Interface
|
||||
|
||||
The <xref:System.Windows.Controls.Primitives.IScrollInfo> interface represents the main scrolling region within a <xref:System.Windows.Controls.ScrollViewer> or derived control. The interface defines scrolling properties and methods that can be implemented by <xref:System.Windows.Controls.Panel> elements that require scrolling by logical unit, rather than by a physical increment. Casting an instance of <xref:System.Windows.Controls.Primitives.IScrollInfo> to a derived <xref:System.Windows.Controls.Panel> and then using its scrolling methods provides a useful way to scroll to the next logical unit in a child collection, rather than by pixel increment. By default, the <xref:System.Windows.Controls.ScrollViewer> control supports scrolling by physical units.
|
||||
|
||||
<xref:System.Windows.Controls.StackPanel> and <xref:System.Windows.Controls.VirtualizingStackPanel> both implement <xref:System.Windows.Controls.Primitives.IScrollInfo> and natively support logical scrolling. For layout controls that natively support logical scrolling, you can still achieve physical scrolling by wrapping the host <xref:System.Windows.Controls.Panel> element in a <xref:System.Windows.Controls.ScrollViewer> and setting the <xref:System.Windows.Controls.ScrollViewer.CanContentScroll%2A> property to `false`.
|
||||
@@ -37,7 +43,9 @@ Content within a user interface is often larger than a computer screen's display
|
||||
[!code-vb[IScrollInfoMethods#3](~/samples/snippets/visualbasic/VS_Snippets_Wpf/IScrollInfoMethods/VisualBasic/Window1.xaml.vb#3)]
|
||||
|
||||
<a name="scrollviewer_markup_syntax_and_sample"></a>
|
||||
|
||||
## Defining and Using a ScrollViewer Element
|
||||
|
||||
The following example creates a <xref:System.Windows.Controls.ScrollViewer> in a window that contains some text and a rectangle. <xref:System.Windows.Controls.Primitives.ScrollBar> elements appear only when they are necessary. When you resize the window, the <xref:System.Windows.Controls.Primitives.ScrollBar> elements appear and disappear, due to updated values of the <xref:System.Windows.Controls.ScrollViewer.ComputedHorizontalScrollBarVisibility%2A> and <xref:System.Windows.Controls.ScrollViewer.ComputedVerticalScrollBarVisibility%2A> properties.
|
||||
|
||||
[!code-cpp[ScrollViewer#1](~/samples/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp#1)]
|
||||
@@ -46,11 +54,15 @@ Content within a user interface is often larger than a computer screen's display
|
||||
[!code-xaml[ScrollViewer#1](~/samples/snippets/xaml/VS_Snippets_Wpf/ScrollViewer/XAML/Pane1.xaml#1)]
|
||||
|
||||
<a name="scrollviewer_styling_scrollviewer"></a>
|
||||
|
||||
## Styling a ScrollViewer
|
||||
|
||||
Like all controls in Windows Presentation Foundation, the <xref:System.Windows.Controls.ScrollViewer> can be styled in order to change the default rendering behavior of the control. For additional information on control styling, see [Styling and Templating](/dotnet/desktop-wpf/fundamentals/styles-templates-overview).
|
||||
|
||||
<a name="scrollviewer_scroll_vs_paginate"></a>
|
||||
|
||||
## Paginating Documents
|
||||
|
||||
For document content, an alternative to scrolling is to choose a document container that supports pagination. <xref:System.Windows.Documents.FlowDocument> is for documents that are designed to be hosted within a viewing control, such as <xref:System.Windows.Controls.FlowDocumentPageViewer>, that supports paginating content across multiple pages, preventing the need for scrolling. <xref:System.Windows.Controls.DocumentViewer> provides a solution for viewing <xref:System.Windows.Documents.FixedDocument> content, which uses traditional scrolling to display content outside the realm of the display area.
|
||||
|
||||
For additional information about document formats and presentation options, see [Documents in WPF](../advanced/documents-in-wpf.md).
|
||||
@@ -60,7 +72,7 @@ Content within a user interface is often larger than a computer screen's display
|
||||
- <xref:System.Windows.Controls.ScrollViewer>
|
||||
- <xref:System.Windows.Controls.Primitives.ScrollBar>
|
||||
- <xref:System.Windows.Controls.Primitives.IScrollInfo>
|
||||
- [How to: Create a Scroll Viewer](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms752352(v=vs.90))
|
||||
- [How to: Create a Scroll Viewer](/previous-versions/dotnet/netframework-3.5/ms752352(v=vs.90))
|
||||
- [Documents in WPF](../advanced/documents-in-wpf.md)
|
||||
- [ScrollBar Styles and Templates](scrollbar-styles-and-templates.md)
|
||||
- [Controls](../advanced/optimizing-performance-controls.md)
|
||||
|
||||
@@ -10,10 +10,13 @@ helpviewer_keywords:
|
||||
ms.assetid: f06c1603-e9cb-4809-8a62-234607fc52f7
|
||||
---
|
||||
# ToolTip Overview
|
||||
|
||||
A tooltip is a small pop-up window that appears when a user pauses the mouse pointer over an element, such as over a <xref:System.Windows.Controls.Button>. This topic introduces the tooltip and discusses how to create and customize tooltip content.
|
||||
|
||||
<a name="what_is_a_tooltip"></a>
|
||||
## What Is a Tooltip?
|
||||
|
||||
## What Is a Tooltip
|
||||
|
||||
When a user moves the mouse pointer over an element that has a tooltip, a window that contains tooltip content (for example, text content that describes the function of a control) appears for a specified amount of time. If the user moves the mouse pointer away from the control, the window disappears because the tooltip content cannot receive focus.
|
||||
|
||||
The content of a tooltip can contain one or more lines of text, images, shapes, or other visual content. You define a tooltip for a control by setting one of the following properties to the tooltip content.
|
||||
@@ -25,7 +28,9 @@ A tooltip is a small pop-up window that appears when a user pauses the mouse poi
|
||||
Which property you use depends on whether the control that defines the tooltip inherits from the <xref:System.Windows.FrameworkContentElement> or <xref:System.Windows.FrameworkElement> class.
|
||||
|
||||
<a name="create_tooltip"></a>
|
||||
|
||||
## Creating a ToolTip
|
||||
|
||||
The following example shows how to create a simple tooltip by setting the <xref:System.Windows.FrameworkElement.ToolTip%2A> property for a <xref:System.Windows.Controls.Button> control to a text string.
|
||||
|
||||
[!code-xaml[GroupBoxSnippet#ToolTipString](~/samples/snippets/csharp/VS_Snippets_Wpf/GroupBoxSnippet/CS/Window1.xaml#tooltipstring)]
|
||||
@@ -44,22 +49,28 @@ A tooltip is a small pop-up window that appears when a user pauses the mouse poi
|
||||
[!code-xaml[GroupBoxSnippet#ToolTipDockPanel](~/samples/snippets/csharp/VS_Snippets_Wpf/GroupBoxSnippet/CS/Window1.xaml#tooltipdockpanel)]
|
||||
|
||||
<a name="Using_the_ToolTip_and_ToolTipService_Properties"></a>
|
||||
|
||||
## Using the Properties of the ToolTip and ToolTipService Classes
|
||||
|
||||
You can customize tooltip content by setting visual properties and applying styles. If you define the tooltip content as a <xref:System.Windows.Controls.ToolTip> object, you can set the visual properties of the <xref:System.Windows.Controls.ToolTip> object. Otherwise, you must set equivalent attached properties on the <xref:System.Windows.Controls.ToolTipService> class.
|
||||
|
||||
For an example of how to set properties in order to specify the position of tooltip content by using the <xref:System.Windows.Controls.ToolTip> and <xref:System.Windows.Controls.ToolTipService> properties, see [Position a ToolTip](how-to-position-a-tooltip.md).
|
||||
|
||||
<a name="StylingToolTip"></a>
|
||||
|
||||
## Styling a ToolTip
|
||||
|
||||
You can style a <xref:System.Windows.Controls.ToolTip> by defining a custom <xref:System.Windows.Style>. The following example defines a <xref:System.Windows.Style> called `Simple` that shows how to offset the placement of the <xref:System.Windows.Controls.ToolTip> and change its appearance by setting the <xref:System.Windows.Controls.Control.Background%2A>, <xref:System.Windows.Controls.Control.Foreground%2A>, <xref:System.Windows.Controls.Control.FontSize%2A>, and <xref:System.Windows.Controls.Control.FontWeight%2A>.
|
||||
|
||||
[!code-xaml[ToolTipSimple#Style](~/samples/snippets/csharp/VS_Snippets_Wpf/ToolTipSimple/CSharp/Pane1.xaml#style)]
|
||||
|
||||
<a name="UsingtheToolTipServiceTimeIntervalProperties"></a>
|
||||
|
||||
## Using the Time Interval Properties of ToolTipService
|
||||
|
||||
The <xref:System.Windows.Controls.ToolTipService> class provides the following properties for you to set tooltip display times: <xref:System.Windows.Controls.ToolTipService.InitialShowDelay%2A>, <xref:System.Windows.Controls.ToolTipService.BetweenShowDelay%2A>, and <xref:System.Windows.Controls.ToolTipService.ShowDuration%2A>.
|
||||
|
||||
Use the <xref:System.Windows.Controls.ToolTipService.InitialShowDelay%2A> and <xref:System.Windows.Controls.ToolTipService.ShowDuration%2A> properties to specify a delay, typically brief, before a <xref:System.Windows.Controls.ToolTip> appears and also to specify how long a <xref:System.Windows.Controls.ToolTip> remains visible. For more information, see [How to: Delay the Display of a ToolTip](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms747264(v=vs.90)).
|
||||
Use the <xref:System.Windows.Controls.ToolTipService.InitialShowDelay%2A> and <xref:System.Windows.Controls.ToolTipService.ShowDuration%2A> properties to specify a delay, typically brief, before a <xref:System.Windows.Controls.ToolTip> appears and also to specify how long a <xref:System.Windows.Controls.ToolTip> remains visible. For more information, see [How to: Delay the Display of a ToolTip](/previous-versions/dotnet/netframework-3.5/ms747264(v=vs.90)).
|
||||
|
||||
The <xref:System.Windows.Controls.ToolTipService.BetweenShowDelay%2A> property determines if tooltips for different controls appear without an initial delay when you move the mouse pointer quickly between them. For more information about the <xref:System.Windows.Controls.ToolTipService.BetweenShowDelay%2A> property, see [Use the BetweenShowDelay Property](how-to-use-the-betweenshowdelay-property.md).
|
||||
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ You need the following components to complete this walkthrough:
|
||||
|
||||
5. In the Choose Model Contents screen, select **EF Designer from database** and then click **Next**.
|
||||
|
||||
6. In the Choose Your Data Connection screen, provide the connection to your AdventureWorksLT2008 database. For more information, see [Choose Your Data Connection Dialog Box](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb399244(v=vs.100)).
|
||||
6. In the Choose Your Data Connection screen, provide the connection to your AdventureWorksLT2008 database. For more information, see [Choose Your Data Connection Dialog Box](/previous-versions/dotnet/netframework-4.0/bb399244(v=vs.100)).
|
||||
|
||||
Make sure that the name is `AdventureWorksLT2008Entities` and that the **Save entity connection settings in App.Config as** check box is selected, and then click **Next**.
|
||||
|
||||
@@ -70,7 +70,7 @@ You need the following components to complete this walkthrough:
|
||||
|
||||
4. Select the <xref:System.Windows.Window>.
|
||||
|
||||
5. Using the Properties window or XAML editor, create an event handler for the <xref:System.Windows.Window> named `Window_Loaded` for the <xref:System.Windows.FrameworkElement.Loaded> event. For more information, see [How to: Create a Simple Event Handler](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb675300(v=vs.100)).
|
||||
5. Using the Properties window or XAML editor, create an event handler for the <xref:System.Windows.Window> named `Window_Loaded` for the <xref:System.Windows.FrameworkElement.Loaded> event. For more information, see [How to: Create a Simple Event Handler](/previous-versions/visualstudio/visual-studio-2010/bb675300(v=vs.100)).
|
||||
|
||||
The following shows the XAML for MainWindow.xaml.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user