Merge pull request #1135 from dotnet/adegeo-links

Correct .NET Framework links that pointed to old .NET 5 URLs
This commit is contained in:
Andy (Steve) De George
2021-08-11 12:04:34 -07:00
committed by GitHub
parent 2aea7ebcbf
commit e9fcf43083
162 changed files with 323 additions and 323 deletions
@@ -10,7 +10,7 @@ ms.assetid: ad4eb9aa-3afc-4a71-8cf6-add3fbea54a1
For the Microsoft Visual Basic .NET language specifically, you can use the language-specific `Handles` keyword to associate event handlers with instances, instead of attaching event handlers with attributes or using the <xref:System.Windows.UIElement.AddHandler%2A> method. However, the `Handles` technique for attaching handlers to instances does have some limitations, because the `Handles` syntax cannot support some of the specific routed event features of the [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] event system.
## Using "Handles" in a WPF Application
The event handlers that are connected to instances and events with `Handles` must all be defined within the partial class declaration of the instance, which is also a requirement for event handlers that are assigned through attribute values on elements. You can only specify `Handles` for an element on the page that has a <xref:System.Windows.FrameworkContentElement.Name%2A> property value (or [x:Name Directive](/dotnet/desktop-wpf/xaml-services/xname-directive) declared). This is because the <xref:System.Windows.FrameworkContentElement.Name%2A> in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] creates the instance reference that is necessary to support the *Instance.Event* reference format required by the `Handles` syntax. The only element that can be used for `Handles` without a <xref:System.Windows.FrameworkContentElement.Name%2A> reference is the root-element instance that defines the partial class.
The event handlers that are connected to instances and events with `Handles` must all be defined within the partial class declaration of the instance, which is also a requirement for event handlers that are assigned through attribute values on elements. You can only specify `Handles` for an element on the page that has a <xref:System.Windows.FrameworkContentElement.Name%2A> property value (or [x:Name Directive](/dotnet/desktop/xaml-services/xname-directive) declared). This is because the <xref:System.Windows.FrameworkContentElement.Name%2A> in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] creates the instance reference that is necessary to support the *Instance.Event* reference format required by the `Handles` syntax. The only element that can be used for `Handles` without a <xref:System.Windows.FrameworkContentElement.Name%2A> reference is the root-element instance that defines the partial class.
You can assign the same handler to multiple elements by separating *Instance.Event* references after `Handles` with commas.
@@ -31,7 +31,7 @@ For the Microsoft Visual Basic .NET language specifically, you can use the langu
> Do not use the `Handles` syntax in Visual Basic code when you specify an event handler for the same event in XAML. In this case, the event handler is called twice.
## How WPF Implements "Handles" Functionality
When a [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] page is compiled, the intermediate file declares `Friend` `WithEvents` references to every element on the page that has a <xref:System.Windows.FrameworkContentElement.Name%2A> property set (or [x:Name Directive](/dotnet/desktop-wpf/xaml-services/xname-directive) declared). Each named instance is potentially an element that can be assigned to a handler through `Handles`.
When a [!INCLUDE[TLA#tla_xaml](../../../includes/tlasharptla-xaml-md.md)] page is compiled, the intermediate file declares `Friend` `WithEvents` references to every element on the page that has a <xref:System.Windows.FrameworkContentElement.Name%2A> property set (or [x:Name Directive](/dotnet/desktop/xaml-services/xname-directive) declared). Each named instance is potentially an element that can be assigned to a handler through `Handles`.
> [!NOTE]
> Within Visual Studio, IntelliSense can show you completion for which elements are available for a `Handles` reference in a page. However, this might take one compile pass so that the intermediate file can populate all the `Friends` references.
@@ -41,4 +41,4 @@ For the Microsoft Visual Basic .NET language specifically, you can use the langu
- <xref:System.Windows.UIElement.AddHandler%2A>
- [Marking Routed Events as Handled, and Class Handling](marking-routed-events-as-handled-and-class-handling.md)
- [Routed Events Overview](routed-events-overview.md)
- [XAML Overview (WPF)](/dotnet/desktop-wpf/fundamentals/xaml)
- [XAML in WPF](xaml-in-wpf.md)