mirror of
https://github.com/Stone-Red-Code/docs-desktop.git
synced 2026-09-04 09:06:04 +02:00
Fixes related to open issues. (#122)
* Update framework winforms landing * Add note about attribute * Adjust storyboard overview * Fix comments in snippet * Adjust table in getting started * Add missing encoded char * Fix bad desiredheight prop * Fix blank column * Fix description metadata * Review feedback
This commit is contained in:
+6
-1
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: "Defining Default Values with the ShouldSerialize and Reset Methods"
|
||||
description: "Learn how to use the ShouldSerialize and Reset property methods to control the Windows Forms designer behavior."
|
||||
ms.date: "03/30/2017"
|
||||
dev_langs:
|
||||
- "csharp"
|
||||
@@ -10,7 +11,7 @@ helpviewer_keywords:
|
||||
ms.assetid: 7b6c5e00-3771-46b4-9142-5a80d5864a5e
|
||||
---
|
||||
# Defining Default Values with the ShouldSerialize and Reset Methods
|
||||
`ShouldSerialize` and `Reset` are optional methods that you can provide for a property, if the property does not a have simple default value. If the property has a simple default value, you should apply the <xref:System.ComponentModel.DefaultValueAttribute> and supply the default value to the attribute class constructor instead. Either of these mechanisms enables the following features in the designer:
|
||||
`ShouldSerialize` and `Reset` are optional methods that you can provide for a property, if the property does not have a simple default value. If the property has a simple default value, you should apply the <xref:System.ComponentModel.DefaultValueAttribute> and supply the default value to the attribute class constructor instead. Either of these mechanisms enables the following features in the designer:
|
||||
|
||||
- The property provides visual indication in the property browser if it has been modified from its default value.
|
||||
|
||||
@@ -56,6 +57,9 @@ public bool ShouldSerializeMyFont() {
|
||||
}
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> If you want to permanently prevent a property from being serialized by the designer, add the [DesignerSerializationVisibility](xref:System.ComponentModel.DesignerSerializationVisibilityAttribute) attribute with the value of `Hidden`.
|
||||
|
||||
A complete code example follows.
|
||||
|
||||
```vb
|
||||
@@ -141,3 +145,4 @@ public class MyControl : Control {
|
||||
- [Properties in Windows Forms Controls](properties-in-windows-forms-controls.md)
|
||||
- [Defining a Property](defining-a-property-in-windows-forms-controls.md)
|
||||
- [Property-Changed Events](property-changed-events.md)
|
||||
- <xref:System.ComponentModel.DesignerSerializationVisibilityAttribute?displayProperty=fullName>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
### YamlMime:Landing
|
||||
|
||||
title: .NET Desktop Guide for Windows Forms
|
||||
summary: Learn about using Windows Forms on Windows with either .NET Framework, .NET 5 and above, or .NET Core 3.1.
|
||||
summary: Learn about Windows Forms (WinForms), a graphical user interface for Windows and .NET Framework.
|
||||
|
||||
metadata:
|
||||
title: Windows Forms for .NET documentation
|
||||
description: Learn about using Windows Forms (WinForms), a graphical user interface for Windows and .NET.
|
||||
description: Learn about Windows Forms (WinForms), a graphical user interface for Windows and .NET Framework.
|
||||
ms.topic: landing-page
|
||||
ms.date: 08/30/2020
|
||||
|
||||
@@ -27,7 +27,7 @@ landingContent:
|
||||
url: /visualstudio/designers/walkthrough-windows-forms-designer
|
||||
- text: Create a WinForms app from the command-line
|
||||
url: how-to-create-a-windows-forms-application-from-the-command-line.md
|
||||
|
||||
|
||||
- title: Controls
|
||||
linkLists:
|
||||
- linkListType: overview
|
||||
@@ -59,4 +59,28 @@ landingContent:
|
||||
links:
|
||||
- text: Order in which events are raised
|
||||
url: order-of-events-in-windows-forms.md
|
||||
|
||||
|
||||
- title: Input
|
||||
linkLists:
|
||||
- linkListType: overview
|
||||
links:
|
||||
- text: About keyboard input
|
||||
url: how-keyboard-input-works.md
|
||||
- text: About mouse input
|
||||
url: how-mouse-input-works-in-windows-forms.md
|
||||
- linkListType: concept
|
||||
links:
|
||||
- text: Keyboard events
|
||||
url: using-keyboard-events.md
|
||||
- text: Mouse events
|
||||
url: mouse-events-in-windows-forms.md
|
||||
- text: Mouse pointers
|
||||
url: mouse-pointers-in-windows-forms.md
|
||||
- linkListType: how-to-guide
|
||||
links:
|
||||
- text: Modify keyboard input
|
||||
url: how-to-modify-keyboard-input-to-a-standard-control.md
|
||||
- text: Detect modifier keyboard keys
|
||||
url: how-to-determine-which-modifier-key-was-pressed.md
|
||||
- text: Distinguish between single/double clicks
|
||||
url: how-to-distinguish-between-clicks-and-double-clicks.md
|
||||
|
||||
+19
-17
@@ -11,21 +11,23 @@ helpviewer_keywords:
|
||||
ms.assetid: a57776d1-f353-4794-afa0-bfa3c712ed1c
|
||||
---
|
||||
# How to: Use Special Characters in XAML
|
||||
Markup files that are created in Visual Studio are automatically saved in the Unicode UTF-8 file format, which means that most special characters, such as accent marks, are encoded correctly. However, there is a set of commonly-used special characters that are handled differently. These special characters follow the World Wide Web Consortium (W3C) XML standard for encoding.
|
||||
|
||||
The following table shows the syntax for encoding this set of special characters:
|
||||
|
||||
|Character|Syntax|Description|
|
||||
|---------------|------------|-----------------|
|
||||
|<|`<`|Less than symbol.|
|
||||
|>|`>`|Greater than sign.|
|
||||
|&|`&`|Ampersand symbol.|
|
||||
|"|`"`|Double quote symbol.|
|
||||
|
||||
Markup files that are created in Visual Studio are automatically saved in the Unicode UTF-8 file format, which means that most special characters, such as accent marks, are encoded correctly. However, there is a set of commonly-used special characters that are handled differently. These special characters follow the World [Wide Web Consortium (W3C) XML standard for encoding](https://www.w3resource.com/xml/reserved-markup-characters.php).
|
||||
|
||||
The following table shows the syntax for encoding this set of special characters:
|
||||
|
||||
| Character | Syntax | Description |
|
||||
|-----------|----------|----------------------|
|
||||
| `<` | `<` | Less than symbol. |
|
||||
| `>` | `>` | Greater than sign. |
|
||||
| `&` | `&` | Ampersand symbol. |
|
||||
| `"` | `"` | Double quote symbol. |
|
||||
| `'` | `'` | Single quote symbol. |
|
||||
|
||||
> [!NOTE]
|
||||
> If you create a markup file using a text editor, such as Windows Notepad, you must save the file in the Unicode UTF-8 file format in order to preserve any encoded special characters.
|
||||
|
||||
The following example shows how you can use special characters in text when creating markup.
|
||||
|
||||
## Example
|
||||
[!code-xaml[SpecialCharsSnippets#SpecialCharsSnippet1](~/samples/snippets/csharp/VS_Snippets_Wpf/SpecialCharsSnippets/CS/Window1.xaml#specialcharssnippet1)]
|
||||
> If you create a markup file using a text editor, such as Windows Notepad, you must save the file in the Unicode UTF-8 file format in order to preserve any encoded special characters.
|
||||
|
||||
The following example shows how you can use special characters in text when creating markup.
|
||||
|
||||
## Example
|
||||
|
||||
[!code-xaml[SpecialCharsSnippets#SpecialCharsSnippet1](~/samples/snippets/csharp/VS_Snippets_Wpf/SpecialCharsSnippets/CS/Window1.xaml#specialcharssnippet1)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Storyboards Overview"
|
||||
desription: Organize and apply animations in storyboards. Use property-targeting syntax and combine timelines in Windows Presentation Foundation (WPF).
|
||||
description: Organize and apply animations in storyboards. Use property-targeting syntax and combine timelines in Windows Presentation Foundation (WPF).
|
||||
ms.date: "03/30/2017"
|
||||
dev_langs:
|
||||
- "csharp"
|
||||
@@ -65,7 +65,9 @@ The following table shows the different places where each <xref:System.Windows.
|
||||
|--------------------------------|-------------------|-----------|----------------------|-------------------|-------------|
|
||||
|<xref:System.Windows.Media.Animation.BeginStoryboard> and an <xref:System.Windows.EventTrigger>|Yes|Yes|Yes|Yes|[Animate a Property by Using a Storyboard](how-to-animate-a-property-by-using-a-storyboard.md)|
|
||||
|<xref:System.Windows.Media.Animation.BeginStoryboard> and a property <xref:System.Windows.Trigger>|No|Yes|Yes|Yes|[Trigger an Animation When a Property Value Changes](how-to-trigger-an-animation-when-a-property-value-changes.md)|
|
||||
|<xref:System.Windows.Media.Animation.BeginStoryboard> and a property <xref:System.Windows.MultiTrigger>|No|Yes|Yes|Yes|[MultiTrigger class example](/dotnet/api/system.windows.multitrigger#examples)|
|
||||
|<xref:System.Windows.Media.Animation.BeginStoryboard> and a <xref:System.Windows.DataTrigger>|No|Yes|Yes|Yes|[How to: Trigger an Animation When Data Changes](/previous-versions/dotnet/netframework-3.5/aa970679(v=vs.90))|
|
||||
|<xref:System.Windows.Media.Animation.BeginStoryboard> and a <xref:System.Windows.MultiDataTrigger>|No|Yes|Yes|Yes|[MultiDataTrigger class example](/dotnet/api/system.windows.multidatatrigger#examples)|
|
||||
|<xref:System.Windows.Media.Animation.Storyboard.Begin%2A> method|Yes|No|No|No|[Animate a Property by Using a Storyboard](how-to-animate-a-property-by-using-a-storyboard.md)|
|
||||
|
||||
The following example uses a <xref:System.Windows.Media.Animation.Storyboard> to animate the <xref:System.Windows.FrameworkElement.Width%2A> of a <xref:System.Windows.Shapes.Rectangle> element and the <xref:System.Windows.Media.SolidColorBrush.Color%2A> of a <xref:System.Windows.Media.SolidColorBrush> used to paint that <xref:System.Windows.Shapes.Rectangle>.
|
||||
@@ -80,7 +82,10 @@ The following sections describe the <xref:System.Windows.Media.Animation.Storybo
|
||||
|
||||
## Targeting Framework Elements, Framework Content Elements, and Freezables
|
||||
|
||||
The previous section mentioned that, for an animation to find its target, it must know the target's name and the property to animate. Specifying the property to animate is straight forward: simply set <xref:System.Windows.Media.Animation.Storyboard.TargetProperty?displayProperty=nameWithType> with the name of the property to animate. You specify the name of the object whose property you want to animate by setting the <xref:System.Windows.Media.Animation.Storyboard.TargetName%2A?displayProperty=nameWithType> property on the animation.
|
||||
The previous section mentioned that, for an animation to find its target, it must know the target's name and the property to animate. Specifying the property to animate is straight forward: simply set `TargetProperty` with the name of the property to animate. You specify the name of the object whose property you want to animate by setting the <xref:System.Windows.Media.Animation.Storyboard.TargetName%2A?displayProperty=nameWithType> property on the animation.
|
||||
|
||||
> [!CAUTION]
|
||||
> While you can use the `Target` property to bind directly to an object as an alternative to `TargetName`, it isn't serializable. There is no guaranteed that the `Target` object can be correctly referenced in XAML.
|
||||
|
||||
For the <xref:System.Windows.Setter.TargetName%2A> property to work, the targeted object must have a name. Assigning a name to a <xref:System.Windows.FrameworkElement> or a <xref:System.Windows.FrameworkContentElement> in [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)] is different than assigning a name to a <xref:System.Windows.Freezable> object.
|
||||
|
||||
|
||||
@@ -88,22 +88,26 @@ With the _Form1_ form designer open, use the **Toolbox** pane to add the followi
|
||||
|
||||
You can position and size the controls according to the following settings. Either visually move them to match the screenshot that follows, or click on each control and configure the settings in the **Properties** pane. You can also click on the form title area to select the form:
|
||||
|
||||
| Object | Setting | Value |
|
||||
|---------|----------|------------|
|
||||
| Form | Text | `Names` |
|
||||
| | Size | `268, 180` |
|
||||
| Label | Location | `12, 9` |
|
||||
| | Text | `Names` |
|
||||
| Listbox | Name | `lstNames` |
|
||||
| | Location | `12, 27` |
|
||||
| | Size | `120, 94` |
|
||||
| Textbox | Name | `txtName` |
|
||||
| | Location | `138, 26` |
|
||||
| | Size | `100, 23` |
|
||||
| Button | Name | `btnAdd` |
|
||||
| | Location | `138, 55` |
|
||||
| | Size | `100, 23` |
|
||||
| | Text | `Add Name` |
|
||||
| Object | Setting | Value |
|
||||
|-------------|----------|------------|
|
||||
| **Form** | Text | `Names` |
|
||||
| | Size | `268, 180` |
|
||||
| | | |
|
||||
| **Label** | Location | `12, 9` |
|
||||
| | Text | `Names` |
|
||||
| | | |
|
||||
| **Listbox** | Name | `lstNames` |
|
||||
| | Location | `12, 27` |
|
||||
| | Size | `120, 94` |
|
||||
| | | |
|
||||
| **Textbox** | Name | `txtName` |
|
||||
| | Location | `138, 26` |
|
||||
| | Size | `100, 23` |
|
||||
| | | |
|
||||
| **Button** | Name | `btnAdd` |
|
||||
| | Location | `138, 55` |
|
||||
| | Size | `100, 23` |
|
||||
| | Text | `Add Name` |
|
||||
|
||||
You should have a form in the designer that looks similar to the following:
|
||||
|
||||
|
||||
+2
-2
@@ -55,10 +55,10 @@ namespace SDKSample {
|
||||
myStackPanel->Children->Add(myTextBlock);
|
||||
myStackPanel->Children->Add(myRectangle);
|
||||
|
||||
// Add the StackPanel as the lone Child of the Border
|
||||
// Add the StackPanel as the lone child of the ScrollViewer
|
||||
myScrollViewer->Content = myStackPanel;
|
||||
|
||||
// Add the Border as the Content of the Parent Window Object
|
||||
// Add the ScrollViewer as the Content of the parent Window object
|
||||
mainWindow->Content = myScrollViewer;
|
||||
mainWindow->Show();
|
||||
|
||||
|
||||
+1
-1
@@ -220,7 +220,7 @@
|
||||
Value="True">
|
||||
<Setter TargetName="ContentRow"
|
||||
Property="Height"
|
||||
Value="{Binding DesiredHeight, ElementName=Content}" />
|
||||
Value="{Binding Height, ElementName=Content}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
+2
-2
@@ -49,10 +49,10 @@ namespace SDKSample
|
||||
myStackPanel.Children.Add(myTextBlock);
|
||||
myStackPanel.Children.Add(myRectangle);
|
||||
|
||||
// Add the StackPanel as the lone Child of the Border
|
||||
// Add the StackPanel as the lone child of the ScrollViewer
|
||||
myScrollViewer.Content = myStackPanel;
|
||||
|
||||
// Add the Border as the Content of the Parent Window Object
|
||||
// Add the ScrollViewer as the Content of the parent Window object
|
||||
mainWindow.Content = myScrollViewer;
|
||||
mainWindow.Show ();
|
||||
|
||||
|
||||
+3
-1
@@ -38,8 +38,10 @@ Namespace SDKSample
|
||||
myStackPanel.Children.Add(myTextBlock)
|
||||
myStackPanel.Children.Add(myRectangle)
|
||||
|
||||
'Add the StackPanel as the lone Child of the Border
|
||||
'Add the StackPanel as the lone child of the ScrollViewer
|
||||
myScrollViewer.Content = myStackPanel
|
||||
|
||||
'Add the ScrollViewer as the Content of the parent Window object
|
||||
Me.Content = myScrollViewer
|
||||
'</Snippet1>
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user