diff --git a/.gitignore b/.gitignore index 9517ddcab..24ce72c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Generated files .docusaurus .cache-loader +.idea # Misc .DS_Store diff --git a/docs/basics/data/data-binding/compiled-bindings.md b/docs/basics/data/data-binding/compiled-bindings.md index 70d11c881..8a3288668 100644 --- a/docs/basics/data/data-binding/compiled-bindings.md +++ b/docs/basics/data/data-binding/compiled-bindings.md @@ -11,9 +11,25 @@ Bindings defined in the XAML are using reflection in order to find and access th ## Enable and disable compiled bindings +:::info + +Depending on the template that was used to create the Avalonia project, compiled bindings may or may not be enabled by default. You can check this in the project file. + +::: + +### Enable and disable globally + +If you want your application to use compiled bindings globally by default, you can add + +```markup +true +``` + +to your project file. You will still need to provide `x:DataType` for the objects you want to bind but you don't need to to set `x:CompileBindings="[True|False]"` for each `UserControl` or `Window`. + ### Enable and disable per UserControl or Window -Compiled bindings are not enabled by default. To enable compiled bindings, you will need to define the `DataType` of the object you want to bind to first. In [`DataTemplates`](../data-templates) there is a property `DataType`, for all other elements you can set it via `x:DataType`. Most likely you will set `x:DataType` in your root node, for example in a `Window` or an `UserControl`. You can also specify the `DataType` in the `Binding` directly. +To enable compiled bindings, you will need to define the `DataType` of the object you want to bind to first. In [`DataTemplates`](../data-templates) there is a property `DataType`, for all other elements you can set it via `x:DataType`. Most likely you will set `x:DataType` in your root node, for example in a `Window` or an `UserControl`. You can also specify the `DataType` in the `Binding` directly. You can now enable or disable compiled bindings by setting `x:CompileBindings="[True|False]"`. All child nodes will inherit this property, so you can enable it in your root node and disable it for a specific child, if needed. @@ -39,16 +55,6 @@ You can now enable or disable compiled bindings by setting `x:CompileBindings="[ ``` -### Enable and disable globally - -If you want your application to use compiled bindings globally by default, you can add - -```markup -true -``` - -to your project file. You will still need to provide `x:DataType` for the objects you want to bind but you don't need to to set `x:CompileBindings="[True|False]"` for each `UserControl` or `Window`. - ## CompiledBinding-Markup If you don't want to enable compiled bindings for all child nodes, you can also use the `CompiledBinding`-markup. You still need to define the `DataType`, but you can omit `x:CompileBindings="True"`. diff --git a/docs/basics/data/data-binding/data-binding-syntax.md b/docs/basics/data/data-binding/data-binding-syntax.md index 3bc74100b..d5c94c0d0 100644 --- a/docs/basics/data/data-binding/data-binding-syntax.md +++ b/docs/basics/data/data-binding/data-binding-syntax.md @@ -2,6 +2,8 @@ description: CONCEPTS --- +import DataBindingModeDiagram from '/img/gitbook-import/assets/image (2).png'; + # Data Binding Syntax In Avalonia, you can define data binding in XAML or code. To define data binding in XAML, you use the data binding mark-up extension, and this has its own syntax which is described here. @@ -56,7 +58,7 @@ You can change how data is moved in a data binding by specifying the data bindin - + For example: diff --git a/docs/basics/data/data-binding/data-context.md b/docs/basics/data/data-binding/data-context.md index 81daecd78..4af505a7a 100644 --- a/docs/basics/data/data-binding/data-context.md +++ b/docs/basics/data/data-binding/data-context.md @@ -2,17 +2,22 @@ description: CONCEPTS --- +import DataContextBindingOverviewDiagram from '/img/gitbook-import/assets/image (56).png'; +import DataContextTreeSearchDiagram from '/img/gitbook-import/assets/image (62).png'; +import DataContextContentBindingScreenshot from '/img/gitbook-import/assets/image (20) (2).png'; +import DataContextPreviewerScreenshot from '/img/gitbook-import/assets/image (40) (1).png' + # Data Context When Avalonia performs data binding, it has to locate an application object to bind to. This location is represented by a **Data Context**. - + Every control in Avalonia has a property called `DataContext`, and this includes built-in controls, user controls and windows. When binding, Avalonia performs a hierarchical search of the logical control tree, starting with the control where the binding is defined, until it finds a data context to use. - + This means that a control defined in a window can use the data context of the window; or (as above) a control in a control in a window can use the window's data context. @@ -72,13 +77,13 @@ In the main window file **MainWindow.axaml** you can see that the window content When the project runs, the data binder searches up the logical control tree from the text block and finds a data context set at the main window level. So the bound text appears as: - + ## Design Data Context You may have noticed, after you first compiled this project, that the preview pane also shows the greeting. - + This is because Avalonia can also set a data context for a control for use at design-time. You will find this useful because it means that the preview pane can show some realistic data while you adjust layout and styles. diff --git a/docs/basics/data/data-binding/index.md b/docs/basics/data/data-binding/index.md index cfbd7c7ba..13d919976 100644 --- a/docs/basics/data/data-binding/index.md +++ b/docs/basics/data/data-binding/index.md @@ -2,11 +2,13 @@ description: CONCEPTS --- +import DataBindingBasicOverviewDiagram from '/img/gitbook-import/assets/image (31) (1).png'; + # Data Binding Avalonia uses data binding to move data from application objects into UI controls, change the data in application objects in response to user input, and initiate actions on the application objects in response to commands from the user. - + In this arrangement, the control is the **binding target**, and the object is the **data source**. diff --git a/docs/basics/data/data-templates.md b/docs/basics/data/data-templates.md index 20197ae05..0871748e7 100644 --- a/docs/basics/data/data-templates.md +++ b/docs/basics/data/data-templates.md @@ -25,7 +25,7 @@ For instance, if you have a `ListBox` that should display a collection of `Item` - + ``` In this example, the Data Template defines a visual layout using a `StackPanel` container. Within the `StackPanel`, we have a `TextBlock` bound to the `Name` property of the item and an `Image` control bound to the `ImageSource` property. @@ -36,4 +36,4 @@ Data Templates can be customized and tailored to specific scenarios. You can inc ## Further Reading -For more information see the Deep Dive into to [data templates](../../concepts/templates). \ No newline at end of file +For more information see the Deep Dive into to [data templates](../../concepts/templates). diff --git a/docs/basics/user-interface/animations.md b/docs/basics/user-interface/animations.md index de0d8ac08..817852491 100644 --- a/docs/basics/user-interface/animations.md +++ b/docs/basics/user-interface/animations.md @@ -3,6 +3,8 @@ id: animations title: Animations --- +import AnimationKeyframeDiagram from '/img/gitbook-import/assets/image (2) (1) (4).png'; + # Animations There are two types of animations in _Avalonia UI_: @@ -14,7 +16,7 @@ There are two types of animations in _Avalonia UI_: The simplest keyframe animation will change one property value over a a specified duration by defining two keyframes with cue points at the start (0% of the duration) and the end (100% of the duration). - + The property value is then changed over time between the keyframes using the profile defined by an easing function. The default easing function is also the simplest - a straight-line interpolation between two keyframes. diff --git a/docs/basics/user-interface/assets.md b/docs/basics/user-interface/assets.md index 39cdbcc2b..5c838f8db 100644 --- a/docs/basics/user-interface/assets.md +++ b/docs/basics/user-interface/assets.md @@ -3,13 +3,16 @@ id: assets title: Assets and Images --- +import AssetIncludeFileAssetDiagram from '/img/gitbook-import/assets/image (8).png'; +import AssetIncludeLibraryAssetDiagram from '/img/gitbook-import/assets/image.png'; + # Assets Many applications need to include assets such as bitmaps, styles and resource dictionaries. Resource dictionaries contain graphical fundamentals that can be declared in XAML. Styles can also be written in XAML, but bitmap assets are binary files, for example PNG and JPEG formats. ## Including assets - + You include assets in an application by using the `` element in your project file. @@ -46,7 +49,7 @@ As an alternative, you can use the rooted path: ## Library Assets - + If the asset is included in a different assembly from the XAML file, then you use the `avares:` URI scheme. For example, if the asset is contained in an assembly called `MyAssembly.dll` in a `Assets` folder, then you use: diff --git a/docs/basics/user-interface/building-layouts/alignment-margins-and-padding.md b/docs/basics/user-interface/building-layouts/alignment-margins-and-padding.md index 8bf15b276..d9c86682a 100644 --- a/docs/basics/user-interface/building-layouts/alignment-margins-and-padding.md +++ b/docs/basics/user-interface/building-layouts/alignment-margins-and-padding.md @@ -1,3 +1,9 @@ +import LayoutMarginsPaddingAlignmentBasicScreenshot from '/img/gitbook-import/assets/layout-margins-padding-alignment-graphic1.png'; +import LayoutMarginsPaddingAlignmentBasicAnnotatedScreenshot from '/img/gitbook-import/assets/layout-margins-padding-alignment-graphic2.png'; +import LayoutHorizontalAlignmentScreenshot from '/img/gitbook-import/assets/layout-horizontal-alignment-graphic.png'; +import LayoutVerticalAlignmentScreenshot from '/img/gitbook-import/assets/layout-vertical-alignment-graphic.png'; +import LayoutMarginsPaddingAlignmentComplexAnnotatedScreenshot from '/img/gitbook-import/assets/layout-margins-padding-aligment-graphic3.png'; + # Alignment, Margins and Padding An Avalonia control exposes several properties that are used to precisely position child elements. This topic discusses four of the most important properties: `HorizontalAlignment`, `Margin`, `Padding`, and `VerticalAlignment`. The effects of these properties are important to understand, because they provide the basis for controlling the position of elements in Avalonia applications. @@ -8,7 +14,7 @@ There are numerous ways to position elements using Avalonia. However, achieving The following illustration shows a layout scenario that utilizes several positioning properties. -Positioning Example +Positioning Example At first glance, the `Button` elements in this illustration may appear to be placed randomly. However, their positions are actually precisely controlled by using a combination of margins, alignments, and padding. @@ -42,7 +48,7 @@ The following example describes how to create the layout in the preceding illust The following diagram provides a close-up view of the various positioning properties that are used in the preceding sample. Subsequent sections in this topic describe in greater detail how to use each positioning property. -Positioning Properties +Positioning Properties ### Understanding Alignment Properties @@ -72,7 +78,7 @@ The following example shows how to apply the `HorizontalAlignment` property to ` The preceding code yields a layout similar to the following image. The positioning effects of each `HorizontalAlignment` value are visible in the illustration. -HorizontalAlignment Sample +HorizontalAlignment Sample #### VerticalAlignment Property @@ -112,7 +118,7 @@ The following example shows how to apply the `VerticalAlignment` property to `Bu The preceding code yields a layout similar to the following image. The positioning effects of each `VerticalAlignment` value are visible in the illustration. -VerticalAlignment property sample +VerticalAlignment property sample ### Understanding Margin Properties @@ -220,5 +226,5 @@ The following example demonstrates each of the concepts that are detailed in thi When compiled, the preceding application yields a UI that looks like the following illustration. The effects of the various property values are evident in the spacing between elements, and significant property values for elements in each column are shown within `TextBlock` elements. -Several positioning properties in one application +Several positioning properties in one application diff --git a/docs/basics/user-interface/building-layouts/panels-overview.md b/docs/basics/user-interface/building-layouts/panels-overview.md index 29ba58aac..6cb895d1e 100644 --- a/docs/basics/user-interface/building-layouts/panels-overview.md +++ b/docs/basics/user-interface/building-layouts/panels-overview.md @@ -1,6 +1,13 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CanvasOverlapScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/CanvasExample.png'; +import DockPanelSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/DockPanelExample.png'; +import GridSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/GridExample.png'; +import StackPanelSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/StackPanelExample.png'; +import WrapPanelSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/WrapPanelExample.png'; +import UniformGridSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/UniformGridExample.png'; + # Panels Overview `Panel` elements are components that control the rendering of elements - their size and dimensions, their position, and the arrangement of their child content. _Avalonia UI_ provides a number of predefined `Panel` elements as well as the ability to construct custom `Panel` elements. @@ -41,9 +48,7 @@ The `Canvas` element enables positioning of content according to absolute _x-_ a A `Canvas` can be instantiated simply by using XAML or code. The following example demonstrates how to use `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. -
- StackPanel Example -
+StackPanel Example - StackPanel Example - +StackPanel Example - Grid Example App - +Grid Example App - StackPanel Example - +StackPanel Example - StackPanel Example - +StackPanel Example - StackPanel Example - +StackPanel Example

The code-behind file contains a class that shares the same name as the XAML file. For example: diff --git a/docs/basics/user-interface/controls/builtin-controls.md b/docs/basics/user-interface/controls/builtin-controls.md index 033820c96..03ae21912 100644 --- a/docs/basics/user-interface/controls/builtin-controls.md +++ b/docs/basics/user-interface/controls/builtin-controls.md @@ -1,6 +1,6 @@ # Built-in Controls -Here are some of the more commonly-used Avalonia controls, organised by catagory: +Here are some of the more commonly-used Avalonia controls, organised by category: ## Layout controls @@ -28,7 +28,7 @@ Here are some of the more commonly-used Avalonia controls, organised by catagory |[Button](../../../reference/controls/buttons/button.md)|The basic button control - can display text, an icon or both. Has standard 'click' behavior.| |[Repeat Button](../../../reference/controls/buttons/repeatbutton.md)|A button that raises its click event repeatedly when it is pressed and held.| |[Radio Button](../../../reference/controls/buttons/radiobutton.md)|A button that has a selected state. It can be placed in a group so that selection of one button deselects all the others in the group.| -|[Toggle Button](../../../reference/controls/buttons/togglesplitbutton.md)|A button that has a selected state and a unselected state. Subsequent clicks 'toggle' this state. A 'checked' pseudo class allows different styles to be allocated to the selected and unselected states.| +|[Toggle Button](../../../reference/controls/buttons/togglebutton.md)|A button that has a selected state and a unselected state. Subsequent clicks 'toggle' this state. A 'checked' pseudo class allows different styles to be allocated to the selected and unselected states.| |[Button Spinner](../../../reference/controls/buttons/buttonspinner.md)|A control with two spin buttons and a content zone.| |[Split Button](../../../reference/controls/buttons/splitbutton.md)|This functions as a button with primary and secondary parts that can be pressed independently. The primary part behaves like standard button, and the secondary part opens a flyout with additional actions.| |[Toggle Split Button](../../../reference/controls/buttons/togglesplitbutton.md)|This functions as a button with primary and secondary parts that can be pressed independently. The primary part behaves like toggle button, and the secondary part opens a flyout with additional actions.| @@ -62,6 +62,7 @@ These controls display repeating data, in either a tabular or list format: |[Slider](../../../reference/controls/slider.md)|Double|Relative value compared to a maximum and minimum value presented as the position along the length of the slider track of the slider button. Drag interaction on the slider button can alter the value between the maximum and minimum values. Keyboard and click interactions can also nudge the value.| |[Calendar](../../../reference/controls/detailed-reference/calendar)|DateTime|The calendar is a control for users to select dates or date ranges.| |[Calendar Date Picker](../../../reference/controls/detailed-reference/calendar/calendar-date-picker.md)|DateTime|An extension of the calendar control that includes a text box and button.| +|[Color Picker](../../../reference/controls/colorpicker)|Color / HsvColor|The color picker supports user-selection and editing of colors using a spectrum, palette and component sliders. It also supports an optional alpha component, RGB or HSV color models and hexadecimal color values.| |[Date Picker](../../../reference/controls/datepicker.md)|DateTime|The date picker has three 'spinner' controls to allow the user to pick a date value.| |[Time Picker](../../../reference/controls/detailed-reference/timepicker.md)|TimeSpan|The time picker has three 'spinner' controls to allow the user to pick a time from hours, minutes and seconds.| diff --git a/docs/basics/user-interface/styling/control-themes.md b/docs/basics/user-interface/styling/control-themes.md index f4bbe3935..34d893a3e 100644 --- a/docs/basics/user-interface/styling/control-themes.md +++ b/docs/basics/user-interface/styling/control-themes.md @@ -3,6 +3,8 @@ id: control-themes title: Control Themes --- +import StylingEllipseButtonScreenshot from '/img/basics/user-interface/styling/ellipse-button.png'; + Control themes build upon [Styles](styles) to create switchable themes for controls. Control themes are analogous to Styles in WPF/UWP, though their mechanism is slightly different. :::tip @@ -75,7 +77,7 @@ The following example shows a simple `Button` theme which displays a button with ``` -![Ellipe Button](/img/basics/user-interface/styling/ellipse-button.png) +

Ellipse Button

## Interaction in Control Themes diff --git a/docs/basics/user-interface/styling/styles.md b/docs/basics/user-interface/styling/styles.md index 72a38239e..5e68d39ae 100644 --- a/docs/basics/user-interface/styling/styles.md +++ b/docs/basics/user-interface/styling/styles.md @@ -3,6 +3,8 @@ id: styles title: Styles --- +import StyleH1SampleScreenshot from '/img/gitbook-import/assets/image (5) (5).png'; + # Styles The _Avalonia UI_ style system is a mechanism that can share property settings between controls. @@ -58,7 +60,7 @@ This is an example of how a style is written and applied to a control element, w In this example, all `TextBlock` elements with the `h1` style class will be displayed with the font size and weight set by the style. This works in the preview pane: - + ## Where to put Styles diff --git a/docs/basics/user-interface/styling/themes/fluent.md b/docs/basics/user-interface/styling/themes/fluent.md index de20c0429..467c65d3a 100644 --- a/docs/basics/user-interface/styling/themes/fluent.md +++ b/docs/basics/user-interface/styling/themes/fluent.md @@ -3,11 +3,14 @@ id: fluent title: Fluent Theme --- +import FluentThemeNormalScreenshot from '/img/basics/user-interface/styling/fluent-theme-normal.png'; +import FluentThemeForestScreenshot from '/img/basics/user-interface/styling/fluent-theme-forest.png'; + ## Introduction Avalonia Fluent theme is inspired by Microsoft's Fluent Design System, which is a set of design guidelines and components for creating visually appealing and interactive user interfaces. The Fluent Design System emphasizes modern, clean aesthetics, smooth animations, and intuitive interactions. It provides a consistent and polished look-and-feel across different platforms, while giving developers flexibility with our styling system. -![Fluent Theme](/img/basics/user-interface/styling/fluent-theme-normal.png) +

Fluent Theme

## How to use @@ -102,4 +105,4 @@ It is available on page and supports following featur 6. Couple of quick start presets. Example of FluentTheme with a Forest palette preset available on the web app: -![Fluent Theme Forest Palette](/img/basics/user-interface/styling/fluent-theme-forest.png) \ No newline at end of file +

Fluent Theme Forest Palette

\ No newline at end of file diff --git a/docs/community.md b/docs/community.md index 45728fe80..79a32e229 100644 --- a/docs/community.md +++ b/docs/community.md @@ -1,8 +1,14 @@ # Community Support +import TelegramLogoScreenshot from '/img/gitbook-import/assets/image (7) (1) (1).png'; +import GitterLogoScreenshot from '/img/gitbook-import/assets/image (38) (1) (1).png'; +import GitterChatScreenshot from '/img/gitbook-import/assets/image (37) (1) (1).png'; + ## Telegram -You can also access the Avalonia chat using the _Telegram_ app (recommended for the best experience). + + +Access the Avalonia chat using the _Telegram_ app (recommended for the best experience). :::info You can access the _Telegram_ chat [here](https://t.me/Avalonia). @@ -10,15 +16,14 @@ You can access the _Telegram_ chat [here](https://t.me/Avalonia). ## Gitter - + We run a chat in English on the Gitter platform. - + :::info Access the chat in your browser using Gitter [here](https://gitter.im/AvaloniaUI/Avalonia). ::: - diff --git a/docs/concepts/attached-property.md b/docs/concepts/attached-property.md index 2647e436d..c43d16e43 100644 --- a/docs/concepts/attached-property.md +++ b/docs/concepts/attached-property.md @@ -2,11 +2,14 @@ description: CONCEPTS --- +import AttachedControlDiagram from '/img/gitbook-import/assets/image (9).png'; +import AttachedLayoutPropertyDiagram from '/img/gitbook-import/assets/image (17).png'; + # Attached Properties -_Avalonia UI_ controls support the **attached property** concept. This is a property applied to a child control that references its container control. +_Avalonia UI_ controls support the **attached property** concept. This is a property applied to a child control that references its container control. -In XMAL attached properties are defined as attributes of the child control element, using the format: `ContainerClassName.AttachedPropertyName="value"` +In XAML, attached properties are defined as attributes of the child control element using the format: `ContainerClassName.AttachedPropertyName="value"` Here are some scenarios where an attached property is used: @@ -14,13 +17,13 @@ Here are some scenarios where an attached property is used: An additional control is attached to a 'host control' for some purpose. This can be used where the control usually only allows a single child in its content zone. In this scenario the attached control is not counted as part of the content, but it will be used in some other way by the container. Examples include: context menus, tool tips and flyouts. - + ## Layout Control Attached layout properties are used in scenarios where the container control has to know something about the child controls it is going to arrange. Examples include: grids, dock panels and relative panels. - + :::info For a full list of the _Avalonia UI_ built-in controls, see the reference [here](../reference/controls/). diff --git a/docs/concepts/control-trees.md b/docs/concepts/control-trees.md index 20218dfbe..24912cd87 100644 --- a/docs/concepts/control-trees.md +++ b/docs/concepts/control-trees.md @@ -2,6 +2,10 @@ description: CONCEPTS --- +import ControlTreesLogicalScreenshot from '/img/gitbook-import/assets/image (61).png'; +import ControlTreesVisualScreenshot from '/img/gitbook-import/assets/image (15) (2).png'; +import ControlTreesEventScreenshot from '/img/gitbook-import/assets/image (1) (1) (2).png'; + # Control Trees _Avalonia UI_ creates control trees from the XAML files in an application so that it can render the UI presentation and manage the application functionality. @@ -10,7 +14,7 @@ _Avalonia UI_ creates control trees from the XAML files in an application so tha The logical control tree represents the application controls (including the main window) in the hierarchy in which they are defined in the XAML. For example: and control (button) inside another control (stack panel) in a window will have the 3-layer logical tree shown here: - + While your application is running, you can show the _Avalonia Dev Tools_ window (hit F12). This displays the logical tree on its **Logical Tree** tab. @@ -18,7 +22,7 @@ While your application is running, you can show the _Avalonia Dev Tools_ window The visual control tree contains everything that is actually being run by _Avalonia UI_. It shows all the properties set on the controls, and all the additional parts that have been added by _Avalonia UI_ in order to present the UI and manage the application functionality. - + You can see the visual control tree on the **Visual Tree** tab of the _Avalonia Dev Tools_ window. @@ -26,4 +30,4 @@ You can see the visual control tree on the **Visual Tree** tab of the _Avalonia An essential part of application functionality management performed by _Avalonia UI_, is the generation and propagation of events. The **Events** tab logs the source and propagation of events as you move around, and otherwise interact with the running application. - + diff --git a/docs/concepts/input/pointer.md b/docs/concepts/input/pointer.md index 4d2d240f7..13df52a53 100644 --- a/docs/concepts/input/pointer.md +++ b/docs/concepts/input/pointer.md @@ -2,6 +2,8 @@ description: CONCEPTS - Input --- +import PointerPressedSampleScreenshot from '/img/gitbook-import/assets/pressed.gif'; + # Mouse and Pointer Devices In _Avalonia UI_ you implement the interaction of pointing devices with your application using a 'pointer' abstraction. This can represent devices including, but not limited to a mouse, touchpad, and pen. _Avalonia UI_ controls have events that allow you to subscribe to pointer movements, clicks and wheel movements. These are as follows: @@ -44,7 +46,7 @@ private void PointerPressedHandler (object sender, PointerPressedEventArgs args) ``` - + ## Pointer Position diff --git a/docs/concepts/input/routed-events.md b/docs/concepts/input/routed-events.md index 857a8f672..b966900ca 100644 --- a/docs/concepts/input/routed-events.md +++ b/docs/concepts/input/routed-events.md @@ -2,6 +2,8 @@ description: CONCEPTS - Input --- +import InputEventRoutingDiagram from '/img/gitbook-import/assets/input-event-routing.png'; + # Routed Events Most events in Avalonia are implemented as Routed Events. Routed events are events that are raised on the whole tree rather than just the control that raised the event. @@ -221,7 +223,7 @@ Avalonia input events that come in pairs are implemented so that a single user a As an illustration of how input event processing works, consider the following input event example. In the following tree illustration, `leaf element #2` is the source of a `PointerPressed` event: -Event routing diagram +Event routing diagram The order of event processing is as follows: diff --git a/docs/concepts/layout/layout-zones.md b/docs/concepts/layout/layout-zones.md index d840ea660..2a4226708 100644 --- a/docs/concepts/layout/layout-zones.md +++ b/docs/concepts/layout/layout-zones.md @@ -2,6 +2,8 @@ description: CONCEPTS - Layout --- +import LayoutZonesDiagram from '/img/gitbook-import/assets/image (25) (2) (1).png'; + # Layout Zones - + diff --git a/docs/concepts/reactiveui/index.md b/docs/concepts/reactiveui/index.md index 892c0df44..d112f7073 100644 --- a/docs/concepts/reactiveui/index.md +++ b/docs/concepts/reactiveui/index.md @@ -2,6 +2,8 @@ description: CONCEPTS --- +import ReactiveUINuGetScreenshot from '/img/gitbook-import/assets/image (44) (1).png'; + # ReactiveUI :::tip @@ -18,7 +20,7 @@ For a full technical background on functional reactive programming, see the Wiki _Avalonia UI_ ships with its own fork of _ReactiveUI_ in the `Avalonia.ReactiveUI` _NuGet_ package. - + To use _ReactiveUI_ and the MVVM pattern in your _Avalonia UI_ application, add the package to your project using the _NuGet_ package manager (as above), or execute the following CLI command: diff --git a/docs/concepts/reactiveui/reactive-command.md b/docs/concepts/reactiveui/reactive-command.md index ab3486d88..d7035294c 100644 --- a/docs/concepts/reactiveui/reactive-command.md +++ b/docs/concepts/reactiveui/reactive-command.md @@ -2,6 +2,10 @@ description: CONCEPTS - ReactiveUI --- +import ReactiveCommandViewScreenshot from '/img/gitbook-import/assets/image (2) (1) (1) (1).png'; +import ReactiveCommandRunOutputScreenshot from '/img/gitbook-import/assets/image (6) (1) (1).png'; +import ReactiveCommandCanExecuteScreenshot from '/img/gitbook-import/assets/image (6) (1) (2).png'; + # Reactive Command On this page you will learn how to use the _ReactiveUI_ `ReactiveCommand` and an `ObservableObject` created in code, to implement the UI principle of revealed functionality. @@ -24,7 +28,7 @@ As a starting point, you can create a simple view like this: ``` - + You can add a corresponding view model like this: @@ -53,7 +57,7 @@ public class MainWindowViewModel : ViewModelBase This view model does not yet perform revealed functionality. The `SubmitCommand` is declared with no parameter, and no result (void). The synchronous action parameter of the `Create` method is where you implement what happens when the command is run (when the user clicks the button). The example above just reports the action in the debug window. - + ## Can Execute? @@ -81,8 +85,4 @@ SubmitCommand = ReactiveCommand.Create(() => Now you will see that the button only becomes enabled once you have entered 8 characters. - - - - - + diff --git a/docs/concepts/reactiveui/reactive-view-model.md b/docs/concepts/reactiveui/reactive-view-model.md index 5386f1caa..28fc5a7a0 100644 --- a/docs/concepts/reactiveui/reactive-view-model.md +++ b/docs/concepts/reactiveui/reactive-view-model.md @@ -2,6 +2,8 @@ description: CONCEPTS - ReactiveUI --- +import ReactiveObjectDiagram from '/img/gitbook-import/assets/image (4) (2).png'; + # Reactive View Model This page describes how you can use the _ReactiveUI_ `ReactiveObject` as the basis of your view model to implement MVVM binding with _Avalonia UI_. @@ -20,7 +22,7 @@ public class ViewModelBase : ReactiveObject } ``` - + :::info If you have used the Avalonia MVVM Application solution template, then you will find this base class already added to the project /ViewModels folder. @@ -50,7 +52,7 @@ _Avalonia UI_ uses the underlying `ReactiveObject` to **Notify** changes in the Watermark="Enter a description"/> ``` -Any change to the view model description property is achieved using the the `set` accessor and a change is raised causing _Avalonia UI_ to display the new value on the UI. +Any change to the view model description property is achieved using the `set` accessor and a change is raised causing _Avalonia UI_ to display the new value on the UI. ## Update the View Model from Input diff --git a/docs/concepts/reactiveui/routing.md b/docs/concepts/reactiveui/routing.md index 6466ec19a..a50fccfbf 100644 --- a/docs/concepts/reactiveui/routing.md +++ b/docs/concepts/reactiveui/routing.md @@ -1,5 +1,7 @@ # Routing +import ReactiveUIRoutingScreenshot from '/img/gitbook-import/assets/routing.gif'; + [ReactiveUI routing](https://reactiveui.net/docs/handbook/routing/) consists of an [IScreen](https://reactiveui.net/api/reactiveui/iscreen/) that contains current [RoutingState](https://reactiveui.net/api/reactiveui/routingstate/), several [IRoutableViewModel](https://reactiveui.net/api/reactiveui/iroutableviewmodel/)s, and a platform-specific XAML control called [RoutedViewHost](https://github.com/AvaloniaUI/Avalonia/blob/55458cf7af24d6c987268ab5ff8a1ead1173310b/src/Avalonia.ReactiveUI/RoutedViewHost.cs). `RoutingState` manages the view model navigation stack and allows view models to navigate to other view models. `IScreen` is the root of a navigation stack; despite the name, its views don't have to occupy the whole screen. `RoutedViewHost` monitors an instance of `RoutingState`, responding to any changes in the navigation stack by creating and embedding the appropriate view. ## Routing Example @@ -245,5 +247,5 @@ Now, you can run the app and see routing in action! dotnet run --framework netcoreapp2.1 ``` - + diff --git a/docs/concepts/services/storage-provider/file-picker-options.md b/docs/concepts/services/storage-provider/file-picker-options.md index e2c837810..1b82e836c 100644 --- a/docs/concepts/services/storage-provider/file-picker-options.md +++ b/docs/concepts/services/storage-provider/file-picker-options.md @@ -33,6 +33,18 @@ Gets or sets an option indicating whether open picker allows users to select mul Gets or sets the collection of file types that the file open picker displays. +To create a list of file types for the file picker: + +```cs +//This can also be applied for SaveFilePicker. +var files = await _target.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() +{ + Title = title, +//You can add either custom or from the built-in file types. See "Defining custom file types" on how to create a custom one. + FileTypeFilter = new[] { ImageAll, FilePickerFileTypes.TextPlain } +}); +``` + ## FilePickerSaveOptions ### SuggestedFileName diff --git a/docs/concepts/templates/content-template.md b/docs/concepts/templates/content-template.md index 8a46c85d3..e047cdc4c 100644 --- a/docs/concepts/templates/content-template.md +++ b/docs/concepts/templates/content-template.md @@ -2,6 +2,8 @@ description: CONCEPTS - Data Templates --- +import ContentTemplateStudentScreenshot from '/img/gitbook-import/assets/image (47).png'; + # Content Template The purpose of a data template is that it defines how _Avalonia UI_ should display an object created from a class that you have defined, and that is not a control, or a simple string. @@ -43,7 +45,7 @@ You can define a data template (for no particular class) using the `DataTemplate In the above, the bindings refer to the properties of any class present in the content zone of the window. Here the window content is the same student object as you used before; but when you run this code, _Avalonia UI_ now displays: - + Using a data template in this way, you have both defined and chosen the data template for the content in the same place - by setting the `ContentTemplate` property of the window directly. diff --git a/docs/concepts/templates/data-templates-collection.md b/docs/concepts/templates/data-templates-collection.md index 1ef66396f..30a5a0bef 100644 --- a/docs/concepts/templates/data-templates-collection.md +++ b/docs/concepts/templates/data-templates-collection.md @@ -2,6 +2,8 @@ description: CONCEPTS - Data Templates --- +import DataTemplatesCollectionStudentScreenshot from '/img/gitbook-import/assets/image (57).png'; + # Data Templates Collection Every control in _Avalonia UI_ has a `DataTemplates` collection where you can place any number of data template definitions. You can then choose the template to use for display by class type. @@ -38,5 +40,5 @@ So you can modify the previous sample to use the `DataTemplates` collection, as This results in exactly the same display as on the previous page: - + diff --git a/docs/concepts/templates/data-templates.md b/docs/concepts/templates/data-templates.md index 1b784bca8..0079678ec 100644 --- a/docs/concepts/templates/data-templates.md +++ b/docs/concepts/templates/data-templates.md @@ -2,9 +2,13 @@ description: CONCEPTS - Data Templates --- +import ControlContentButtonScreenshot from '/img/gitbook-import/assets/image (42) (1).png'; +import ControlContentStringScreenshot from '/img/gitbook-import/assets/image (51).png'; +import ControlContentTypeScreenshot from '/img/gitbook-import/assets/image (52).png'; + # Control Content -You have probably seen what happens if you put a button control into the content zone of an _Avalonia UI_ window. +You have probably seen what happens if you put a button control into the content zone of an _Avalonia UI_ window. :::info The concept of the zones of an _Avalonia UI_ control is discussed [here](../layout/layout-zones). @@ -26,7 +30,7 @@ For example: The window displays the button - in this case centred both horizontally (specified) and vertically (by default). It looks like this: - + And if you put a string into the window content zone, for example: @@ -44,7 +48,7 @@ And if you put a string into the window content zone, for example: The window will display the string: - + But what happens if you try to display an object from a class that you have defined in the window? @@ -74,7 +78,7 @@ And the XML namespace `local` defined as the `MySample` namespace (from above), But you will see only the fully-qualified class name for the student object: - + This is not very helpful! It happens because _Avalonia UI_ has no definition of how to display an object of class `Student` - and it is not a control - so it falls back on the `.ToString()` method, and all you see is the fully-qualified class name. diff --git a/docs/concepts/templates/reusing-data-templates.md b/docs/concepts/templates/reusing-data-templates.md index 25da2d39d..b948c55c5 100644 --- a/docs/concepts/templates/reusing-data-templates.md +++ b/docs/concepts/templates/reusing-data-templates.md @@ -2,6 +2,8 @@ description: CONCEPTS - Data Templates --- +import ReuseTeacherDataTemplateScreenshot from '/img/gitbook-import/assets/image (50).png'; + # Reusing Data Templates If you define a data template in the `Window.DataTemplates`collection (as on the previous page), you can reuse it anywhere in the window. However, you can also extend the reuse of a data template to any window in your application. @@ -80,7 +82,7 @@ Use a local definition of a teacher in the window content zone: Although there is no data template for a teacher in the window; Avalonia UI will find the template you defined in the application, and the display works as planned: - + :::warning Remember to specify a `DataType` in every data template, wherever it is defined, because if _Avalonia UI_ fails to find a data template match for your data; then nothing will be displayed! diff --git a/docs/concepts/the-main-window.md b/docs/concepts/the-main-window.md index 4404a77a9..5054bf52d 100644 --- a/docs/concepts/the-main-window.md +++ b/docs/concepts/the-main-window.md @@ -16,10 +16,10 @@ public override void OnFrameworkInitializationCompleted() } ``` -It can be retrieved at any time by casting `Application.ApplicationLifetime` `IClassicDesktopStyleApplicationLifetime`. +It can be retrieved at any time by casting `Application.ApplicationLifetime` to `IClassicDesktopStyleApplicationLifetime`. :::warning -Mobile and browser platforms don't have a concept of Window in Avalonia. Instead you need to set MainView control in Application.ApplicationLifetime when it implements ISingleViewApplicationLifetime interface. +Mobile and browser platforms don't have a concept of Window in Avalonia. Instead you need to set the MainView control in Application.ApplicationLifetime when it implements ISingleViewApplicationLifetime interface. ::: -### +### diff --git a/docs/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md b/docs/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md index 482e46f1b..40b9e7653 100644 --- a/docs/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md +++ b/docs/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md @@ -2,6 +2,8 @@ description: CONCEPTS - The MVVM Pattern --- +import MvvmDataBindingDiagram from '/img/gitbook-import/assets/mvvm.png'; + # Avalonia UI and MVVM On this page you will lean how the MVVM pattern is realised when you use it with _Avalonia UI_. @@ -28,7 +30,7 @@ To learn how to design and implement your own controls, see [here](../../guides/ Data binding is the key technology that allows an _Avalonia UI_ MVVM application to separate views from view models. You can visualise the view to view model relationship as two layers connected by the data bindings: - + Notice how some of the data bindings are represented by a two way arrow, and others by a single-headed arrow. For example, the name and address inputs are two ways - you want both changes in the view model to be notified to the view, and for inputs to the view to be updated on the view model. diff --git a/docs/concepts/the-mvvm-pattern/index.md b/docs/concepts/the-mvvm-pattern/index.md index b94166178..6fd44f2a3 100644 --- a/docs/concepts/the-mvvm-pattern/index.md +++ b/docs/concepts/the-mvvm-pattern/index.md @@ -2,9 +2,11 @@ description: CONCEPTS --- +import MvvmPatternDiagram from '/img/gitbook-import/assets/image (60).png'; + # The MVVM Pattern - + The Model-View-View Model (MVVM) pattern is a common way of structuring a UI application. It uses a data binding system that helps move data between its view and view model parts. This means it achieves separation of application logic (view model) from the display of the UI (view). diff --git a/docs/concepts/ui-composition.md b/docs/concepts/ui-composition.md index 54388b934..b861e4518 100644 --- a/docs/concepts/ui-composition.md +++ b/docs/concepts/ui-composition.md @@ -2,6 +2,11 @@ description: CONCEPTS --- +import CompositionBasicLayoutDiagram from '/img/gitbook-import/assets/image (10) (2).png'; +import CompositionTreesDiagram from '/img/gitbook-import/assets/image (3) (1).png'; +import CompositionUserControlsDiagram from '/img/gitbook-import/assets/image (8) (2).png'; +import CompositionCollectionControlsDiagram from '/img/gitbook-import/assets/image (8) (3).png'; + # UI Composition UI composition is the process you use to create the layouts that your apps require. It allows you to build a complex view from an arrangement of components. The advantages are: @@ -25,7 +30,7 @@ A window in _Avalonia UI_ is a basic unit of layout (for a windowing platform).& _Avalonia UI_ contains a large number of built-in controls that will cover most of your UI requirements. - + When you first meet _Avalonia UI_, you might place a single built-in control in the content zone of a window (above, left). This is the simplest form of UI composition: the window has the title of the app and usually some window state controls (depending on the target platform). The built-in control allows your app to receive some user input, or to present some output with layout and styling. @@ -39,7 +44,7 @@ To see the full range of Avalonia UI built-in controls, see the reference sectio Whatever arrangement of controls you use, _Avalonia UI_ represents their relationships as a a tree structure, with the 'outermost' control as the root. So for example, the previous UI composition can be represented as the tree shown here: - + This is the **logical control tree**, and it represents the application controls (including the main window) in the hierarchy in which they are defined in the XAML. There are many systems in _Avalonia UI_ that process the logical control tree and its companion the **visual control tree**. @@ -51,7 +56,7 @@ For more information on the concept of control trees, see [here](control-trees.m User controls are the mainstay of UI composition in _Avalonia UI_. - + You can add a user control to the content zone of a main window, to represent a 'page view' (above, left). This allows you to implement a more complex app with multiple pages; where the layout and function of each page is in its own user control (XAML and code) files. @@ -71,7 +76,7 @@ In the 'To Do List App' tutorial you will learn about how to add user controls a Another variation of UI composition is where you need to present a collection of items. - + This scenario will use one of the built-in repeating controls, bound to a collection; together with a data template to represent the items in the collection. diff --git a/docs/deployment/macOS.md b/docs/deployment/macOS.md index bfa87df4f..2fc13ada7 100644 --- a/docs/deployment/macOS.md +++ b/docs/deployment/macOS.md @@ -323,9 +323,9 @@ The following steps were modified from [this StackOverflow post](https://stackov Once notarization is complete, you should be able to distribute your application! -{% hint style="info" %} +:::info If you distribute your app in a `.dmg`, you will want to modify the steps slightly: -{% endhint %} +::: 1. Notarize your `.app` as normal \(in a `.zip` file\) 2. Add your notarized and stapled \(`xcrun stapler`\) app into the DMG \(the DMG now has the notarized/stapled `.app` file inside of it\). @@ -649,4 +649,4 @@ When you run this workflow you will have an app bundle that is signed and notari To verify that code signing worked you will need to download it first to trigger the quarantine functionality of macOS. You can do this by e-mailing it to yourself or using a service like WeTransfer or similar. -Once you've downloaded the app bundle and want to start it you should see the popup from macOS saying that the app was scanned and no malware was found. \ No newline at end of file +Once you've downloaded the app bundle and want to start it you should see the popup from macOS saying that the app was scanned and no malware was found. diff --git a/docs/get-started/getting-started.md b/docs/get-started/getting-started.md index d89f191a5..86c93c3e1 100644 --- a/docs/get-started/getting-started.md +++ b/docs/get-started/getting-started.md @@ -1,4 +1,4 @@ ---- +s--- id: getting-started title: Starting with the CLI --- diff --git a/docs/get-started/set-up-an-editor.md b/docs/get-started/set-up-an-editor.md index 065f892a6..fcb649d1d 100644 --- a/docs/get-started/set-up-an-editor.md +++ b/docs/get-started/set-up-an-editor.md @@ -3,6 +3,9 @@ id: set-up-an-editor title: Set Up an Editor --- +import AvaloniaVsExtensionMarketplaceScreenshot from '/img/get-started/install-the-avalonia-extension/image (17) (2).png'; +import AvaloniaVsExtensionNuGetScreenshot from '/img/get-started/install-the-avalonia-extension/image (3) (1) (1) (1).png'; + # Set Up an Editor You can create an Avalonia application using any code editor, but using an IDE will give you support for authoring Avalonia XAML files with a previewer and code completion. @@ -19,9 +22,7 @@ Rider does not yet provide a visual designer, but this is in development. See [t If you're developing Avalonia with Visual Studio you should install the [Avalonia for Visual Studio](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS) extension. -
- -
+ The extension provides intellisense support for Avalonia XAML together with a previewer. @@ -31,9 +32,7 @@ To install the Avalonia for Visual Studio extension: - In the **Search** box, type "Avalonia" - Click **Download** and follow the instructions (you will need to close Visual Studio to complete the installation) -
- -
+ :::info Alternatively you can download the extension [here](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS). diff --git a/docs/get-started/test-drive/add-a-control.md b/docs/get-started/test-drive/add-a-control.md index ac79e5c26..c3d7cc1f5 100644 --- a/docs/get-started/test-drive/add-a-control.md +++ b/docs/get-started/test-drive/add-a-control.md @@ -4,6 +4,7 @@ title: Add a Control --- import Highlight from '@site/src/components/Highlight'; +import AvaloniaPropertyIntellisenseScreenshot from '/img/get-started/add-a-control/image (1) (2) (1).png'; So far the main window of your application displays only a text string. On this page, you will learn how to add some of the built-in controls that are part of Avalonia. @@ -41,9 +42,8 @@ For example, you will notice that the button you just implemented is rendered h :::tip If you're using an IDE, notice how the Avalonia Intellisense guides you as you add attributes to the XAML. -
- -
+ + ::: The button should now move to the center of the window content zone (both horizontally and vertically). diff --git a/docs/get-started/test-drive/add-some-layout.md b/docs/get-started/test-drive/add-some-layout.md index 3af374b5e..bb554159e 100644 --- a/docs/get-started/test-drive/add-some-layout.md +++ b/docs/get-started/test-drive/add-some-layout.md @@ -3,6 +3,9 @@ id: add-some-layout title: Add Some Layout --- +import StackPanelDiagram from '/img/get-started/add-some-layout/image (40) (1) (1).png'; +import StackPanelSampleScreenshot from '/img/get-started/add-some-layout/image (41) (1).png'; + Avalonia provides a range of built-in controls to help you layout the visual elements of an application. On this page you will see how to use some of these layout controls. At this stage, your application has a single button located in the content zone of the main window. @@ -13,11 +16,7 @@ In fact an Avalonia window allows only a single other control in its content zon The stack panel control allows multiple controls in its content zone, and arranges them in a vertical stack in the sequence they are defined in the XAML. - - -
- -
+ ```xml @@ -49,9 +48,7 @@ To take the example forwards, add a stack panel as follows (you can include the ``` -
- -
+ :::info You can explore the other layout controls in Avalonia from the reference [here](../../reference/controls/layout-controls.md). diff --git a/docs/get-started/test-drive/create-a-project.md b/docs/get-started/test-drive/create-a-project.md index d8664668e..c07d8d36c 100644 --- a/docs/get-started/test-drive/create-a-project.md +++ b/docs/get-started/test-drive/create-a-project.md @@ -6,6 +6,13 @@ title: Create and Run a Project import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import RiderSplashScreenshot from '/img/get-started/test-drive/rider-splashscreen.png'; +import RiderSolutionScreenshot from '/img/get-started/test-drive/rider-solution.png'; +import VsFindAvaloniaTemplateScreenshot from '/img/get-started/choose-a-solution-template/image (31) (1) (1).png'; +import VsNewAvaloniaProjectScreenshot from '/img/get-started/choose-a-solution-template/image (27) (1).png'; +import RiderRunScreenshot from '/img/get-started/test-drive/rider-run.png'; +import InitialWindowScreenshot from '/img/get-started/test-drive/initial-window.png'; + ## Install Templates Before starting, ensure that you have [installed the Avalonia templates](../install.md): @@ -32,9 +39,7 @@ This will create a new folder called `GetStartedApp` containing the new project. - On the Rider startup screen, select **New Solution** -
- -
+ - In the sidebar, scroll down and select **Avalonia App** - Type `GetStartedApp` in the **Solution Name** field @@ -42,9 +47,7 @@ This will create a new folder called `GetStartedApp` containing the new project. The template will create a new solution and project. -
- -
+ @@ -53,17 +56,14 @@ The template will create a new solution and project. - Type `Avalonia` in the search box. - Click **Avalonia Application** then click **Next**. -
- -
+ - Name the project `GetStartedApp`, and click **Create**. The template will create a new solution and project. -
- -
+ +
@@ -83,9 +83,8 @@ dotnet run Press the **Run** button in the Rider toolbar: -
- -
+ + @@ -93,22 +92,17 @@ Press the **Run** button in the Rider toolbar: - Type `Avalonia` in the search box. - Click **Avalonia Application** then click **Next**. -
- -
+ - Name the project `GetStartedApp`, and click **Create**. The template will create a new solution and project. -
- -
+ +
You should now be running your first Avalonia application! -
- -
+ diff --git a/docs/get-started/test-drive/index.md b/docs/get-started/test-drive/index.md new file mode 100644 index 000000000..09c1a3e94 --- /dev/null +++ b/docs/get-started/test-drive/index.md @@ -0,0 +1,8 @@ +# Test Drive + +```mdx-code-block +import {DocsCardList} from '../../../src/components/DocsCard'; +import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; + + +``` \ No newline at end of file diff --git a/docs/get-started/test-drive/input-controls.md b/docs/get-started/test-drive/input-controls.md index 50539f384..2c6840062 100644 --- a/docs/get-started/test-drive/input-controls.md +++ b/docs/get-started/test-drive/input-controls.md @@ -3,15 +3,15 @@ id: input-controls title: Input Controls --- +import InputControlsScreenshot from '/img/get-started/test-drive/input-controls.png'; + On this page, you will learn how to add some of the Avalonia input controls in a neat layout. The aim is to add a numerical inputs with their associated labels in horizontal rows; with an output control in the row below. To achieve this layout, you will use the built-in grid control, and locate label and input controls in its cells. -This picture shows the resulting layout (running) with the gridlines showing. The gridlines are showing for the purpose of visualizing the layout - you would not usually do this on a production UI. +This picture shows the resulting layout (running) with the gridlines showing. The gridlines are showing for the purpose of visualizing the layout - you would not usually do this on a production UI. -
- Window showing input controls -
+ To create a layout using the grid control, follow this procedure: diff --git a/docs/get-started/test-drive/main-window.md b/docs/get-started/test-drive/main-window.md index 456fc69f4..94e822b34 100644 --- a/docs/get-started/test-drive/main-window.md +++ b/docs/get-started/test-drive/main-window.md @@ -3,6 +3,11 @@ id: main-window title: The Main Window --- +import LayoutZonesDiagram from '/img/gitbook-import/assets/image (25) (2) (1).png'; +import MainWindowScreenshot from '/img/get-started/the-main-window/image (15) (1) (1).png'; +import VsDesignerScreenshot from '/img/get-started/the-main-window/image (22) (1).png'; +import VsPreviewPaneScreenshot from '/img/get-started/the-main-window/image (6) (2).png'; + You can now start your tour of an Avalonia project. We'll start with the main application window. Open the **MainWindow.axaml** file. :::info @@ -13,15 +18,11 @@ Notice that in Avalonia, XAML files have the extension **.axaml** (and not .xaml In the **MainWindow.axaml** XAML file, the `...` XAML tag represents an Avalonia window. Like other Avalonia controls; the window will be drawn on the target platform with 4 **layout zones**: margin, border, padding and content. -
- -
+ In your current application, the content zone of the window has only a simple string comprising your latest message; so that is what is displayed. -
- -
+ At this stage, you do not have a margin, border or any padding defined, so the message appears right up against the top left corner of the window. @@ -33,9 +34,7 @@ For more information about the concept of control layout zones, see [here](../.. If you're using Visual Studio you should see the XAML code and preview pane. -
- -
+ :::info Notice the red exclamation icon (top left) and the message **The designer is loading...**. This indicates that the project must be built before the preview pane will respond. @@ -44,9 +43,7 @@ Notice the red exclamation icon (top left) and the message **The designer is loa - Build the project. - Scroll the preview pane to the left to view the preview outline and the text displayed in the top left corner. -
- -
+ - Locate the `Welcome to Avalonia!`message text in the XAML pane, and make a change. diff --git a/docs/get-started/test-drive/response-to-an-event.md b/docs/get-started/test-drive/response-to-an-event.md index 0d478fe5f..c17be0c27 100644 --- a/docs/get-started/test-drive/response-to-an-event.md +++ b/docs/get-started/test-drive/response-to-an-event.md @@ -3,6 +3,10 @@ id: respond-to-an-event title: Respond to an Event --- +import SolutionCodeBehindScreenshot from '/img/get-started/respond-to-an-event/image (59).png'; +import AvaloniaEventIntellisenseScreenshot from '/img/get-started/respond-to-an-event/image (25) (2).png'; +import EventDebugOutputScreenshot from '/img/get-started/respond-to-an-event/image (54).png'; + There are a number of ways you can implement actions in an Avalonia application. On this page, you will see how to use one of the simplest: how to write event handling code for a button click. To start, you will write a button click event handler that does not interact with any of the other controls. @@ -11,9 +15,7 @@ To start, you will write a button click event handler that does not interact wit The XAML file for the main window has a C# code-behind file associated with it. If you're using an IDE, you can find this file in the **Solution Explorer** - it is a sub-item of the `.axaml` file. -
- -
+ To change the code-behind for the main window: @@ -78,17 +80,13 @@ using System.Diagnostics; :::tip If you're using an IDE you will see the Avalonia UI Intellisense as you type. -
- -
+ ::: - Run the app and click the button. You should see the result on the Output window for Debug, like this: -
- -
+ On the next page, you will see how to use code-behind to read and change the properties of Avalonia UI controls at runtime. diff --git a/docs/guides/building-cross-platform-applications/dealing-with-platforms.md b/docs/guides/building-cross-platform-applications/dealing-with-platforms.md index 11f1a64cf..a61b74eb5 100644 --- a/docs/guides/building-cross-platform-applications/dealing-with-platforms.md +++ b/docs/guides/building-cross-platform-applications/dealing-with-platforms.md @@ -39,6 +39,7 @@ Supporting multiple platforms from the same code-base can be achieved through ab * **Platform Abstraction**: This approach leverages the Business Façade pattern to provide uniform access across platforms. It abstracts the unique platform implementations into a single, cohesive API. The primary advantage is the ability to write platform-agnostic code, enhancing code reusability and maintainability. However, this approach may not fully exploit the unique features and capabilities of each platform. + ## Platform Abstraction diff --git a/docs/guides/custom-controls/draw-with-a-property.md b/docs/guides/custom-controls/draw-with-a-property.md index 275409ad2..b65be2db7 100644 --- a/docs/guides/custom-controls/draw-with-a-property.md +++ b/docs/guides/custom-controls/draw-with-a-property.md @@ -3,6 +3,8 @@ id: draw-with-a-property title: Draw with a Property --- +import DrawWithPropertyScreenshot from '/img/gitbook-import/assets/image (1) (2) (2).png'; + # Draw with a Property On this page you will see how to draw a custom control, using the value for a simple property that defines the background color. The code now looks like this: @@ -48,7 +50,7 @@ This example defines a simple brush property on the custom control for the backg The drawing code uses the _Avalonia UI_ graphics context (that is passed to the render method), to draw a rectangle that is filled with the background color, and made the same size as the control (as supplied by the `Bounds.Size` object). - + Notice how the control now shows both at runtime (above) and in the preview pane. diff --git a/docs/guides/custom-controls/how-to-create-a-custom-controls-library.md b/docs/guides/custom-controls/how-to-create-a-custom-controls-library.md index c1af9d199..583d77beb 100644 --- a/docs/guides/custom-controls/how-to-create-a-custom-controls-library.md +++ b/docs/guides/custom-controls/how-to-create-a-custom-controls-library.md @@ -3,15 +3,18 @@ id: how-to-create-a-custom-controls-library title: How To Create a Custom Controls Library --- +import CustomControlsSolutionScreenshot from '/img/gitbook-import/assets/image (22) (3).png'; +import CustomControlNuGetScreenshot from '/img/gitbook-import/assets/image (11) (2).png'; + # How To Create a Custom Controls Library This guide shows you how to create a custom controls library and reference it for use in an _Avalonia UI_ app. - + In this example, a custom control file is added to a .NET class library. The library has the _Avalonia UI_ _NuGet_ package installed: - + + diff --git a/docs/guides/data-binding/how-to-bind-can-execute.md b/docs/guides/data-binding/how-to-bind-can-execute.md index b0833f335..7b91583b0 100644 --- a/docs/guides/data-binding/how-to-bind-can-execute.md +++ b/docs/guides/data-binding/how-to-bind-can-execute.md @@ -3,6 +3,7 @@ id: how-to-bind-can-execute title: How to Bind Can Execute --- +import BindCanExecuteScreenshot from '/img/gitbook-import/assets/command4.gif'; # How to Bind Can Execute @@ -86,4 +87,4 @@ Here the `WhenAnyValue` method takes two arguments, the first collects a value f The `WhenAnyValue` method actually has overloads that can take up to 10 different value getters (for the validation function parameters), plus the validation function itself. ::: - + diff --git a/docs/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md b/docs/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md index 54349a73d..cca51ee67 100644 --- a/docs/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md +++ b/docs/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md @@ -3,6 +3,7 @@ id: how-to-bind-to-a-command-with-reactiveui title: How to Bind to a Command with ReactiveUI --- +import BindReactiveCommandScreenshot from '/img/gitbook-import/assets/command.gif'; # How to Bind to a Command with ReactiveUI @@ -72,7 +73,7 @@ namespace AvaloniaGuides.ViewModels When the control bound to the reactive command is activated (in this example: when the button is clicked); then the private method to perform the action is called through the reactive command. - + ## Command Parameter diff --git a/docs/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md b/docs/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md index a890654a8..e234198b9 100644 --- a/docs/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md +++ b/docs/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md @@ -3,6 +3,8 @@ id: how-to-bind-to-a-command-without-reactiveui title: How to Bind to a Command without ReactiveUI --- +import BindCommandMethodScreenshot from '/img/gitbook-import/assets/command2.gif'; +import BindCanExecuteMethodScreenshot from '/img/gitbook-import/assets/command3.gif'; # How to Bind to a Command without ReactiveUI @@ -34,7 +36,7 @@ namespace AvaloniaGuides.ViewModels { public class MainWindowViewModel { - private void PerformAction(string msg) + public void PerformAction(object msg) { Debug.WriteLine($"The action was called. {msg}"); } @@ -42,7 +44,7 @@ namespace AvaloniaGuides.ViewModels } ``` - + ## Can Execute? @@ -59,12 +61,12 @@ namespace AvaloniaGuides.ViewModels { public class MainWindowViewModel { - private void PerformAction(string msg) + public void PerformAction(object msg) { Debug.WriteLine($"The action was called. {msg}"); } - private bool CanPerformAction(object msg) + public bool CanPerformAction(object msg) { if (msg!=null) return !string.IsNullOrWhiteSpace( msg.ToString() ); return false; @@ -92,7 +94,7 @@ This example uses the technique of binding directly to another control. You can You will see that the button becomes enables only when the text box contains a string. - + ## **Trigger Can Execute** diff --git a/docs/guides/development-guides/accessing-the-ui-thread.md b/docs/guides/development-guides/accessing-the-ui-thread.md index 50bdd039c..5d6d98342 100644 --- a/docs/guides/development-guides/accessing-the-ui-thread.md +++ b/docs/guides/development-guides/accessing-the-ui-thread.md @@ -3,6 +3,8 @@ id: accessing-the-ui-thread title: How To Access the UI Thread --- +import DispatchPostLongRunningScreenshot from '/img/gitbook-import/assets/long1.gif'; +import DispatchInvokeAsyncLongRunningScreenshot from '/img/gitbook-import/assets/long2.gif'; # How To Access the UI Thread @@ -24,7 +26,7 @@ Use `InvokeAsync` when you need to wait for the result, and potentially want to ## Dispatcher Priority -Both of the above methods have a dispatcher priority parameter. You can use this with the `DispatcherPriority` enumeration to specify the queue priority that the given job should be given. +Both of the above methods have a dispatcher priority parameter. You can use this with the `DispatcherPriority` enumeration to specify the queue priority that the given job should be given. :::info For the possible values of the `DispatcherPriority` enumeration, see [here](http://reference.avaloniaui.net/api/Avalonia.Threading/DispatcherPriority/). @@ -64,7 +66,7 @@ private void ButtonClickHandler(object sender, RoutedEventArgs e) } ``` - + Notice that because the long running task is executed on its own thread, the UI does not lose responsiveness. @@ -74,7 +76,7 @@ To get a result from the long running task, the XAML is the same, but this versi ``` -Take some time to examine the binding that you added to the button. +Take some time to examine the binding that you added to the button. -Firstly, the `Command` property defines a method to be called whenever the button is clicked. +Firstly, the `Command` property defines a method to be called whenever the button is clicked. Then the binding gives the exact **binding path** to the method using a binding source expression: @@ -113,9 +115,9 @@ Then the binding gives the exact **binding path** to the method using a binding $parent[Window].DataContext.AddItem ``` -The **binding source expression** redirects the source of the binding. The _Avalonia UI_ binding system will use the source in the expression, instead of the control's data context. +The **binding source expression** redirects the source of the binding. The _Avalonia UI_ binding system will use the source in the expression, instead of the control's data context. -In this case the expression is looking for any parent of the control with the type `Window`. It will then use that control's data context to call the `AddItem` method. +In this case the expression is looking for any parent of the control with the type `Window`. It will then use that control's data context to call the `AddItem` method. :::info For information about the concept of binding source expressions, see [here](../../basics/data/data-binding/data-binding-syntax). @@ -125,22 +127,14 @@ For information about the concept of binding source expressions, see [here](../. Now If you run the application and click **Add Item**, you will see the new view appear. -
- -
- -
- -
- -
+ -
+ -Have noticed something about this behaviour? The main window swaps the view model bound to its content zone, and the display correctly loads the add item view! +Have noticed something about this behaviour? The main window swaps the view model bound to its content zone, and the display correctly loads the add item view! :::info -In _Avalonia UI_ you can call a simple method on the view model directly like this. You will see later in this tutorial a scenario where you must use a different implementation. +In _Avalonia UI_ you can call a simple method on the view model directly like this. You will see later in this tutorial a scenario where you must use a different implementation. ::: -On the next page you will learn how this is happening due to the presence of the view locator. +On the next page you will learn how this is happening due to the presence of the view locator. diff --git a/docs/tutorials/todo-list-app/process-a-new-item.md b/docs/tutorials/todo-list-app/process-a-new-item.md index 4a881b069..6e252c391 100644 --- a/docs/tutorials/todo-list-app/process-a-new-item.md +++ b/docs/tutorials/todo-list-app/process-a-new-item.md @@ -6,7 +6,7 @@ description: TUTORIALS - To Do List App On this page you will learn how to process the output from the OK and cancel buttons being pressed and re-show the list. If OK was pressed we also need to add the new item to the list. We'll implement this functionality in `MainWindowViewModel`: -To alter the add item view model, follow this procedure: +To alter the main window view model, follow this procedure: - Stop the app if it is running. - Locate the **MainWindowViewModel.cs** file in the **/ViewModels** folder. @@ -80,8 +80,8 @@ The merge method combines the output from any number of observable streams, but You will remember that the two reactive command declarations were different. They were: ```csharp -public ReactiveCommand Ok { get; } -public ReactiveCommand Cancel { get; } +public ReactiveCommand OkCommand { get; } +public ReactiveCommand CancelCommand { get; } ``` The OK command generates an object of class `ToDoItem` whenever it executes, and the cancel command generates only a `Unit`. The `Unit` is the reactive version of `void` - it means the command generates no value, but still notifies that it has happened! @@ -101,16 +101,16 @@ You are only interested in the first click of either the OK or cancel buttons; o { ToDoListViewModel.ListItems.Add(newItem); } - ContentViewModel = ToDoListViewModel; + ContentViewModel = ToDoList; }); ``` -Lastly the code subscribes to the first item the merged observable sequence. The subscribe pulls out the new to do item object, and examines it to see it it is null. +Lastly the code subscribes to the first item in the merged observable sequence. The subscribe pulls out the new to do item object, and examines it to see it it is null. A null value means that the cancel button was clicked - and no further action is required; except to restore the main window content to show the (unchanged) to do list. ```csharp -ContentViewModel = ToDoListViewModel; +ContentViewModel = ToDoList; ``` If the value is not null, then it is because the OK button was clicked; and in this case the value should be a `ToDoItem` containing the description that the user typed. SO this can be added to the list. diff --git a/docs/tutorials/todo-list-app/wiring-up-the-views.md b/docs/tutorials/todo-list-app/wiring-up-the-views.md index 969335374..9cd8405d9 100644 --- a/docs/tutorials/todo-list-app/wiring-up-the-views.md +++ b/docs/tutorials/todo-list-app/wiring-up-the-views.md @@ -2,6 +2,9 @@ description: TUTORIALS - To Do List App --- +import ToDoDataContextWiringDiagram from '/img/gitbook-import/assets/image (7) (3).png'; +import ToDoBlankAfterWiringScreenshot from '/img/gitbook-import/assets/image (42) (2).png'; + # Data Binding Now that you have the view model and model (data service) connected, the next step is to link the views and view models, so the list of items can be displayed. @@ -46,7 +49,7 @@ Take some time here to examine the code that you just added: The items control `` repeats its display for each item in a collection source that is defined by the `ItemsSource` attribute. Here the data binding expression `{Binding ListItems}` means we are looking for a data context with this property name. -How each item is in a displayed inside the items control is controlled by the item template <`ItemTemplate>`. This can be any combination of controls, but in this example it is a **data template** is being used. +How each item is displayed inside the items control is controlled by the item template <`ItemTemplate>`. This can be any combination of controls, but in this example a **data template** is being used. :::info You can review the data template concept [here](../../concepts/templates/). @@ -56,14 +59,10 @@ The built-in controls inside the data template will expect to find the propertie So the arrangement of views and view models so far looks like this: -
- -
+ This will work if any parent of the items control has a data context object having a`ListItems` property. The _Avalonia UI_ binding will search upwards in the control tree to locate a suitable data context. But although the main window data context has been set (during the app initialization - see the file **App.axaml.cs**), at this point there is still no data context with a `ListItems` property. So if you run your app, the list is still blank! -
- -
+ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json b/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json index c4b878a40..b81756729 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current.json @@ -119,6 +119,10 @@ "message": "数据模板", "description": "The label for category Data Templates in sidebar documentationSidebar" }, + "sidebar.documentationSidebar.category.Headless": { + "message": "Headless", + "description": "The label for category Headless Custom in sidebar documentationSidebar" + }, "sidebar.documentationSidebar.category.Input": { "message": "输入", "description": "The label for category Input in sidebar documentationSidebar" diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/compiled-bindings.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/compiled-bindings.md index c28e2f7b4..4ac21da0b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/compiled-bindings.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/compiled-bindings.md @@ -11,9 +11,25 @@ description: CONCEPTS ## 启用和禁用编译绑定 +:::info + +根据创建 Avalonia 项目时使用的模板,默认情况下可能启用也可能不启用编译绑定。您可以在项目文件中查看。 + +::: + +### 全局启用和禁用 + +如果您希望应用程序默认情况下全局使用编译绑定,可以将以下内容添加到您的项目文件中: + +```markup +true +``` + +您仍然需要为您想要绑定的对象提供`x:DataType`,但是您不需要为每个`UserControl`或`Window`设置`x:CompileBindings="[True|False]"`。 + ### 在每个UserControl或Window中启用和禁用 -编译绑定默认未启用。要启用编译绑定,您需要首先定义要绑定的对象的`DataType`。在[`DataTemplates`](../data-templates)中,有一个`DataType`属性,对于所有其他元素,您可以通过`x:DataType`来设置它。最可能在根节点中设置`x:DataType`,例如在`Window`或`UserControl`中。您还可以直接在`Binding`中指定`DataType`。 +要启用编译绑定,您需要首先定义要绑定的对象的`DataType`。在[`DataTemplates`](../data-templates)中,有一个`DataType`属性,对于所有其他元素,您可以通过`x:DataType`来设置它。最可能在根节点中设置`x:DataType`,例如在`Window`或`UserControl`中。您还可以直接在`Binding`中指定`DataType`。 现在,您可以通过设置`x:CompileBindings="[True|False]"`来启用或禁用编译绑定。所有子节点都将继承此属性,因此您可以在根节点中启用它,并在需要时禁用特定子节点。 @@ -39,16 +55,6 @@ description: CONCEPTS ``` -### 全局启用和禁用 - -如果您希望应用程序默认情况下全局使用编译绑定,可以将以下内容添加到您的项目文件中: - -```markup -true -``` - -您仍然需要为您想要绑定的对象提供`x:DataType`,但是您不需要为每个`UserControl`或`Window`设置`x:CompileBindings="[True|False]"`。 - ## CompiledBinding标记 如果您不希望为所有子节点启用编译绑定,还可以使用`CompiledBinding`标记。您仍然需要定义`DataType`,但可以省略`x:CompileBindings="True"`。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/data-context.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/data-context.md index 2b0cbdaea..b01b3607e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/data-context.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/data-context.md @@ -2,17 +2,22 @@ description: CONCEPTS --- +import DataContextBindingOverviewDiagram from '/img/gitbook-import/assets/image (56).png'; +import DataContextTreeSearchDiagram from '/img/gitbook-import/assets/image (62).png'; +import DataContextContentBindingScreenshot from '/img/gitbook-import/assets/image (20) (2).png'; +import DataContextPreviewerScreenshot from '/img/gitbook-import/assets/image (40) (1).png' + # 数据上下文 当Avalonia执行数据绑定时,它必须定位要绑定的应用程序对象。这个位置由**数据上下文**表示。 - + Avalonia中的每个控件都有一个名为`DataContext`的属性,包括内置控件、用户控件和窗口。 在绑定时,Avalonia会从逻辑控件树中进行分层搜索,从定义绑定的控件开始,直到找到要使用的数据上下文。 - + 这意味着在窗口中定义的控件可以使用窗口的数据上下文;或者(如上所示),在窗口中的控件中定义的控件可以使用窗口的数据上下文。 @@ -72,13 +77,13 @@ public class MainWindowViewModel : ViewModelBase 项目运行时,数据绑定器从文本块开始向上搜索逻辑控件树,找到在主窗口级别设置的数据上下文。因此,绑定的文本显示为: - + ## 设计时数据上下文 您可能已经注意到,在首次编译此项目后,预览窗格也显示了问候语。 - + 这是因为Avalonia还可以为控件设置设计时数据上下文。这对您非常有用,因为这意味着预览窗格在您调整布局和样式时可以显示一些真实的数据。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/index.md index 7e00d76ac..3ec6e31f7 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-binding/index.md @@ -2,11 +2,13 @@ description: CONCEPTS --- +import DataBindingBasicOverviewDiagram from '/img/gitbook-import/assets/image (31) (1).png'; + # 数据绑定 Avalonia使用数据绑定将数据从应用程序对象传递到UI控件,根据用户输入更改应用程序对象中的数据,并在响应用户命令时对应用程序对象进行操作。 - + 在这种安排中,控件是**绑定目标**,而对象是**数据源**。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-templates.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-templates.md index 96c6005de..0453a9074 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-templates.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/data/data-templates.md @@ -25,7 +25,7 @@ title: 数据模板
- + ``` 在这个例子中,数据模板定义了一个使用`StackPanel`容器的可视化布局。在`StackPanel`中,我们有一个绑定到项的`Name`属性的`TextBlock`,以及一个绑定到`ImageSource`属性的`Image`控件。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/animations.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/animations.md index 792eafd41..6f88906e1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/animations.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/animations.md @@ -3,6 +3,8 @@ id: animations title: 动画 --- +import AnimationKeyframeDiagram from '/img/gitbook-import/assets/image (2) (1) (4).png'; + # 动画 _Avalonia UI_ 中有两种类型的动画: @@ -14,7 +16,7 @@ _Avalonia UI_ 中有两种类型的动画: 最简单的关键帧动画将在指定的持续时间内通过在开始时(持续时间的0%)和结束时(持续时间的100%)定义两个关键帧来更改一个属性的值。 - + 然后,属性值在关键帧之间随时间改变,使用由缓动函数定义的配置文件。默认的缓动函数也是最简单的 - 在两个关键帧之间进行直线插值。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/assets.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/assets.md index 9b6647387..30bcafda0 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/assets.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/assets.md @@ -3,13 +3,16 @@ id: assets title: 资产和图像 --- +import AssetIncludeFileAssetDiagram from '/img/gitbook-import/assets/image (8).png'; +import AssetIncludeLibraryAssetDiagram from '/img/gitbook-import/assets/image.png'; + # 资产(Assets) 许多应用程序需要包含位图、样式和资源字典等资产。资源字典包含可以在XAML中声明的图形基础元素。样式也可以用XAML编写,但位图资产是二进制文件,例如PNG和JPEG格式的图像。 ## 包含资产 - + 您可以通过在项目文件中使用``元素来将资产包含在应用程序中。 @@ -46,7 +49,7 @@ title: 资产和图像 ## 库资产 - + 如果资产包含在与XAML文件不同的程序集中,则可以使用 `avares:` URI方案。例如,如果资产包含在名为`MyAssembly.dll`的程序集中的`Assets`文件夹中,则可以使用: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/alignment-margins-and-padding.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/alignment-margins-and-padding.md index 565e13266..a862b4e5e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/alignment-margins-and-padding.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/alignment-margins-and-padding.md @@ -1,3 +1,9 @@ +import LayoutMarginsPaddingAlignmentBasicScreenshot from '/img/gitbook-import/assets/layout-margins-padding-alignment-graphic1.png'; +import LayoutMarginsPaddingAlignmentBasicAnnotatedScreenshot from '/img/gitbook-import/assets/layout-margins-padding-alignment-graphic2.png'; +import LayoutHorizontalAlignmentScreenshot from '/img/gitbook-import/assets/layout-horizontal-alignment-graphic.png'; +import LayoutVerticalAlignmentScreenshot from '/img/gitbook-import/assets/layout-vertical-alignment-graphic.png'; +import LayoutMarginsPaddingAlignmentComplexAnnotatedScreenshot from '/img/gitbook-import/assets/layout-margins-padding-aligment-graphic3.png'; + # Alignment、Margin 和 Padding Avalonia 控件暴露了用于精确定位子元素的几个属性。本章节讨论了四个最重要的属性:`HorizontalAlignment`、`Margin`、`Padding`和`VerticalAlignment`。理解这些属性的效果很重要,因为它们是控制元素在Avalonia应用程序中的位置的基础。 @@ -8,7 +14,7 @@ Avalonia定位元素有许多使用方式。然而,实现理想的布局不仅 下图展示了一个使用了多个定位属性的布局方案。 -Positioning Example +Positioning Example 乍一看,本图中的`Button`元素可能是随机放置的。然而,它们的位置实际上是通过组合使用边距(margin)、对齐(alignment)和填充(padding)来精确控制的。 @@ -42,7 +48,7 @@ Avalonia定位元素有许多使用方式。然而,实现理想的布局不仅 下图提供了上述示例中使用的各种定位属性的全貌图。本章节的后续部分会更详细地描述如何使用每个定位属性。 -Positioning Properties +Positioning Properties ### 理解Alignment属性 @@ -72,7 +78,7 @@ Avalonia定位元素有许多使用方式。然而,实现理想的布局不仅 前面的代码生成了与下图类似的布局。每种`HorizontalAlignment`值的定位效果在图中可见。 -HorizontalAlignment Sample +HorizontalAlignment Sample #### VerticalAlignment属性 @@ -112,7 +118,7 @@ Avalonia定位元素有许多使用方式。然而,实现理想的布局不仅 前面的代码生成了与下图类似的布局。每种`VerticalAlignment`值的定位效果在图中可见。 -VerticalAlignment property sample +VerticalAlignment property sample ### 理解Margin属性 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/panels-overview.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/panels-overview.md index 66895c4b2..7768a2e0a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/panels-overview.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/building-layouts/panels-overview.md @@ -1,6 +1,13 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CanvasOverlapScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/CanvasExample.png'; +import DockPanelSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/DockPanelExample.png'; +import GridSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/GridExample.png'; +import StackPanelSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/StackPanelExample.png'; +import WrapPanelSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/WrapPanelExample.png'; +import UniformGridSampleScreenshot from '/img/basics/user-interface/building-layouts/panels-overview/UniformGridExample.png'; + # Panels Overview `Panel` 元素是控制元素的呈现方式的组件,包括元素的大小和尺寸、位置以及子内容的排列。_Avalonia UI_ 提供了许多预定义的 `Panel` 元素,同时也支持构建自定义的 `Panel` 元素。 @@ -41,9 +48,7 @@ Avalonia 中有几个优化支持 UI 场景的面板类:`Panel`、`Canvas`、` 使用 XAML 或代码可以简单地实例化一个 `Canvas`。下面的示例演示了如何使用 `Canvas` 来绝对定位内容。该代码生成了三个大小为 100 像素的正方形。第一个正方形为红色,其左上角的 (x, y) 位置被指定为 (0, 0)。第二个正方形为绿色,其左上角位置为 (100, 100),刚好在第一个正方形的右下方。第三个正方形为蓝色,其左上角位置为 (50, 50),因此覆盖了第一个正方形的右下象限和第二个正方形的左上象限。由于第三个正方形是最后布局的,它出现在其他两个正方形的上方,即重叠部分采用第三个正方形的颜色。 -
- StackPanel Example -
+StackPanel Example - StackPanel Example - +StackPanel Example - Grid Example App - +Grid Example App - StackPanel Example - +StackPanel Example - StackPanel Example - +StackPanel Example

code-behind文件包含一个与XAML文件同名的类。例如: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/controls/builtin-controls.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/controls/builtin-controls.md index 923a966ba..3eb45a4e8 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/controls/builtin-controls.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/controls/builtin-controls.md @@ -56,14 +56,15 @@ ## 值选择 -| 控件 | 类型 | 描述 | -|:--------------------------------------------------------------------------------------------------------|:---------|:------------------------------------------------------------------------| -| [Check Box](../../../reference/controls/checkbox.md) | Boolean | 以勾选标记形式表示的 True 值。点击交互切换值。具有显示“未知”值的选项。 | -| [Slider](../../../reference/controls/slider.md) | Double | 相对于最大值和最小值的相对值,以滑动条按钮在滑动条轨道上的位置表示。拖动滑动条按钮可以在最大值和最小值之间更改值。键盘和点击交互也可以微调值。 | -| [Calendar](../../../reference/controls/detailed-reference/calendar) | DateTime | 日历是用户选择日期或日期范围的控件。 | -| [Calendar Date Picker](../../../reference/controls/detailed-reference/calendar/calendar-date-picker.md) | DateTime | 日期选择器的扩展,包括文本框和按钮。 | -| [Date Picker](../../../reference/controls/datepicker.md) | DateTime | 日期选择器有三个“微调”控件,允许用户选择日期值。 | -| [Time Picker](../../../reference/controls/detailed-reference/timepicker.md) | TimeSpan | 时间选择器有三个“微调”控件,允许用户选择小时、分钟和秒钟。 | +| 控件 | 类型 | 描述 | +|:--------------------------------------------------------------------------------------------------------|:-----------------|:------------------------------------------------------------------------| +| [Check Box](../../../reference/controls/checkbox.md) | Boolean | 以勾选标记形式表示的 True 值。点击交互切换值。具有显示“未知”值的选项。 | +| [Slider](../../../reference/controls/slider.md) | Double | 相对于最大值和最小值的相对值,以滑动条按钮在滑动条轨道上的位置表示。拖动滑动条按钮可以在最大值和最小值之间更改值。键盘和点击交互也可以微调值。 | +| [Calendar](../../../reference/controls/detailed-reference/calendar) | DateTime | 日历是用户选择日期或日期范围的控件。 | +| [Calendar Date Picker](../../../reference/controls/detailed-reference/calendar/calendar-date-picker.md) | DateTime | 日期选择器的扩展,包括文本框和按钮。 | +| [Color Picker](../../../reference/controls/colorpicker) | Color / HsvColor | 颜色选择器支持用户使用光谱、调色板和组件滑块选择和编辑颜色。它还支持可选的 alpha 分量、RGB 或 HSV 颜色模型和十六进制颜色值。 | +| [Date Picker](../../../reference/controls/datepicker.md) | DateTime | 日期选择器有三个“微调”控件,允许用户选择日期值。 | +| [Time Picker](../../../reference/controls/detailed-reference/timepicker.md) | TimeSpan | 时间选择器有三个“微调”控件,允许用户选择小时、分钟和秒钟。 | ## 显示图像 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/control-themes.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/control-themes.md index 523c6b15d..c2fa2c71e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/control-themes.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/control-themes.md @@ -3,6 +3,8 @@ id: control-themes title: 控件主题(Control Themes) --- +import StylingEllipseButtonScreenshot from '/img/basics/user-interface/styling/ellipse-button.png'; + 控件主题是在[样式](Styles)的基础上构建的,用于为控件创建可切换的主题。尽管控件主题与 WPF/UWP 中的样式类似,但它们的机制略有不同。 :::tip @@ -75,7 +77,7 @@ title: 控件主题(Control Themes) ``` -![椭圆形按钮](/img/basics/user-interface/styling/ellipse-button.png) +

椭圆形按钮

## 控件主题中的交互 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/styles.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/styles.md index d7549dc15..84835a6c9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/styles.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/styles.md @@ -3,6 +3,8 @@ id: styles title: 样式 --- +import StyleH1SampleScreenshot from '/img/gitbook-import/assets/image (5) (5).png'; + # 样式 _Avalonia UI_ 的样式系统是一种可以在控件之间共享属性设置的机制。 @@ -58,7 +60,7 @@ _Avalonia UI_ **样式选择器语法** 类似于 CSS(层叠样式表)中使 在此示例中,所有带有 `h1` 样式类的 `TextBlock` 元素将显示为样式设置的字体大小和字重。这在预览面板中工作: - + ## 放置样式的位置 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/themes/fluent.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/themes/fluent.md index 9f5b2984d..a0b2a33da 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/themes/fluent.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/basics/user-interface/styling/themes/fluent.md @@ -3,11 +3,14 @@ id: fluent title: Fluent 主题 --- +import FluentThemeNormalScreenshot from '/img/basics/user-interface/styling/fluent-theme-normal.png'; +import FluentThemeForestScreenshot from '/img/basics/user-interface/styling/fluent-theme-forest.png'; + ## Introduction Avalonia Fluent 主题受到微软的 Fluent Design System 的启发,该系统是一组用于创建视觉吸引力和交互式用户界面的设计指南和组件。Fluent Design System 强调现代、清晰的美学,平滑的动画和直观的交互。它在不同平台上提供了一致而精致的外观和感觉,同时为开发人员提供了我们的样式系统的灵活性。 -![Fluent 主题](/img/basics/user-interface/styling/fluent-theme-normal.png) +

Fluent 主题

## 如何使用 @@ -102,4 +105,4 @@ Microsoft Fluent Theme Editor 已移植到 Avalonia,现在也可以与我们 6. 提供几个快速启动预设。 以下是使用 Forest 调色板预设的 FluentTheme 示例: -![Fluent 主题 Forest 调色板](/img/basics/user-interface/styling/fluent-theme-forest.png) \ No newline at end of file +

Fluent 主题 Forest 调色板

\ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community.md index 687dc15d2..e66fb5348 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community.md @@ -1,7 +1,13 @@ # 社区支持 +import TelegramLogoScreenshot from '/img/gitbook-import/assets/image (7) (1) (1).png'; +import GitterLogoScreenshot from '/img/gitbook-import/assets/image (38) (1) (1).png'; +import GitterChatScreenshot from '/img/gitbook-import/assets/image (37) (1) (1).png'; + ## Telegram + + 您也可以使用 Telegram 应用程序访问 Avalonia 聊天室(推荐使用以获得最佳体验)。 :::info @@ -10,15 +16,14 @@ ## Gitter - + 我们在 Gitter 平台上运营一个英语聊天室。 - + :::info 您可以在[这里](https://gitter.im/AvaloniaUI/Avalonia)使用 Gitter 在浏览器中访问聊天室。 ::: - diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/control-trees.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/control-trees.md index 3f2c6eb13..206e6631e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/control-trees.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/control-trees.md @@ -2,6 +2,10 @@ description: CONCEPTS --- +import ControlTreesLogicalScreenshot from '/img/gitbook-import/assets/image (61).png'; +import ControlTreesVisualScreenshot from '/img/gitbook-import/assets/image (15) (2).png'; +import ControlTreesEventScreenshot from '/img/gitbook-import/assets/image (1) (1) (2).png'; + # 控件树 _Avalonia UI_ 从应用程序的 XAML 文件中创建控件树,以便能够渲染 UI 并管理应用程序的功能。 @@ -10,7 +14,7 @@ _Avalonia UI_ 从应用程序的 XAML 文件中创建控件树,以便能够渲 逻辑控件树以 XAML 中定义的层次结构表示应用程序控件(包括主窗口)。例如:窗口中的一个控件(按钮)在另一个控件(堆栈面板)内部,将形成一个三层的逻辑树。 - + 在应用程序运行时,您可以打开 _Avalonia Dev Tools_ 窗口(按 F12 键)。这将在其 **逻辑树** 选项卡上显示逻辑树。 @@ -18,7 +22,7 @@ _Avalonia UI_ 从应用程序的 XAML 文件中创建控件树,以便能够渲 可视控件树包含 _Avalonia UI_ 实际运行的所有内容。它显示了控件上设置的所有属性,以及 _Avalonia UI_ 添加的所有额外部分,以呈现 UI 并管理应用程序的功能。 - + 您可以在 _Avalonia Dev Tools_ 窗口的 **可视树** 选项卡上查看可视控件树。 @@ -26,4 +30,4 @@ _Avalonia UI_ 从应用程序的 XAML 文件中创建控件树,以便能够渲 _Avalonia UI_ 执行应用程序功能管理的一个重要部分是事件的生成和传播。**事件** 选项卡记录了事件的源和传播,当您在运行的应用程序中移动或与其交互时。 - \ No newline at end of file + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-custom.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-custom.md new file mode 100644 index 000000000..9e9dcd84d --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-custom.md @@ -0,0 +1,81 @@ +--- +id: headless-custom +title: Manual Setup of Headless Platform +--- + +:::warning +This page explains an advanced usage scenario with the Headless platform. +We recommend using the [XUnit](headless-xunit.md) or [NUnit](headless-nunit.md) testing frameworks instead. +::: + +## Install Packages + +To set up the Headless platform, you need to install two packages: +- [Avalonia.Headless](https://www.nuget.org/packages/Avalonia.Headless), which also includes Avalonia. +- [Avalonia.Themes.Fluent](https://www.nuget.org/packages/Avalonia.Themes.Fluent), as even headless controls need a theme. + +:::tip +The Headless platform doesn't require any specific theme, and it is possible to swap FluentTheme with any other. +::: + +## Setup Application + +As in any other Avalonia app, an `Application` instance needs to be created, and themes need to be applied. When using the Headless platform, the setup is not much different from a regular Avalonia app and can mostly be reused. + +```xml title=App.axaml + + + + + +``` + +And the code: + +```csharp title=App.axaml.cs +using Avalonia; +using Avalonia.Headless; + +public class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } +} +``` + +## Run Headless Session + +```csharp title=Program.cs +using Avalonia.Controls; +using Avalonia.Headless; + +// Start Headless session passing Application type. +using var session = HeadlessUnitTestSession.StartNew(typeof(App)); + +// Since the Headless session has its own thread internally, we need to dispatch actions there: +await session.Dispatch(() => +{ + // Setup controls: + var textBox = new TextBox(); + var window = new Window { Content = textBox }; + + // Open window: + window.Show(); + + // Focus text box: + textBox.Focus(); + + // Simulate text input: + window.KeyTextInput("Hello World"); + + // Assert: + if (textBox.Text != "Hello World") + { + throw new Exception("Assert"); + } +}, CancellationToken.None); +``` \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-nunit.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-nunit.md new file mode 100644 index 000000000..e534218b6 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-nunit.md @@ -0,0 +1,91 @@ +--- +id: headless-nunit +title: Headless Testing with NUnit +--- + +## Preparation + +This page assumes that NUnit project was already created. +If not, please follow NUnit "Getting Started" and "Installation" here https://docs.nunit.org/articles/nunit/getting-started/installation.html. + +## Install packages + +Aside from NUnit packages, we need to install two more packages: +- [Avalonia.Headless.NUnit](https://www.nuget.org/packages/Avalonia.Headless.NUnit) which also includes Avalonia. +- [Avalonia.Themes.Fluent](https://www.nuget.org/packages/Avalonia.Themes.Fluent) as even headless controls need a theme + +:::tip +Headless platform doesn't require any specific theme, and it is possible to swap FluentTheme with any other. +::: + +## Setup Application +As in any other Avalonia app, an `Application` instance needs to be created, and themes need to be applied. When using the Headless platform, the setup is not much different from a regular Avalonia app and can mostly be reused. + +```xml title=App.axaml + + + + + +``` + +And the code: + +```csharp title=App.axaml.cs +using Avalonia; +using Avalonia.Headless; + +public class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } +} +``` + +:::note +Usually, the `BuildAvaloniaApp` method is defined in the Program.cs file, but NUnit/XUnit tests don't have it, so it is defined in the `App` file instead. +::: + +## Initialize NUnit Tests + +The `[AvaloniaTestApplication]` attribute wires the tests in the current project with the specific application. It needs to be defined once per project in any file. + +```csharp +[assembly: AvaloniaTestApplication(typeof(TestAppBuilder))] + +public class TestAppBuilder +{ + public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() + .UseHeadless(new AvaloniaHeadlessPlatformOptions()); +} +``` + +## Test Example + +```csharp +[AvaloniaTest] +public void Should_Type_Text_Into_TextBox() +{ + // Setup controls: + var textBox = new TextBox(); + var window = new Window { Content = textBox }; + + // Open window: + window.Show(); + + // Focus text box: + textBox.Focus(); + + // Simulate text input: + window.KeyTextInput("Hello World"); + + // Assert: + Assert.AreEqual("Hello World", textBox.Text); +} +``` + +Instead of the typical `[Test]` attribute, we need to use `[AvaloniaTest]` as it sets up the UI thread. Similarly, instead of `[Theory]`, there is a `[AvaloniaTheory]` attribute. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-xunit.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-xunit.md new file mode 100644 index 000000000..07e4859f9 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/headless-xunit.md @@ -0,0 +1,91 @@ +--- +id: headless-xunit +title: Headless Testing with XUnit +--- + +## Preparation + +This page assumes that XUnit project was already created. +If not, please follow XUnit "Getting Started" and "Installation" here https://xunit.net/docs/getting-started/netfx/visual-studio. + +## Install packages + +Aside from XUnit packages, we need to install two more packages: +- [Avalonia.Headless.XUnit](https://www.nuget.org/packages/Avalonia.Headless.XUnit) which also includes Avalonia. +- [Avalonia.Themes.Fluent](https://www.nuget.org/packages/Avalonia.Themes.Fluent) as even headless controls need a theme + +:::tip +Headless platform doesn't require any specific theme, and it is possible to swap FluentTheme with any other. +::: + +## Setup Application +As in any other Avalonia app, an `Application` instance needs to be created, and themes need to be applied. When using the Headless platform, the setup is not much different from a regular Avalonia app and can mostly be reused. + +```xml title=App.axaml + + + + + +``` + +And the code: + +```csharp title=App.axaml.cs +using Avalonia; +using Avalonia.Headless; + +public class App : Application +{ + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } +} +``` + +:::note +Usually, the `BuildAvaloniaApp` method is defined in the Program.cs file, but NUnit/XUnit tests don't have it, so it is defined in the `App` file instead. +::: + +## Initialize XUnit Tests + +The `[AvaloniaTestApplication]` attribute wires the tests in the current project with the specific application. It needs to be defined once per project in any file. + +```csharp +[assembly: AvaloniaTestApplication(typeof(TestAppBuilder))] + +public class TestAppBuilder +{ + public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() + .UseHeadless(new AvaloniaHeadlessPlatformOptions()); +} +``` + +## Test Example + +```csharp +[AvaloniaFact] +public void Should_Type_Text_Into_TextBox() +{ + // Setup controls: + var textBox = new TextBox(); + var window = new Window { Content = textBox }; + + // Open window: + window.Show(); + + // Focus text box: + textBox.Focus(); + + // Simulate text input: + window.KeyTextInput("Hello World"); + + // Assert: + Assert.Equal("Hello World", textBox.Text); +} +``` + +Instead of the typical `[Fact]` attribute, we need to use `[AvaloniaFact]` as it sets up the UI thread. Similarly, instead of `[Theory]`, there is a `[AvaloniaTheory]` attribute. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/index.md new file mode 100644 index 000000000..bf04e50f0 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/headless/index.md @@ -0,0 +1,163 @@ +--- +id: index +title: Headless Platform +--- + +## Introduction +The headless platform in AvaloniaUI provides the capability to run Avalonia applications without a visible graphical user interface (GUI). This allows for testing and automation scenarios on systems that lack a graphical environment, such as servers or continuous integration/continuous deployment (CI/CD) environments. + +By utilizing the headless platform, you can perform UI testing, execute application scenarios, and validate functionality in a headless environment, saving time and resources compared to manual testing. + +## Getting Started + +While the Headless platform can be initialized without any dependencies, for convenience, we have created integration packages for common unit testing platforms: + +- [Headless Testing with XUnit](./headless-xunit) +- [Headless Testing with NUnit](./headless-nunit) +- If you are using another platform or need more control: [Manual setup of the Headless platform](./headless-custom) + +## Simulating User Input + +As the headless platform doesn't have any real input, every event needs to be raised from the unit test. The Avalonia.Headless package is shipped with a number of helper methods that can be used: + +#### `Window.KeyPress(Key key, RawInputModifiers modifiers)` + +Simulates a keyboard press on the headless window/toplevel. + +#### `Window.KeyRelease(Key key, RawInputModifiers modifiers)` + +Simulates a keyboard release on the headless window/toplevel. + +#### `Window.KeyTextInput(string text)` + +Simulates a text input event on the headless window/toplevel. + +:::note +This event is independent of KeyPress and KeyRelease. If you need to simulate text input to a TextBox or a similar control, please use KeyTextInput. +::: + +#### `Window.MouseDown(Point point, MouseButton button, RawInputModifiers modifiers)` + +Simulates a mouse down event on the headless window/toplevel. + +:::note +In the headless platform, there is a single mouse pointer. There are no helper methods for touch or pen input. +::: + +#### `Window.MouseMove(Point point, MouseButton button, RawInputModifiers modifiers)` + +Simulates a mouse move event on the headless window/toplevel. + +#### `Window.MouseUp(Point point, MouseButton button, RawInputModifiers modifiers)` + +Simulates a mouse up event on the headless window/toplevel. + +#### `Window.MouseWheel(Point point, Vector delta, RawInputModifiers modifiers)` + +Simulates a mouse wheel event on the headless window/toplevel. + +#### `Window.DragDrop(Point point, RawDragEventType type, DataObject data, DragDropEffects effects, RawInputModifiers modifiers)` + +Simulates a drag and drop target event on the headless window/toplevel. This event simulates a user moving files from another app to the current app. + +A simple button click test is a typical example where these methods can be used: + +```csharp +// Create window and button: +var button = new Button +{ + HorizontalAlignment = HorizontalAlignment.Stretch, + VerticalAlignment = VerticalAlignment.Stretch +}; +var window = new Window +{ + Width = 100, + Height = 100, + Content = button +}; + +// Subscribe to the button click event: +var buttonClicked = false; +button.Click += (_, _) => buttonClicked = true; + +// Show the window: +window.Show(); + +// Simulate mouse events with a click (mouse down + up): +window.MouseDown(new Point(50, 50), MouseButton.Left); +window.MouseUp(new Point(50, 50), MouseButton.Left); + +// Assert that the button was clicked: +Assert.True(buttonClicked); +``` + +:::tip +Just like in any other Avalonia application, it's also possible to raise events directly. For example, with button click `button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent))`. This can be more convenient for most use cases but lacks some flexibility with input parameters. +::: + +## Capturing the Last Rendered Frame + +By default, the Headless platform doesn't render anything and instead has a fake/headless drawing backend enabled. However, it is possible to enable the Skia renderer and use it to capture the last rendered frame, which can be compared with an expected image or used in another way. + +To enable the Skia renderer, adjust the AppBuilder code as follows: + +```csharp title=App.axaml.cs +public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() + .UseSkia() // enable Skia renderer + .UseHeadless(new AvaloniaHeadlessPlatformOptions + { + UseHeadlessDrawing = false // disable headless drawing + }); +``` + +With the real renderer enabled, you can use the `Window.CaptureRenderedFrame` helper method: + +```csharp +var window = new Window +{ + Content = new TextBlock + { + Text = "Hello World" + } +}; +window.Show(); + +var frame = window.CaptureRenderedFrame(); +frame.Save("file.png"); +``` + +:::tip +The `CaptureRenderedFrame` method returns a WriteableBitmap, allowing you to lock it and read pixel data that can be compared in memory. +::: + +## Simulating User Delay + +In real UI applications, there is always some delay between user interactions, which gives the operating system time to run various tasks in the application. These tasks are often delayed and might include operations such as window resize, which on most platforms (including Headless), is asynchronous. + +This delay can result in unexpected behavior when some operations have not yet executed. + +Obvious solution would be to add `Task.Delay` between these operations, but a more efficient option in Avalonia would be to use the `Dispatcher` API, which allows flushing the jobs queue directly: + +```csharp +var window = new Window(); +window.Show(); + +window.Width = 100; +window.Height = 100; + +// highlight-start +Dispatcher.UIThread.RunJobs(); +// highlight-end + +Assert.AreEqual(new Size(100, 100), window.ClientSize); +``` + +Additionally, the headless platform provides a method to force the render timer to tick, which can be useful in some scenarios: + +```csharp +AvaloniaHeadlessPlatform.ForceRenderTimerTick(); +``` + +:::tip +All input helper methods and `CaptureRenderedFrame` internally use these user delay methods, so there is no need to run them twice! +::: \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/pointer.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/pointer.md index f020f3314..12763df48 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/pointer.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/pointer.md @@ -1,6 +1,9 @@ --- description: CONCEPTS - Input --- + +import PointerPressedSampleScreenshot from '/img/gitbook-import/assets/pressed.gif'; + # 鼠标和指针设备 在_Avalonia UI_中,您可以使用'pointer'抽象来实现指针设备与应用程序的交互。这可以表示包括但不限于鼠标、触摸板和笔在内的设备。_Avalonia UI_控件具有允许您订阅指针移动、点击和滚轮移动的事件。它们如下所示: @@ -43,7 +46,7 @@ private void PointerPressedHandler (object sender, PointerPressedEventArgs args) ``` - + ## 指针位置 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/routed-events.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/routed-events.md index 1bdd9fbde..064627d44 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/routed-events.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/input/routed-events.md @@ -1,6 +1,9 @@ --- description: CONCEPTS - Input --- + +import InputEventRoutingDiagram from '/img/gitbook-import/assets/input-event-routing.png'; + # 路由事件 Avalonia中的大多数事件都是作为路由事件实现的。路由事件是在整个树上引发的事件,而不仅仅是引发事件的控件。 @@ -218,7 +221,7 @@ Avalonia的输入事件成对出现,这样一来,用户的一个输入操作 作为输入事件处理工作原理的示例,考虑以下输入事件示例。在下面的树形图示例中,`叶子元素#2`是`PointerPressed`事件的源: -事件路由图 +事件路由图 事件处理的顺序如下: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/layout/layout-zones.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/layout/layout-zones.md index 180b08462..d192db700 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/layout/layout-zones.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/layout/layout-zones.md @@ -2,6 +2,8 @@ description: CONCEPTS - Layout --- +import LayoutZonesDiagram from '/img/gitbook-import/assets/image (25) (2) (1).png'; + # 布局区域 - + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/data-persistence.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/data-persistence.md index 29f433e50..d0556ac45 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/data-persistence.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/data-persistence.md @@ -63,7 +63,8 @@ public class MainWindow : ReactiveWindow Watermark="请输入搜索查询" Margin="20" /> -```" +``` + ### 创建悬挂驱动程序 这里我们提供了使用`Newtonsoft.Json`并将应用程序状态保存到纯文本文件的实现。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/index.md index 10173f56f..c1fb766c8 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/index.md @@ -2,6 +2,8 @@ description: CONCEPTS --- +import ReactiveUINuGetScreenshot from '/img/gitbook-import/assets/image (44) (1).png'; + # ReactiveUI :::tip @@ -18,7 +20,7 @@ _ReactiveUI_是一个高级的、可组合的、功能反应式的模型-视图- _Avalonia UI_附带了自己的_ReactiveUI_分支,位于`Avalonia.ReactiveUI` _NuGet_包中。 - + 要在您的_Avalonia UI_应用程序中使用_ReactiveUI_和MVVM模式,请使用_NuGet_包管理器(如上所示)将包添加到您的项目中,或执行以下CLI命令: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-command.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-command.md index 5572717f2..fbc9a1300 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-command.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-command.md @@ -2,6 +2,10 @@ description: CONCEPTS - ReactiveUI --- +import ReactiveCommandViewScreenshot from '/img/gitbook-import/assets/image (2) (1) (1) (1).png'; +import ReactiveCommandRunOutputScreenshot from '/img/gitbook-import/assets/image (6) (1) (1).png'; +import ReactiveCommandCanExecuteScreenshot from '/img/gitbook-import/assets/image (6) (1) (2).png'; + # 响应式命令 在本页面中,您将学习如何使用_ReactiveUI_的`ReactiveCommand`和在代码中创建的`ObservableObject`来实现UI的功能逐步展示原则。 @@ -24,7 +28,7 @@ description: CONCEPTS - ReactiveUI ``` -![图片](/img/gitbook-import/assets/image (2) (1) (1) (1).png) +图片 您可以添加一个相应的视图模型,如下所示: @@ -53,7 +57,7 @@ public class MainWindowViewModel : ViewModelBase 这个视图模型还没有执行功能逐步展示。`SubmitCommand`被声明为没有参数和结果(void)。`Create`方法的同步操作参数是您在命令运行时(用户点击按钮时)执行的操作。上面的示例只是在调试窗口中报告该操作。 -![图片](/img/gitbook-import/assets/image (6) (1) (1).png) +图片 ## 可执行吗? @@ -79,4 +83,6 @@ SubmitCommand = ReactiveCommand.Create(() => }, isInputValid); ``` -现在你会看到,只有在输入了8个字符后,按钮才会变为可用状态。 \ No newline at end of file +现在你会看到,只有在输入了8个字符后,按钮才会变为可用状态。 + + \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-view-model.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-view-model.md index f44109439..15d3ee423 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-view-model.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/reactive-view-model.md @@ -2,6 +2,8 @@ description: CONCEPTS - ReactiveUI --- +import ReactiveObjectDiagram from '/img/gitbook-import/assets/image (4) (2).png'; + # 响应式视图模型 本页面介绍了如何使用_ReactiveUI_的`ReactiveObject`作为视图模型的基础,以实现与_Avalonia UI_的MVVM绑定。 @@ -20,7 +22,7 @@ public class ViewModelBase : ReactiveObject } ``` - + :::info 如果您使用了Avalonia MVVM应用程序解决方案模板,那么您会发现这个基类已经添加到项目的/ViewModels文件夹中。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/routing.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/routing.md index 86a724b7f..ac91bc1b4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/routing.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/reactiveui/routing.md @@ -1,5 +1,7 @@ # 路由 +import ReactiveUIRoutingScreenshot from '/img/gitbook-import/assets/routing.gif'; + [ReactiveUI 路由](https://reactiveui.net/docs/handbook/routing/)由包含当前 [RoutingState](https://reactiveui.net/api/reactiveui/routingstate/) 的 [IScreen](https://reactiveui.net/api/reactiveui/iscreen/)、多个 [IRoutableViewModel](https://reactiveui.net/api/reactiveui/iroutableviewmodel/) 和一个特定于平台的 XAML 控件 [RoutedViewHost](https://github.com/AvaloniaUI/Avalonia/blob/55458cf7af24d6c987268ab5ff8a1ead1173310b/src/Avalonia.ReactiveUI/RoutedViewHost.cs) 组成。`RoutingState` 管理视图模型导航堆栈,并允许视图模型导航到其他视图模型。`IScreen` 是导航堆栈的根;尽管名称如此,但它的视图不必占据整个屏幕。`RoutedViewHost` 监视 `RoutingState` 的实例,通过创建和嵌入适当的视图来响应导航堆栈中的任何更改。 ## 路由示例 @@ -242,5 +244,5 @@ namespace RoutingExample dotnet run --framework netcoreapp2.1 ``` - + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/services/storage-provider/file-picker-options.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/services/storage-provider/file-picker-options.md index 78daf4d20..9325cc732 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/services/storage-provider/file-picker-options.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/services/storage-provider/file-picker-options.md @@ -33,6 +33,18 @@ title: 文件选择器选项 File Picker Options 获取或设置文件打开选择器显示的文件类型集合。 +为文件选择器创建文件类型列表: + +```cs +//这也可以应用于SaveFilePicker。 +var files = await _target.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() +{ + Title = title, +//您可以添加自定义文件类型,也可以从内置文件类型添加。请参阅“定义自定义文件类型”,了解如何创建自定义文件类型。 + FileTypeFilter = new[] { ImageAll, FilePickerFileTypes.TextPlain } +}); +``` + ## FilePickerSaveOptions ### SuggestedFileName diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/content-template.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/content-template.md index eccb9413f..1acb08ff5 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/content-template.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/content-template.md @@ -2,6 +2,8 @@ description: CONCEPTS - Data Templates --- +import ContentTemplateStudentScreenshot from '/img/gitbook-import/assets/image (47).png'; + # 内容模板 数据模板的目的是定义 _Avalonia UI_ 如何显示您所定义的类创建的对象,该对象不是控件或简单的字符串。 @@ -43,7 +45,7 @@ description: CONCEPTS - Data Templates 在上面的示例中,绑定引用了窗口内容区域中的任何类的属性。这里窗口的内容是与之前相同的学生对象,但是当您运行这段代码时,_Avalonia UI_ 现在会显示如下内容: -![图片](/img/gitbook-import/assets/image (47).png) +图片 以这种方式使用数据模板,您在同一个地方定义并选择了内容的数据模板 - 通过直接设置窗口的 `ContentTemplate` 属性。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates-collection.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates-collection.md index dce53dea2..643430278 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates-collection.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates-collection.md @@ -2,6 +2,8 @@ description: CONCEPTS - Data Templates --- +import DataTemplatesCollectionStudentScreenshot from '/img/gitbook-import/assets/image (57).png'; + # 数据模板集合 _Avalonia UI_中的每个控件都有一个`DataTemplates`(数据模板)集合,您可以在其中放置任意数量的数据模板定义。然后,您可以根据类类型选择要用于显示的模板。 @@ -38,5 +40,5 @@ _Avalonia UI_中的每个控件都有一个`DataTemplates`(数据模板)集 这将得到与上一页完全相同的显示效果: - + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates.md index 29cc113ec..979d53e4b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/data-templates.md @@ -2,6 +2,10 @@ description: CONCEPTS - Data Templates --- +import ControlContentButtonScreenshot from '/img/gitbook-import/assets/image (42) (1).png'; +import ControlContentStringScreenshot from '/img/gitbook-import/assets/image (51).png'; +import ControlContentTypeScreenshot from '/img/gitbook-import/assets/image (52).png'; + # 控件内容 您可能已经看到了在将按钮控件放入_Avalonia UI_窗口的内容区域时会发生什么。 @@ -26,7 +30,7 @@ description: CONCEPTS - Data Templates 窗口会显示一个按钮 - 在此例中水平居中(指定)和垂直居中(默认情况下)。效果如下图所示: - + 如果您将一个字符串放入窗口的内容区域,例如: @@ -44,7 +48,7 @@ description: CONCEPTS - Data Templates 窗口将显示该字符串: - + 但是如果您尝试显示在窗口中定义的类的对象会发生什么呢? @@ -74,7 +78,7 @@ namespace MySample 但是,您将只会看到学生对象的完全限定类名: - + 这并不是很有帮助!这是因为_Avalonia UI_没有定义如何显示`Student`类的对象 - 它不是一个控件 - 因此它会退回到`.ToString()`方法,您所看到的只是完全限定的类名。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/reusing-data-templates.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/reusing-data-templates.md index 4fdb88046..0dde2ace9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/reusing-data-templates.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/templates/reusing-data-templates.md @@ -2,6 +2,8 @@ description: CONCEPTS - Data Templates --- +import ReuseTeacherDataTemplateScreenshot from '/img/gitbook-import/assets/image (50).png'; + # 重复使用数据模板 如果您在`Window.DataTemplates`集合中定义了数据模板(如前一页所示),则可以在窗口中的任何位置重用它。然而,您还可以扩展数据模板的重用范围,让其在应用程序的任何窗口中都可用。 @@ -80,7 +82,7 @@ namespace MySample 尽管窗口中没有`Teacher`的数据模板,Avalonia UI 会找到您在应用程序中定义的模板,并且显示效果如预期: -![Teacher Display](/img/gitbook-import/assets/image (50).png) +Teacher Display :::warning 请确保在每个数据模板中指定`DataType`,无论它在哪里定义,因为如果_Avalonia UI_无法找到匹配您数据的数据模板,则什么都不会显示! diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md index 58b67d29d..f193e6f57 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/avalonia-ui-and-mvvm.md @@ -2,6 +2,8 @@ description: CONCEPTS - The MVVM Pattern --- +import MvvmDataBindingDiagram from '/img/gitbook-import/assets/mvvm.png'; + # Avalonia UI和MVVM 在本页面中,您将了解如何在使用_Avalonia UI_时实现MVVM模式。 @@ -28,7 +30,7 @@ description: CONCEPTS - The MVVM Pattern 数据绑定是允许_Avalonia UI_ MVVM应用程序将视图与视图模型分离的关键技术。您可以将视图与视图模型之间的关系可视化为通过数据绑定连接的两个层: - + 请注意,其中一些数据绑定由双向箭头表示,而其他数据绑定则由单向箭头表示。例如,名称和地址输入是双向的 - 您希望将视图模型中的任何更改通知视图,并且将视图中的输入更新到视图模型。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/index.md index 733b55f89..0c37936db 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/the-mvvm-pattern/index.md @@ -1,9 +1,12 @@ --- description: CONCEPTS --- + +import MvvmPatternDiagram from '/img/gitbook-import/assets/image (60).png'; + # MVVM模式 - + Model-View-View Model(MVVM)模式是一种常见的UI应用程序结构方式。它使用数据绑定系统来帮助在视图和视图模型之间传递数据。这意味着它实现了应用程序逻辑(视图模型)与UI显示(视图)的分离。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/ui-composition.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/ui-composition.md index bc5f7e1d1..9fa8ddc1d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/ui-composition.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/concepts/ui-composition.md @@ -1,6 +1,12 @@ --- description: CONCEPTS --- + +import CompositionBasicLayoutDiagram from '/img/gitbook-import/assets/image (10) (2).png'; +import CompositionTreesDiagram from '/img/gitbook-import/assets/image (3) (1).png'; +import CompositionUserControlsDiagram from '/img/gitbook-import/assets/image (8) (2).png'; +import CompositionCollectionControlsDiagram from '/img/gitbook-import/assets/image (8) (3).png'; + # UI组合 UI组合是创建应用程序所需布局的过程。它允许您从组件的排列中构建复杂的视图。其优点包括: @@ -64,7 +70,7 @@ _Avalonia UI_包含大量内置控件,可以满足大多数UI需求。 另一种UI组合的变体是需要呈现一组项目的情况。 - + 这种情况将使用内置的重复控件之一,绑定到一个集合;以及使用数据模板来表示集合中的项目。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/macOS.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/macOS.md index 691071fd7..948b960eb 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/macOS.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/deployment/macOS.md @@ -326,9 +326,9 @@ xcrun altool` 时可能需要发送的更多标志的更多信息,请[查看 A 公证完成后,您应该能够分发您的应用程序! -{% hint style="info" %} +:::info 如果您将您的应用程序分发在 `.dmg` 文件中,您需要稍微修改步骤: -{% endhint %} +::: 1. 像往常一样将您的 `.app` 进行代码签名(放入 `.zip` 文件中) 2. 将已经进行了公证和附加 `xcrun stapler` 的 `.app` 放入 DMG 中(DMG 现在包含了已经进行公证和附加的 `.app` 文件)。 @@ -654,4 +654,4 @@ jobs: 要验证代码签名是否成功,您需要首先下载应用程序捆绑以触发 macOS 的隔离功能。您可以通过将其通过电子邮件发送给自己,或者使用 WeTransfer 或类似服务来实现这一点。 -一旦下载了应用程序捆绑并希望启动它,您应该会看到 macOS 弹出窗口,显示应用程序已经过扫描,并未发现恶意软件。 \ No newline at end of file +一旦下载了应用程序捆绑并希望启动它,您应该会看到 macOS 弹出窗口,显示应用程序已经过扫描,并未发现恶意软件。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/set-up-an-editor.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/set-up-an-editor.md index 747d0dc22..54432d693 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/set-up-an-editor.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/set-up-an-editor.md @@ -3,6 +3,9 @@ id: set-up-an-editor title: 设置编辑器 --- +import AvaloniaVsExtensionMarketplaceScreenshot from '/img/get-started/install-the-avalonia-extension/image (17) (2).png'; +import AvaloniaVsExtensionNuGetScreenshot from '/img/get-started/install-the-avalonia-extension/image (3) (1) (1) (1).png'; + # 设置编辑器 您可以使用任何代码编辑器创建Avalonia应用程序,但是使用IDE将为您提供Avalonia XAML预览器和代码补全的支持。 @@ -19,9 +22,7 @@ Rider目前还没有提供可视化设计工具,但正在开发中。请参阅 如果您正在使用Visual Studio开发Avalonia,您应该安装[Avalonia for Visual Studio](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS)扩展。 -
- -
+ 该扩展提供了Avalonia XAML的智能感知支持以及预览功能。 @@ -31,9 +32,7 @@ Rider目前还没有提供可视化设计工具,但正在开发中。请参阅 - 在**搜索**框中,输入"Avalonia" - 点击**下载**并按照说明进行操作(您需要关闭Visual Studio以完成安装) -
- -
+ :::info 您也可以在[此处](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaVS)下载扩展。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-a-control.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-a-control.md index 30058a1e3..f2fe88e54 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-a-control.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-a-control.md @@ -4,6 +4,7 @@ title: 添加控件 --- import Highlight from '@site/src/components/Highlight'; +import AvaloniaPropertyIntellisenseScreenshot from '/img/get-started/add-a-control/image (1) (2) (1).png'; 到目前为止,您的应用程序的主窗口只显示一个文本字符串。在本页中,您将学习如何添加一些Avalonia的内置控件。 @@ -41,9 +42,8 @@ Avalonia控件的XAML代码使用属性来指定呈现和行为。这些属性 :::tip 如果您正在使用IDE,您可以注意到当您向XAML添加属性时,Avalonia的智能感知会做出引导。 -
- -
+ + ::: 按钮现在已经移动到窗口内容区域的中心(水平和垂直方向)。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-some-layout.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-some-layout.md index c0a5c1853..f112f46b1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-some-layout.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/add-some-layout.md @@ -3,6 +3,9 @@ id: add-some-layout title: 添加一些布局 --- +import StackPanelDiagram from '/img/get-started/add-some-layout/image (40) (1) (1).png'; +import StackPanelSampleScreenshot from '/img/get-started/add-some-layout/image (41) (1).png'; + Avalonia提供了一系列内置的控件来帮助您布局应用程序的可视元素。在本页,您将看到如何使用其中一些布局控件。 目前,您的应用程序在主窗口的内容区域中只有一个按钮。 @@ -13,11 +16,7 @@ Avalonia提供了一系列内置的控件来帮助您布局应用程序的可视 stack panel控件允许在其内容区域中放置多个控件,并按照在XAML中定义的顺序以垂直堆栈的方式排列它们。 - - -
- -
+ ```xml @@ -49,9 +48,7 @@ text block控件使您可以完全控制其包含的文本的样式。 ``` -
- -
+ :::info 您可以从参考文档[这里](../../reference/controls/layout-controls.md)了解Avalonia中的其他布局控件。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/index.md new file mode 100644 index 000000000..cbc76a445 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/index.md @@ -0,0 +1,8 @@ +# Test Drive + +```mdx-code-block +import {DocsCardList} from '../../../../../../src/components/DocsCard'; +import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; + + +``` \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/input-controls.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/input-controls.md index a17a47dfc..d27eed06c 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/input-controls.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/input-controls.md @@ -3,15 +3,15 @@ id: input-controls title: 输入控件 --- +import InputControlsScreenshot from '/img/get-started/test-drive/input-controls.png'; + 在这个页面上,您将学习如何在一个整洁的布局中添加一些Avalonia输入控件。目标是在水平行中添加带有其关联标签的数字输入;在下面的行中添加一个输出控件。 为了实现这个布局,您将使用内置的网格控件,并将标签和输入控件放置在其单元格中。 这张图片展示了结果布局(运行中)并显示了网格线。网格线是为了可视化布局而显示的 - 在生产界面上通常不会这样做。 -
- Window showing input controls -
+Window showing input controls 要使用网格控件创建布局,请按照以下步骤进行操作: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/main-window.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/main-window.md index 5af857722..4233f9c59 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/main-window.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/main-window.md @@ -3,6 +3,11 @@ id: main-window title: 主窗口 --- +import LayoutZonesDiagram from '/img/gitbook-import/assets/image (25) (2) (1).png'; +import MainWindowScreenshot from '/img/get-started/the-main-window/image (15) (1) (1).png'; +import VsDesignerScreenshot from '/img/get-started/the-main-window/image (22) (1).png'; +import VsPreviewPaneScreenshot from '/img/get-started/the-main-window/image (6) (2).png'; + 您现在可以开始 Avalonia 项目之旅了。我们将从主应用程序窗口开始。打开 **MainWindow.axaml** 文件。 :::info @@ -13,15 +18,11 @@ title: 主窗口 在 **MainWindow.axaml** XAML 文件中,`...` XAML 标记表示 Avalonia 窗口。与其他 Avalonia 控件一样,窗口将在目标平台上绘制,具有 4 个**布局区域**:边距、边框、内边距和内容。 -
- -
+ 在当前应用程序中,窗口的内容区域只包含一个简单的字符串,即您最新的消息;因此显示的就是这个消息。 -
- -
+ 在这个阶段,您没有定义边距、边框或任何内边距,所以消息显示在窗口的左上角。 @@ -33,9 +34,7 @@ title: 主窗口 如果您使用的是 Visual Studio,则应该看到 XAML 代码和预览窗格。 -
- -
+ :::info 请注意红色感叹号图标(左上角)和消息 **The designer is loading...**。这表示必须将项目构建一次预览窗格才能开始响应。 @@ -44,9 +43,7 @@ title: 主窗口 - 构建项目。 - 滚动预览窗格到左侧,查看预览轮廓和显示在左上角的文本。 -
- -
+ - 在 XAML 代码窗格中找到 `Welcome to Avalonia!` 消息文本,并进行更改。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/response-to-an-event.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/response-to-an-event.md index e9136a801..9f8b498e2 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/response-to-an-event.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/get-started/test-drive/response-to-an-event.md @@ -3,6 +3,10 @@ id: respond-to-an-event title: 响应事件 --- +import SolutionCodeBehindScreenshot from '/img/get-started/respond-to-an-event/image (59).png'; +import AvaloniaEventIntellisenseScreenshot from '/img/get-started/respond-to-an-event/image (25) (2).png'; +import EventDebugOutputScreenshot from '/img/get-started/respond-to-an-event/image (54).png'; + 在Avalonia应用程序中,您可以使用多种方式实现操作。在本页面中,您将了解如何使用最简单的方法之一:如何编写按钮点击的事件处理代码。 首先,您将编写一个按钮点击事件处理程序,该处理程序不与任何其他控件交互。 @@ -11,9 +15,7 @@ title: 响应事件 主窗口的XAML文件与一个关联的C#代码后台文件。如果您使用的是一个IDE,您可以在**Solution Explorer**中找到这个文件 - 它是`.axaml`文件的子项。 -
- -
+ 要更改主窗口的代码后台: @@ -77,17 +79,13 @@ using System.Diagnostics; :::tip 如果您使用的是一个IDE,您将在输入时看到Avalonia UI的智能感知。 -
- -
+ ::: - 运行应用程序并点击按钮。 您应该在Debug的输出窗口中看到结果,如下所示: -
- -
+ 在下一页中,您将了解如何使用代码后台在运行时读取和更改Avalonia UI控件的属性。 \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/building-cross-platform-applications/dealing-with-platforms.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/building-cross-platform-applications/dealing-with-platforms.md index b5c4d2a10..fef8bfb0d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/building-cross-platform-applications/dealing-with-platforms.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/building-cross-platform-applications/dealing-with-platforms.md @@ -39,6 +39,7 @@ title: 处理多个平台 * **平台抽象**:此方法利用业务外观模式,在各个平台上提供统一的访问。它将独特的平台实现抽象为一个单一的、连贯的API。其主要优点是能够编写与平台无关的代码,增强了代码的可重用性和可维护性。然而,这种方法可能无法充分利用每个平台的独特功能和能力。 + ## 平台抽象 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/draw-with-a-property.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/draw-with-a-property.md index a9e2e38e7..557b3e5ef 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/draw-with-a-property.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/draw-with-a-property.md @@ -3,6 +3,8 @@ id: draw-with-a-property title: 使用属性绘制 --- +import DrawWithPropertyScreenshot from '/img/gitbook-import/assets/image (1) (2) (2).png'; + # 使用属性进行绘制 在这个页面上,您将看到如何使用一个简单属性的值来绘制自定义控件,该属性定义了背景颜色。代码现在如下所示: @@ -48,7 +50,7 @@ namespace AvaloniaCCExample.CustomControls 绘制代码使用_Avalonia UI_图形上下文(传递给渲染方法),绘制一个填充有背景颜色的矩形,大小与控件相同(由`Bounds.Size`对象提供)。 - + 请注意,控件现在在运行时(如上图)和预览窗格中都显示出来。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/how-to-create-a-custom-controls-library.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/how-to-create-a-custom-controls-library.md index a7a5d0c0e..2d9ca2254 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/how-to-create-a-custom-controls-library.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/custom-controls/how-to-create-a-custom-controls-library.md @@ -3,15 +3,18 @@ id: how-to-create-a-custom-controls-library title: 如何创建自定义控件库 --- +import CustomControlsSolutionScreenshot from '/img/gitbook-import/assets/image (22) (3).png'; +import CustomControlNuGetScreenshot from '/img/gitbook-import/assets/image (11) (2).png'; + # 如何创建自定义控件库 本指南将向您展示如何创建自定义控件库并在_Avalonia UI_应用程序中引用它。 - + 在此示例中,将一个自定义控件文件添加到一个.NET类库中。该库已安装了_Avalonia UI_ _NuGet_包: - + + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-can-execute.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-can-execute.md index 5549be60a..1ba05ade2 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-can-execute.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-can-execute.md @@ -3,6 +3,7 @@ id: how-to-bind-can-execute title: 如何绑定 Can Execute --- +import BindCanExecuteScreenshot from '/img/gitbook-import/assets/command4.gif'; # 如何绑定 Can Execute @@ -86,4 +87,4 @@ namespace AvaloniaGuides.ViewModels 实际上,`WhenAnyValue` 方法有多个重载,最多可以接受 10 个不同的值获取器(用于验证函数参数),以及验证函数本身。 ::: - + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md index f7e823d4b..101d44c7b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-with-reactiveui.md @@ -3,6 +3,7 @@ id: how-to-bind-to-a-command-with-reactiveui title: 如何使用ReactiveUI绑定命令 --- +import BindReactiveCommandScreenshot from '/img/gitbook-import/assets/command.gif'; # 如何使用ReactiveUI绑定命令 @@ -72,7 +73,7 @@ namespace AvaloniaGuides.ViewModels 当与Reactive命令绑定的控件被激活时(在本例中:当按钮被点击时),将通过Reactive命令调用执行操作的私有方法。 - + ## 命令参数 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md index 477489287..257ecd687 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/data-binding/how-to-bind-to-a-command-without-reactiveui.md @@ -3,6 +3,8 @@ id: how-to-bind-to-a-command-without-reactiveui title: 如何不使用ReactiveUI绑定命令 --- +import BindCommandMethodScreenshot from '/img/gitbook-import/assets/command2.gif'; +import BindCanExecuteMethodScreenshot from '/img/gitbook-import/assets/command3.gif'; # 如何不使用ReactiveUI绑定命令 @@ -34,7 +36,7 @@ namespace AvaloniaGuides.ViewModels { public class MainWindowViewModel { - private void PerformAction(string msg) + public void PerformAction(object msg) { Debug.WriteLine($"The action was called. {msg}"); } @@ -42,7 +44,7 @@ namespace AvaloniaGuides.ViewModels } ``` - + ## 能否执行? @@ -59,12 +61,12 @@ namespace AvaloniaGuides.ViewModels { public class MainWindowViewModel { - private void PerformAction(string msg) + public void PerformAction(object msg) { Debug.WriteLine($"The action was called. {msg}"); } - private bool CanPerformAction(object msg) + public bool CanPerformAction(object msg) { if (msg!=null) return !string.IsNullOrWhiteSpace( msg.ToString() ); return false; @@ -92,7 +94,7 @@ namespace AvaloniaGuides.ViewModels 你会发现只有当文本框包含字符串时,按钮才会变为可用状态。 - + ## **触发“能否执行”** diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/accessing-the-ui-thread.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/accessing-the-ui-thread.md index e8974941e..24821e3a1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/accessing-the-ui-thread.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/accessing-the-ui-thread.md @@ -3,6 +3,8 @@ id: accessing-the-ui-thread title: 如何访问UI线程 --- +import DispatchPostLongRunningScreenshot from '/img/gitbook-import/assets/long1.gif'; +import DispatchInvokeAsyncLongRunningScreenshot from '/img/gitbook-import/assets/long2.gif'; # 如何访问UI线程 @@ -64,7 +66,7 @@ private void ButtonClickHandler(object sender, RoutedEventArgs e) } ``` - + 请注意,由于长时间运行的任务在其自己的线程上执行,UI不会失去响应。 @@ -100,7 +102,7 @@ private async void ButtonClickHandler(object sender, RoutedEventArgs e) } ``` - + ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/how-to-show-and-hide-a-split-view-pane-with-mvvm.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/how-to-show-and-hide-a-split-view-pane-with-mvvm.md index 0dfbe363b..19a6ab8ca 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/how-to-show-and-hide-a-split-view-pane-with-mvvm.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/development-guides/how-to-show-and-hide-a-split-view-pane-with-mvvm.md @@ -3,8 +3,7 @@ id: how-to-show-and-hide-a-split-view-pane-with-mvvm title: How To Show and Hide a Split View Pane with MVVM --- - -# How To Show and Hide a Split View Pane with MVVM +import SplitViewExpanderScreenshot from '/img/gitbook-import/assets/splitview2.gif'; Content in preparation. @@ -16,4 +15,5 @@ This technique uses a complex **binding path** to locate the parent view model f TO DO - + + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/graphics-and-animations.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/graphics-and-animations.md index 357712993..d69f64ad1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/graphics-and-animations.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/graphics-and-animations.md @@ -3,6 +3,7 @@ id: graphics-and-animations title: 如何绘制图形 --- +import ShapeAndGeometrySampleScreenshot from '/img/gitbook-import/assets/shapes.png'; # 如何绘制图形 @@ -53,7 +54,7 @@ Avalonia提供了一组常见的矢量绘制2D形状,如`Ellipse`(椭圆) ``` - + ## 添加动画 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/how-to-create-a-custom-page-transition.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/how-to-create-a-custom-page-transition.md index 5fe088fad..58b17a401 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/how-to-create-a-custom-page-transition.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/how-to-create-a-custom-page-transition.md @@ -3,6 +3,7 @@ id: how-to-create-a-custom-page-transition title: 如何创建自定义页面过渡效果 --- +import CustomPageTransitionScreenshot from '/img/animations/page-transitions/TransitioningContentControl_03.webp'; # 如何创建自定义页面过渡效果 @@ -162,7 +163,7 @@ public class CustomTransition : IPageTransition } ``` - + ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/keyframe-animations.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/keyframe-animations.md index 4e75ed220..bf6927c98 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/keyframe-animations.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/graphics-and-animation/keyframe-animations.md @@ -3,12 +3,17 @@ id: keyframe-animations title: 如何使用关键帧动画 --- +import AnimationKeyframeDiagram from '/img/gitbook-import/assets/image (2) (1) (4).png'; +import KeyframeFadeScreenshot from '/img/gitbook-import/assets/anim1 (1).gif'; +import KeyframeCompositeAnimationScreenshot from '/img/gitbook-import/assets/anim2.gif'; +import LinearEasingScreenshot from '/img/gitbook-import/assets/image (72).png'; +import BounceEaseInScreenshot from '/img/gitbook-import/assets/image (76).png'; # 如何使用关键帧动画 您可以使用关键帧动画来在时间轴上更改一个或多个控件属性。关键帧在动画的 **持续时间** 内由 _Avalonia UI_ 样式中的 **提示** 点定义,并在某个时间点上设置属性的中间值。 - + 关键帧之间的属性值根据 **缓动函数** 的曲线设置。默认的缓动函数是直线插值。 @@ -62,7 +67,7 @@ title: 如何使用关键帧动画 动画效果如下: - + 该动画在矩形控件加载并被样式选择时就会运行。事实上,它在预览窗格中也能运行! @@ -75,7 +80,7 @@ title: 如何使用关键帧动画 ``` -{% endcode %} -{% code title="Styles1.axaml" %} ```markup c + ``` -{% endcode %} -{% code title="App.axaml" %} ```markup ``` -{% endcode %} 在这个例子中,首先应用了来自文件 **Styles1.axaml** 的样式,所以文件 **Styles2.axaml** 中的样式设置会覆盖之前的样式。最终的 TextBlock 将具有 FontSize="16" 和 Foreground="Green"。在样式文件内部也会发生相同的优先级排序。 @@ -103,7 +97,7 @@ _Avalonia UI_ 的选择器,就像 CSS 选择器一样,当没有匹配的控 - ``` @@ -128,8 +122,6 @@ _Avalonia UI_ 的选择器,就像 CSS 选择器一样,当没有匹配的控 ``` -The actual background is rendered by a `ContentPresenter`, which in the default is bound to the Buttons `Background` property. However in the pointer-over state the selector is directly applying the background to the `ContentPresenter (Button:pointerover /template/ ContentPresenter#PART_ContentPresenter`) That's why when our setter was ignored in the previous code example. The corrected code should target content presenter directly as well: - 实际背景是由 `ContentPresenter` 渲染的,在默认情况下它与按钮的 `Background` 属性绑定。然而,在 pointerover 状态下,选择器直接将背景应用于 `ContentPresenter (Button:pointerover /template/ ContentPresenter#PART_ContentPresenter)`。这就是为什么在前一个代码示例中我们的 setter 被忽略的原因。修正后的代码应该直接针对 content presenter: ```markup diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/animation-settings.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/animation-settings.md index 6a19553ad..24e36ba96 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/animation-settings.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/animation-settings.md @@ -2,6 +2,8 @@ description: REFERENCE --- +import SineEaseOutScreenshot from '/img/gitbook-import/assets/image (67).png'; + # 动画设置 This section contains full lists of the _Avalonia UI_ animation settings: @@ -14,7 +16,7 @@ This section contains full lists of the _Avalonia UI_ animation settings: ## 缓动函数(Easing Functions) -
配置设置
SineEaseOut
+
配置设置
SineEaseOut
## 填充模式(Fill Modes) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/autocompletebox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/autocompletebox.md index cc7f2e3f5..7b4e263e6 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/autocompletebox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/autocompletebox.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import AutoCompleteBoxScreenshot from '/img/gitbook-import/assets/autocomplete.gif'; + # Auto-complete Box The auto-complete box presents a text box for user input and a drop-down that contains possible matches from an items source collection, for the text typed in. The drop-down shows when the user starts to type, and the match is updated for each character typed. The user can select from the drop-down. @@ -55,11 +57,7 @@ namespace AvaloniaControls.Views } ``` - - - - - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/button.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/button.md index a7296e854..a99ed0469 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/button.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/button.md @@ -2,12 +2,20 @@ description: REFERENCE - Built-in Controls --- +import ButtonClickHandlerScreenshot from '/img/gitbook-import/assets/button.gif'; + # 按钮 按钮是一种对指针动作做出反应的控件(也有一些键盘等效操作)。当指针按下时,它会呈现出被按下的状态。 将指针按下到释放的序列解释为点击;此行为是可配置的。 +:::warning +在确定按钮是否被用户按下时,请始终使用`Click`事件而不是`PointerPressed`。`Click`是`Button`特有的高级事件,表示按钮已被按下。 + +而`PointerPressed`更像是一个低层次的输入事件:`Button`需要在内部处理这个事件,以引发`Click`事件。由于 `Button` 会处理 `PointerPressed`事件(将`IsHandled`设为 true),应用程序将永远不会像其他控件那样收到该事件。 +::: + :::info 点击是众多按钮事件之一,完整列表请参阅[这里](http://reference.avaloniaui.net/api/Avalonia.Controls/Button/#Events)。 ::: @@ -53,7 +61,7 @@ public partial class MainWindow : Window } ``` - + ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/buttonspinner.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/buttonspinner.md index 2fc0c69fa..b0988beb1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/buttonspinner.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/buttonspinner.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import ButtonSpinnerScreenshot from '/img/gitbook-import/assets/image (3) (3).png'; + # 按钮微调器 按钮微调器是一个包含向上和向下微调按钮的控件。该按钮的内容是灵活的,但您需要编写相当多的行为代码。 @@ -20,8 +22,9 @@ description: REFERENCE - Built-in Controls ``` - -## 更多信息 + + +## More Information :::info 有关此控件的完整API文档,请参阅 [这里](http://reference.avaloniaui.net/api/Avalonia.Controls/ButtonSpinner/). diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/radiobutton.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/radiobutton.md index c2f6534ef..ab29e3fe5 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/radiobutton.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/radiobutton.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import RadioButtonScreenshot from '/img/gitbook-import/assets/radio.gif'; + # 单选按钮 单选按钮控件展示了一组选项,用户一次只能选择其中一个。选中的选项以实心圆圈表示,未选中的选项以空心圆圈表示。 @@ -43,7 +45,7 @@ description: REFERENCE - Built-in Controls ``` -![示例图片](/img/gitbook-import/assets/radio.gif) +示例图片 ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/repeatbutton.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/repeatbutton.md index 3bbff5e09..337418d02 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/repeatbutton.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/repeatbutton.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import RepeatButtonScreenshot from '/img/gitbook-import/assets/repeatbutton.gif'; + # 重复按钮 重复按钮是一种控件,其特点是在按住按钮时定期生成点击事件。 @@ -43,7 +45,7 @@ public partial class MainWindow : Window } ``` -![示例图片](/img/gitbook-import/assets/repeatbutton.gif) +示例图片 ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglebutton.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglebutton.md index 9d9ef0d18..2ff58f357 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglebutton.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglebutton.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import ToggleButtonScreenshot from '/img/gitbook-import/assets/toggle.gif'; + # 切换按钮 切换按钮可以通过使用样式和伪类来呈现布尔值,这些样式和伪类可以存在(true)或不存在(false)。 @@ -85,7 +87,7 @@ description: REFERENCE - Built-in Controls 路径图标的可见性由窗口样式设置,这些样式使用`:checked`伪类来确定切换按钮何时处于已选中状态。因此,当切换按钮被选中时,`audio-on`路径图标可见,而`audio-mute`路径图标隐藏。反之,当切换按钮未选中时,`audio-mute`路径图标可见,而`audio-on`路径图标隐藏。 - + ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglesplitbutton.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglesplitbutton.md index 152ddb932..991946674 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglesplitbutton.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/buttons/togglesplitbutton.md @@ -1,5 +1,10 @@ # 切换分裂按钮 +import ToggleSplitButtonClosedUncheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_closed_unchecked.png'; +import ToggleSplitButtonClosedCheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_closed_checked.png'; +import ToggleSplitButtonOpenedCheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_opened_checked.png'; +import ToggleSplitButtonTextListScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_TextListExample.png'; + `ToggleSplitButton` 作为一个带有主要和次要部分的 [`ToggleButton`](togglebutton),每个部分都可以单独按下。主要部分的行为类似于普通的 `ToggleButton`,而次要部分会打开一个带有附加操作的 [`Flyout`](../flyouts)。 :::info @@ -63,13 +68,16 @@ ``` - + + _SplitButton (Flyout closed, unchecked)_ - + + _SplitButton (Flyout closed, checked)_ - + + _SplitButton (Flyout opened, checked)_ ### 带编号或项目符号列表的文本编辑器示例 @@ -110,5 +118,6 @@ _SplitButton (Flyout opened, checked)_ ``` - + + _Sample of ToggleSplitButton for toggle text lists on and off and selecting the list format_ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/canvas.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/canvas.md index d0710e129..119af6080 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/canvas.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/canvas.md @@ -2,13 +2,16 @@ description: REFERENCE - Built-in Controls --- +import CanvasContentZoneScreenshot from '/img/gitbook-import/assets/image (16) (2).png'; +import CanvasChildOverlapScreenshot from '/img/gitbook-import/assets/image (9) (2).png'; + # Canvas The canvas control displays its child controls at specified positions (given as coordinates). The position of each child control is defined as two distances between edge the canvas content zone, and the outer edge of the child margin zone. For example, this might be the top-left corner of the child to the top-left of canvas, as shown here: - + :::info To review the concept of layout zones, see [here](../../concepts/layout/layout-zones). @@ -50,7 +53,7 @@ However you define the drawing sequence, the opacity of child controls is respec The result looks like this: - + :::info Use the canvas panel with discretion. While it may be convenient to position child controls like this, your UI will no longer be adaptive to changes in the app window size. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/carousel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/carousel.md index b1610a8c8..257fdd908 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/carousel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/carousel.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import CarouselScreenshot from '/img/gitbook-import/assets/carousel.gif'; + # Carousel The carousel has an items collection, and displays each item as a page, in sequence, so that it fills the control. @@ -63,9 +65,7 @@ namespace AvaloniaControls.Views } ``` - - - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/checkbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/checkbox.md index 6cbeb25ce..9b9d02baa 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/checkbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/checkbox.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Control --- +import CheckBoxTwoStateScreenshot from '/img/gitbook-import/assets/checkbox1.gif'; +import CheckBoxThreeStateScreenshot from '/img/gitbook-import/assets/checkbox2.gif'; + # Check Box The check box control presents a Boolean value where the true value is represented using a check mark, and the false value is an empty box. The check box has an option to present a nullable Boolean, where the null value represents 'unknown' and is drawn as a shaded box. @@ -38,7 +41,7 @@ This is an example of two-state check boxes: Looks like this when running on Windows: - + This is an example of a three-state checkbox: @@ -60,7 +63,7 @@ This is an example of a three-state checkbox: Looks like this when running on Windows: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/colorpicker/README.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/colorpicker/README.md new file mode 100644 index 000000000..d5a708268 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/colorpicker/README.md @@ -0,0 +1,90 @@ +--- +description: REFERENCE - Built-in Controls +--- + +import ColorPaletteFluent from '/img/controls/colorpicker/color-palette-fluent.png'; +import ColorPaletteFlat from '/img/controls/colorpicker/color-palette-flat.png'; +import ColorPaletteFlatHalf from '/img/controls/colorpicker/color-palette-flat-half.png'; +import ColorPaletteMaterial from '/img/controls/colorpicker/color-palette-material.png'; +import ColorPaletteMaterialHalf from '/img/controls/colorpicker/color-palette-material-half.png'; +import ColorPaletteSixteen from '/img/controls/colorpicker/color-palette-sixteen.png'; + +# ColorPicker + +The `ColorPicker` provides a highly customizable, general-purpose control that users can use to select colors in RGB or HSV color space. This implementation is just as much about providing primitive controls that developers can use to build their own color pickers as it is about providing a ready-to-use picker. + +The `ColorPicker` includes a family of controls (components): + + * `ColorSpectrum` (primitive) : A two dimensional spectrum for color selection. + * `ColorSlider` (primitive) : A slider with a background that represents a single color component. + * `ColorPreviewer` (primitive) : Shows a preview color with optional accent colors. + * `ColorView` : Presents a color for user editing using a spectrum, palette and component sliders. + * `ColorPicker` : Presents a color for user editing using a spectrum, palette and component sliders within a drop down. Editing is available when the drop down flyout is opened; otherwise, only the preview color is shown. + +Each primitive component can be used on its own and mixed/matched with others. This allows significant composability that isn't possible with other color picker implementations. For example, you can quickly bind together the `ColorSpectrum`, `ColorSlider` and `ColorPreviewer` primitives to create your own color picker with a brand-new design. + +Note on terminology: "color picker" usually refers to the family of controls while `ColorPicker` refers to the specific control. + +## Is this the right control? + +This control is intended to be used directly to select colors in a user-friendly, developer customizable way. This can be done using either a canvas-type `ColorView` control or a compact `ColorPicker` drop down. + +For apps with even more special-purpose needs, each control and primitive component can be independently customized to create a new color picker without having to re-implement all the advanced rendering and color logic. This is very useful to match a specific app's design and usability requirements. + +Developers using this control may: + 1. Use `ColorView` or `ColorPicker` as-is directly in their apps + 2. Customize `ColorView` or `ColorPicker` using the included properties. These properties allow significant changes to the control such as disabling components sliders, showing different palettes or hiding all but the spectrum tab. + 3. Create a new color picker to meet a specific app's design and usability requirements using the existing primitive components. + 4. Re-template the existing components to create a brand-new fully customized color picker. + +## Using in Your App + +Avalonia is used in several resource-constrained environments such as embedded devices. For this and other reasons, certain larger controls such as the `ColorPicker` are not included with the main Avalonia UI Nuget packages. This means a bit of extra work is required to add the `ColorPicker` to your app: + + 1. Add the `Avalonia.Controls.ColorPicker` nuget to your project. This MUST match your version of Avalonia's other packages. + 2. Add control themes and styles for all color picker controls in `App.axaml` by adding: + * `` for Fluent themes **OR** + * `` for Simple themes + +:::note +This step is not required for some theme packages such as FluentAvalonia which include all controls by default. +::: + +## Background + +This control originated as a re-styling of the one in UWP (later WinUI) using the basic designs implemented for the Windows Community Toolkit. The WinUI `ColorPicker` isn't conducive to smaller screen sizes and the overall design/usability of the control left something to be desired for both users and developers. + +With all its features, the WinUI control still wasn't as good as it should be. It couldn't be re-templated and customized without a lot of effort (partially because individual components were highly inter-dependent on each other). It also used a lot of template parts and code-behind. The Avalonia UI version of the control (a complete rewrite) attempts to fix all of these issues and become the predominant XAML color picker design. + +Main improvements learning from WinUI were: + * The `ColorPicker` is implemented as a drop-down (matching all other "pickers"). There is also a `ColorView` control for those that want the canvas-type control (similar to WinUI). + * The Avalonia controls attempt to do everything possible in XAML control themes keeping code-behind to an absolute minimum. This significantly increases composability and enables app developers to customize every part of these controls (and even the primitives in most cases). + * Primitives such as the `ColorSlider` and `ColorSpectrum` are fully self-contained and can be used separately enabling app developers to create custom color picker implementations. + * A new `HsvColor` struct was added to base Avalonia itself (alongside `Color` and `HslColor`) and is now used in all color picker controls. This simplified code-behind and also made binding of color properties between primitives and controls possible. Color picker controls internally work in HSV color space. + * `HsvColor` along with `ColorSlider` together unlock a lot of power compared to WinUI (and enable easy re-templating). + * Many new properties (more than in WinUI) were added to control all aspects of the `ColorView` visibility. Each tab can be separately hidden along with most individual subsections. This allows a lot of design customization without having to re-template or use complex style selectors. + * Color palettes were added using the `IColorPalette` interface (same as the Windows Community Toolkit). No color palettes are supported in the WinUI version of this control. + * New properties such as `SelectedIndex` and `ColorModel` allow customizing the color picker and putting it into a pre-defined state. For example, the WinUI ColorPicker always defaults to RGB and this cannot be changed in code or XAML. This implementation does not have such limitations. + +## Controls & Primitives + +| Control | Link | +|---------|------| +| `ColorPicker` | | +| `ColorView` | See the dedicated [`ColorView`](colorview.md) page. | +| `ColorSpectrum` | | +| `ColorSlider` | | +| `ColorPreviewer` | | + +## Color Palettes + +Several pre-defined color palettes implementing the `IColorPalette` interface are provided. Instances of these palettes may be set to the `Palette` property of a `ColorView` or `ColorPicker`. + +| Palette | Description | +|---------|-------------| +| Fluent Color Palette | Contains the Fluent color palette found in Windows 10 and later. This is the default color palette. | +| Flat UI Color Palette | Contains the full [Flat UI color palette](https://github.com/designmodo/Flat-UI). | +| Flat UI Half Color Palette | Contains half of [Flat UI color palette](https://github.com/designmodo/Flat-UI) for improved usability especially on mobile devices. | +| Material Color Palette | Contains most of the [Material design color palette](https://material.io/design/color/the-color-system.html#tools-for-picking-colors). In order to make the palette uniform and rectangular the following alterations were made 1. The A100-A700 shades of each color are excluded. These shades do not exist for all colors (Brown/Gray). 2. Black/White are stand-alone colors and are also excluded. | +| Material Half Color Palette | Contains half of the [Material design color palette](https://material.io/design/color/the-color-system.html#tools-for-picking-colors) shown above for improved usability especially on mobile devices. | +| Sixteen Color Palette | Contains the standard [sixteen color palette](https://en.wikipedia.org/wiki/Web_colors#HTML_color_names) from the HTML 4.01 specification. | diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/colorpicker/colorview.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/colorpicker/colorview.md new file mode 100644 index 000000000..554799b93 --- /dev/null +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/colorpicker/colorview.md @@ -0,0 +1,55 @@ +--- +description: REFERENCE - Built-in Controls +--- + +# ColorView + +Presents a color for user editing using a spectrum, palette and component sliders. + +## Common Properties + +| Property | Description | +|----------|-------------| +| `Color` | Gets or sets the currently selected color in the RGB color model. For control authors, use `HsvColor` instead to avoid loss of precision and color drifting. | +| `ColorModel` | Gets or sets the active color model used by the sliders. This property is only applicable to the components tab. The spectrum tab must always be in HSV and the palette tab contains only pre-defined colors. | +| `ColorSpectrumComponents` | Gets or sets the two HSV color components displayed by the spectrum. | +| `ColorSpectrumShape` | Gets or sets the displayed shape of the spectrum. | +| `HexInputAlphaPosition` | Gets or sets the position of the alpha component in the hexadecimal input box relative to all other color components. | +| `HsvColor` | Gets or sets the currently selected color in the HSV color model. This should be used in all cases instead of the `Color` property. Internally, the `ColorSpectrum` uses the HSV color model and using this property will avoid loss of precision and color drifting. | +| `IsAccentColorsVisible` | Gets or sets a value indicating whether accent colors are visible along with the preview color. | +| `IsAlphaEnabled` | Gets or sets a value indicating whether the alpha component is enabled. When disabled (set to false) the alpha component will be fixed to maximum and editing controls disabled. | +| `IsAlphaVisible` | Gets or sets a value indicating whether the alpha component editing controls (Slider(s) and TextBox) are visible. When hidden, the existing alpha component value is maintained. Note that `IsComponentTextInputVisible` also controls the alpha component TextBox visibility. | +| `IsColorComponentsVisible` | Gets or sets a value indicating whether the color components tab/panel/page (subview) is visible. | +| `IsColorModelVisible` | Gets or sets a value indicating whether the active color model indicator/selector is visible. | +| `IsColorPaletteVisible` | Gets or sets a value indicating whether the color palette tab/panel/page (subview) is visible. | +| `IsColorPreviewVisible` | Gets or sets a value indicating whether the color preview is visible. Note that accent color visibility is controlled separately by `IsAccentColorsVisible`. | +| `IsColorSpectrumVisible` | Gets or sets a value indicating whether the color spectrum tab/panel/page (subview) is visible. | +| `IsColorSpectrumSliderVisible` | Gets or sets a value indicating whether the color spectrum's third component slider is visible. | +| `IsComponentSliderVisible` | Gets or sets a value indicating whether color component sliders are visible. All color components are controlled by this property but alpha can also be controlled with `IsAlphaVisible`. | +| `IsComponentTextInputVisible` | Gets or sets a value indicating whether color component text inputs are visible. All color components are controlled by this property but alpha can also be controlled with `IsAlphaVisible`. | +| `IsHexInputVisible` | Gets or sets a value indicating whether the hexadecimal color value text input is visible. | +| `MaxHue` | Gets or sets the maximum value of the Hue component in the range from 0..359. This property must be greater than `MinHue`. | +| `MaxSaturation` | Gets or sets the maximum value of the Saturation component in the range from 0..100. This property must be greater than `MinSaturation`. | +| `MaxValue` | Gets or sets the maximum value of the Value component in the range from 0..100. This property must be greater than `MinValue`. | +| `MinHue` | Gets or sets the minimum value of the Hue component in the range from 0..359. This property must be less than `MaxHue`. | +| `MinSaturation` | Gets or sets the minimum value of the Saturation component in the range from 0..100. This property must be less than `MaxSaturation`. | +| `MinValue` | Gets or sets the minimum value of the Value component in the range from 0..100. This property must be less than `MaxValue`. | +| `PaletteColors` | Gets or sets the collection of individual colors in the palette. This is not commonly set manually. Instead, it should be set automatically by providing an `IColorPalette` to the `Palette` property. | +| `PaletteColumnCount` | Gets or sets the number of colors in each row (section) of the color palette. Within a standard palette, rows are shades and columns are colors. This is not commonly set manually. Instead, it should be set automatically by providing an `IColorPalette` to the `Palette` property. | +| `Palette` | Gets or sets the color palette. This will automatically set both `PaletteColors` and `PaletteColumnCount` overwriting any existing values. | +| `SelectedIndex` | Gets or sets the index of the selected tab/panel/page (subview). When using the default control theme, this property is designed to be used with the `ColorViewTab` enum. The `ColorViewTab` enum defines the index values of each of the three standard tabs. Use like `SelectedIndex = (int)ColorViewTab.Palette`. | + +:::note +The properties for visibility use the naming pattern "IsThingVisible" rather than "ShowThing" because some elements of the UI have the ability to control both enabled and visible status separately. Naming also matches `Control` in this case. +::: + +## Pseudoclasses + +None + +## Template Parts + +| Name | Type | Description | +|------|----- |-------------| +| `PART_HexTextBox` | TextBox | Provides an input or output for hexadecimal color notation that can be parsed by the control. | +| `PART_TabControl` | TabControl | The main control used to navigate through the spectrum, palette and components tab/panel/page (subviews). This template part is optional and is only required for some validation scenarios of the `SelectedIndex`. | diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/combobox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/combobox.md index d09181b48..666021625 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/combobox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/combobox.md @@ -2,6 +2,10 @@ description: REFERENCE - Built-in Control --- +import ComboBoxMaxDropDownHeightScreenshot from '/img/gitbook-import/assets/combobox1.gif'; +import ComboBoxComplexContentScreenshot from '/img/gitbook-import/assets/combobox2.gif'; +import ComboBoxDataTemplateScreenshot from '/img/gitbook-import/assets/combobox3.gif'; + # Combo Box The combo box presents a selected item and a drop-down button that displays a list of options. The length and height of the combo box are determined by the selected item, unless otherwise defined. @@ -46,7 +50,7 @@ This is basic example with text items has a limit set on the drop-down list heig ``` - + This example uses a composed view for each item: @@ -78,12 +82,10 @@ This example uses a composed view for each item: ``` - + This example binds the items in a combo box using a data template. The C# code-behind loads the installed font family names and binds them to the items property. - - ```xml ``` - ```csharp title='C#' using Avalonia.Controls; using Avalonia.Media; @@ -120,9 +121,7 @@ namespace AvaloniaControls.Views } ``` - - - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/contextmenu.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/contextmenu.md index e674535d5..30e438d5d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/contextmenu.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/contextmenu.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import ContextMenuScreenshot from '/img/gitbook-import/assets/contextmenu.gif'; + # Context Menu The context menu can be applied to any host control to implement a right-click 'context sensitive' menu. This uses an **attached property** of the host control. @@ -25,7 +27,7 @@ This example, a context menu is attached to a multi-line text box: ``` - + ## Context Flyout diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/README.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/README.md index 36cf3a59c..d8e556c06 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/README.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/README.md @@ -2,6 +2,11 @@ description: REFERENCE - Built-in Controls --- +import DataGridNuGetScreenshot from '/img/gitbook-import/assets/image (8) (4).png'; +import DataGridSortColumnScreenshot from '/img/gitbook-import/assets/grid1.gif'; +import DataGridReorderColumnScreenshot from '/img/gitbook-import/assets/grid2.gif'; +import DataGridColumnTypesScreenshot from '/img/gitbook-import/assets/grid3.gif'; + # 数据网格 数据网格以自定义的网格形式展示重复的数据。该控件可以进行样式定制、模板化和绑定。 @@ -20,7 +25,7 @@ description: REFERENCE - Built-in Controls 您必须安装数据网格的_NuGet_包,有几种方法可以做到这一点。您可以使用您的IDE的项目菜单中的**管理NuGet包**: - + 或者,您可以在命令行中运行以下指令: @@ -31,7 +36,7 @@ dotnet add package Avalonia.Controls.DataGrid 或直接在项目(`.csproj`)文件中添加包引用: ```xml - + ``` :::warning @@ -115,7 +120,7 @@ public class Person } ``` - + :::info 这些示例使用了MVVM模式和数据绑定到一个`ObservableCollection`。要了解更多有关数据绑定背后的概念,请参阅[这里](../../../basics/data/data-binding)。 @@ -138,7 +143,7 @@ public class Person ``` - + 这个示例展示了数据网格如何接受更改并更新底层集合,并使用不同的列类型来编辑数据: @@ -195,7 +200,7 @@ public class Person } ``` - + ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/datagridcolumns.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/datagridcolumns.md index 6633f5f3f..fc89b93b1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/datagridcolumns.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/datagrid/datagridcolumns.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import DataGridColumnPreviewScreenshot from '/img/gitbook-import/assets/image (4) (1).png'; + # 数据表格列 数据表格可以包含多个数据表格列,_Avalonia UI_ 提供了两种内置列类型,用于显示不同的数据类型,还有一个可以自定义列外观的模板类型。 @@ -110,7 +112,7 @@ public class Person 在预览窗格中可以看到效果,因为 `` 元素创建了绑定的视图模型: - + ## 更多信息 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/border.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/border.md index d4de07860..86f87ad98 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/border.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/border.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import BorderPodLookScreenshot from '/img/gitbook-import/assets/image (8) (1).png'; +import BorderDropShadowScreenshot from '/img/gitbook-import/assets/image (24) (2).png'; + # Border The border control decorates a (single) child with a border and background. It can also be used to display rounded corners. @@ -29,7 +32,7 @@ When all four values are in the list, _Avalonia UI_ will interpret them using th `CornerRadius="TopLeft TopRight BottomRight BottomLeft"` :::warning -If you use the four value pattern; you must provide all four values, even if one of them is zero. Three values are not permitted in the list. +If you use the four value pattern; you must provide all four values, even if one of them is zero. Three values are not permitted in the list. ::: ### Example @@ -55,7 +58,7 @@ This example adds some border controls to create a 'pod' look in the layout: ``` - + ## Box Shadows @@ -96,7 +99,7 @@ This is an example of a drop-shadow: ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/README.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/README.md index 5efa5ef2a..b9a386dd5 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/README.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/README.md @@ -2,11 +2,16 @@ description: REFERENCE - Built-in Controls --- +import CalendarBasicUsageScreenshot from '/img/gitbook-import/assets/calendar3.gif'; +import CalendarSingleSelectionScreenshot from '/img/gitbook-import/assets/calendar.gif'; +import CalendarMultipleSelectionScreenshot from '/img/gitbook-import/assets/calendar2.gif'; +import CalendarCustomRangeScreenshot from '/img/gitbook-import/assets/calendar4.gif'; + # Calendar The calendar is a control for users to select dates or date ranges. - + ## Useful Properties @@ -26,7 +31,7 @@ This is a basic calendar allowing a single date selection. The calendar's select ``` - + This example allows multiple range selections: @@ -38,7 +43,7 @@ This example allows multiple range selections: After clicking a start date you can extend a single range by holding the shift key and clicking on the end date. You can add extra dates and ranges by holding the control key and clicking on other dates. - + This example has custom start and end dates, and some dates unavailable. This uses C# code behind the window. @@ -68,7 +73,7 @@ public partial class MainWindow : Window - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/calendar-date-picker.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/calendar-date-picker.md index 15386ab20..ff9d76a39 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/calendar-date-picker.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/calendar/calendar-date-picker.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import CalendarDatePickerScreenshot from '/img/gitbook-import/assets/calendardatepicker.gif'; + # Calendar Date Picker This is an extension of the calendar control that includes a text box and button. The calendar shows when the user clicks the button (and hides on a subsequent click). The selected date shows in the text box when a date on the calendar is clicked. @@ -22,7 +24,7 @@ This example shows a basic single date selection calendar when the button is cli ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/menu-flyout.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/menu-flyout.md index 40e6802d9..ff4472eef 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/menu-flyout.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/menu-flyout.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import MenuFlyoutScreenshot from '/img/gitbook-import/assets/menuflyout.gif'; + # Menu Flyout A menu flyout allows you to host a simple menu as the flyout for a control. You might use this as an alternative to the context menu. @@ -32,12 +34,12 @@ This is a simple example of the menu flyout: ``` :::info -Note the `` element will not work in a menu flyout. To make a separator line, use a `` element with the header set to '-' as shown above. +Note the `` element will not work in a menu flyout. To make a separator line, use a `` element with the header set to '-' as shown above. ::: The resulting menu flyout looks like this: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/path-icon.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/path-icon.md index 6d6ea6ba2..288cb4ea9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/path-icon.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/path-icon.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import PathIconHouseScreenshot from '/img/gitbook-import/assets/image (18).png'; + # Path Icon The path icon control can draw an icon graphic from a stream geometry. For example, you can use the icon geometries from the _Avalonia UI_ Fluent icons resource. @@ -20,25 +22,20 @@ You will probably use these properties most often: ## Example - - ```xml ``` - ```xml title='Resources' M17.9999 2C18.1738 2 18.3411 2.06037 18.4742 2.16902L18.5497 2.23991L21.822 5.76824L21.8527 5.80714C21.9544 5.94281 22.0003 6.09665 22.0003 6.24775L21.9988 8.16674C21.9988 9.16092 21.6202 10.0667 20.9994 10.7478L20.9986 21.25C20.9986 21.6297 20.7165 21.9435 20.3504 21.9932L20.2486 22H3.75113C3.37144 22 3.05764 21.7178 3.00798 21.3518L3.00113 21.25L3.00035 10.7478C2.42729 10.1191 2.06067 9.29893 2.00765 8.39453L2.001 8.16674L2.0008 6.29097C1.99273 6.15366 2.02238 6.01238 2.09673 5.88313L2.16199 5.78767L2.20117 5.74193L5.45006 2.23991C5.56833 2.11243 5.7264 2.03081 5.89656 2.00715L5.99989 2H17.9999ZM15.0818 10.4421L15.0699 10.4598C14.371 11.3944 13.2555 11.9993 11.9987 11.9993C10.7349 11.9993 9.61393 11.3876 8.9158 10.4441C8.21835 11.3876 7.0974 11.9993 5.83357 11.9993C5.36446 11.9993 4.91504 11.915 4.49962 11.7608L4.50089 20.499H5.99951L5.99989 13.751C5.99989 13.3713 6.28204 13.0575 6.64812 13.0079L6.74989 13.001H11.2458C11.6255 13.001 11.9393 13.2832 11.989 13.6492L11.9958 13.751L11.9955 20.499H19.4979L19.4981 11.7615C19.0833 11.9153 18.6346 11.9993 18.1662 11.9993C16.9015 11.9993 15.7799 11.3867 15.0818 10.4421ZM10.4949 14.501H7.49989V20.499H10.4949V14.501ZM17.2546 13.001C17.6343 13.001 17.9481 13.2832 17.9978 13.6492L18.0046 13.751V17.253C18.0046 17.6327 17.7225 17.9465 17.3564 17.9962L17.2546 18.003H13.7532C13.3735 18.003 13.0597 17.7209 13.01 17.3548L13.0032 17.253V13.751C13.0032 13.3713 13.2853 13.0575 13.6514 13.0079L13.7532 13.001H17.2546ZM16.5039 14.501H14.5029V16.503H16.5039V14.501ZM8.16589 7.002H3.50089L3.501 8.16674L3.50717 8.33777L3.53555 8.569L3.5683 8.72528L3.61768 8.89726L3.67203 9.0451L3.71271 9.1391C3.74388 9.20697 3.77821 9.27309 3.81551 9.33727L3.91846 9.49873L3.97274 9.57344L4.10151 9.72909L4.24329 9.87318L4.33953 9.95811L4.38162 9.99243C4.69615 10.2429 5.07686 10.4138 5.49329 10.4747L5.67387 10.4939L5.83357 10.4993C7.06813 10.4993 8.07869 9.54019 8.16076 8.32644L8.16614 8.16674L8.16589 7.002ZM14.3309 7.002H9.66589L9.66614 8.16674C9.66614 9.34763 10.5437 10.3236 11.6822 10.478L11.839 10.4939L11.9987 10.4993C13.2333 10.4993 14.2438 9.54019 14.3259 8.32644L14.3313 8.16674L14.3309 7.002ZM20.4979 7.002H15.8329L15.8336 8.16674C15.8336 9.34763 16.7112 10.3236 17.8497 10.478L18.0065 10.4939L18.1662 10.4993C18.7305 10.4993 19.248 10.2989 19.6514 9.96542L19.7412 9.88731L19.857 9.7736L20.0032 9.60441C20.0572 9.53545 20.1075 9.46337 20.1536 9.38849L20.2571 9.20179L20.32 9.06383L20.3783 8.90873L20.4081 8.81314L20.4463 8.66108L20.4747 8.50352L20.4927 8.33678L20.4988 8.16674L20.4979 7.002ZM9.06151 3.499H6.32689L4.46889 5.502H8.44551L9.06151 3.499ZM13.3685 3.499H10.6305L10.0145 5.502H13.9845L13.3685 3.499ZM17.6719 3.499H14.9375L15.5535 5.502H19.5299L17.6719 3.499Z ``` - - It works in the preview pane as well: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabcontrol.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabcontrol.md index 1d0e6ac31..5fc483c22 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabcontrol.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabcontrol.md @@ -2,11 +2,14 @@ description: REFERENCE - Built-in Controls --- +import TabControlZonesScreenshot from '/img/gitbook-import/assets/image (2) (4).png'; +import TabControlNavigationScreenshot from '/img/gitbook-import/assets/tabcontrol1.gif'; + # Tab Control The tab control allows you to sub-divide a view into tab items. - + Each tab item has a header and a content zone. The headers are presented in a strip, in the sequence they occur in the XAML. When the user clicks on a tab header, its content becomes visible, and is placed below the tab strip in the content zone of the tab control. @@ -36,7 +39,7 @@ This is simple tab example. The tab content is just some text: The tab control even works in the preview pane! - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabstrip.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabstrip.md index e6e1ed863..2e7b2cda2 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabstrip.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tabstrip.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import TabStripNavigation from '/img/gitbook-import/assets/tabstrip.gif'; + # Tab Strip Displays a strip of tab headers. You can use this control as a horizontal menu. @@ -26,7 +28,7 @@ You will probably use this property most often: It looks like this running on Windows: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textblock.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textblock.md index 862250b87..e984f1dcc 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textblock.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textblock.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import TextBlockStylePreviewScreenshot from '/img/gitbook-import/assets/image (2) (5).png'; + # Text Block The text block is a read-only label for the display of text. It can display multiple lines, and features full control over the font used. @@ -10,7 +12,13 @@ The text block is a read-only label for the display of text. It can display mult You will probably use these properties most often: -
PropertyDescription
FontSizeThe size of the font.
FontWeightThe weight of the font. Default is normal, options include Bold'.
FontStyleA style to apply to the lettering. Default is normal, options include Italic.
TextDecorationsA line decoration to apply to the lettering. Default is none, options include Underline, Strikethrough, Baseline and Overline. To apply more than one at the same time, list the options with spaces between.
+| Property | Description | +| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| FontSize | The size of the font. | +| FontWeight | The weight of the font. Default is normal, options include `Bold`. | +| FontStyle | A style to apply to the lettering. Default is normal, options include `Italic`. | +| TextDecorations | A line decoration to apply to the lettering. Default is none, options include `Underline`, `Strikethrough`, `Baseline` and `Overline`. To apply more than one at the same time, list the options with spaces between. | +| xml:space | TextBlock itself would respect the line breaks and whitespace of its content as set out in XAML, but it will be filtered out by the parser without `xml:space="preserve"`. | ## Example @@ -19,9 +27,9 @@ This example shows a text block used as a heading, single line and multi-line di ```xml Heading - This is a single line. - This is a multi-line display -that has returns in it. + This is a single line. + This is a multi-line display +that has returns in it. The text block repects the line breaks as set out in XAML. @@ -29,7 +37,7 @@ as set out in XAML. The styling works in the preview pane: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textbox.md index ea0279516..d846e36da 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/textbox.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import TextBoxSampleScreenshot from '/img/gitbook-import/assets/textbox.gif'; + # Text Box The text box presents an area for typed (keyboard) input. It can be for a single or multiple lines of input. @@ -27,7 +29,7 @@ This example has a basic one line text box, a password box, and a text-wrapping ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/timepicker.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/timepicker.md index 611795444..9b1998438 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/timepicker.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/timepicker.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import TimePickerScreenshot from '/img/gitbook-import/assets/timepicker.gif'; + # Time Picker The time picker has two or three 'spinner' controls to allow the user to pick a time value. The time picker can work in 24 or 12 hour formats. The picker controls display when the control is clicked. @@ -24,7 +26,7 @@ This example shows how to create a time picker for the 24 hour clock, with 20 mi ``` - + ## **Initializing the Time** @@ -43,7 +45,7 @@ TimePicker timePicker = new TimePicker }; ``` -You can clear the display by resetting the selected time to null. +You can clear the display by resetting the selected time to null. ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tooltip.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tooltip.md index b98e4a502..c5113c4fd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tooltip.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tooltip.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import ToolTipTextScreenshot from '/img/gitbook-import/assets/tooltip.gif'; +import ToolTipContentScreenshot from '/img/gitbook-import/assets/tooltip2.gif'; + # Tool Tip The tool tip is a popup that shows its content when the user hovers over the 'host' control to which it is attached. @@ -10,7 +13,7 @@ The tool tip is a popup that shows its content when the user hovers over the 'ho You will probably use these properties most often: -
PropertyDescription
ToolTip.TipAttached property for the the tooltip contents.
ToolTip.PlacementDefines the placement for the tooltip relative to the host or the pointer. Choose from top, bottom, left, right, anchor and gravity, pointer. The default value is pointer which places the tip content at the position where the pointer stops moving.
ToolTip.HorizontalOffsetThe tooltip horizontal offset from the placement (default 0).
ToolTip.VerticalOffsetThe tooltip vertical offset from the placement (default 20).
ToolTip.ShowDelayThe the amount of time the pointer has to be still before the the tooltip appears. In microseconds (default 400).
+
PropertyDescription
ToolTip.TipAttached property for the tooltip contents.
ToolTip.PlacementDefines the placement for the tooltip relative to the host or the pointer. Choose from top, bottom, left, right, anchor and gravity, pointer. The default value is pointer which places the tip content at the position where the pointer stops moving.
ToolTip.HorizontalOffsetThe tooltip horizontal offset from the placement (default 0).
ToolTip.VerticalOffsetThe tooltip vertical offset from the placement (default 20).
ToolTip.ShowDelayThe amount of time the pointer has to be still before the tooltip appears. In microseconds (default 400).
## Examples @@ -21,15 +24,15 @@ This is a simple text-based tooltip, using default values for the placement and ToolTip.Tip="This is a rectangle" /> ``` - + To provide a richer presentation for a tooltip, use a `` element. For example: ```markup - - + + Rectangle Some explanation here. @@ -37,7 +40,7 @@ To provide a richer presentation for a tooltip, use a `` element. F ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/transitioningcontentcontrol.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/transitioningcontentcontrol.md index bcab5c5fd..fb1f6ecde 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/transitioningcontentcontrol.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/transitioningcontentcontrol.md @@ -2,9 +2,12 @@ description: REFERENCE - Built-in Controls --- +import TransitioningContentControlFadeScreenshot from '/img/controls/transitioningcontentcontrol/TransitioningContentControl_01.webp'; +import TransitioningContentControlSlideScreenshot from '/img/controls/transitioningcontentcontrol/TransitioningContentControl_02.webp'; + # Transitioning Content Control -The transitioning content control can use a page transition to animate a content change on an inner control. +The transitioning content control can use a page transition to animate a content change on an inner control. You can use this control to display a collection of different images in a slideshow. @@ -28,7 +31,8 @@ In this example, the view model contains a collection of different images to sho ``` - + + In this example, a different page transition has been specified to slide the images horizontally: ```markup @@ -44,7 +48,8 @@ In this example, a different page transition has been specified to slide the ima ``` - + + ## More Information :::info diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tray-icon.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tray-icon.md index 681c5c02d..c7031391f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tray-icon.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/tray-icon.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import TrayIconScreenshot from '/img/gitbook-import/assets/tray.gif'; + # Tray Icon ## Overview @@ -46,7 +48,7 @@ This example defines a simple tray icon menu in the `App.xaml` file : ``` - + ## More Information @@ -57,6 +59,3 @@ For the complete API documentation about this control, see here. :::info View the source code on GitHub [`TrayIcon.cs`](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls/TrayIcon.cs) ::: - - - diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/README.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/README.md index 963ef100d..ba94abb2e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/README.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/README.md @@ -2,6 +2,10 @@ description: REFERENCE - Built-in Controls --- +import TreeDataGridFilesScreenshot from '/img/gitbook-import/assets/files.png'; +import TreeDataGridCountriesScreenshot from '/img/gitbook-import/assets/countries.png'; +import TreeDataGridNuGetScreenshot from '/img/gitbook-import/assets/image (4).png'; + # Tree Data Grid The tree data grid displays hierarchical and tabular data together in a single view. It is a combination of a tree view and data grid. @@ -23,17 +27,19 @@ The control has two modes of operation: This is an illustration of a tree data grid displaying hierarchical data: - + + ## Flat Data This is an illustration An example of a tree data grid displaying flat data: - + + ## NuGet Package Reference You must install the _NuGet_ package for the data grid, there are several ways of doing this. You can use **Manage NuGet Packages** from the project menu of your IDE: - + Alternatively, you can run this instruction from the command line: ```bash diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-flat-treedatagrid.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-flat-treedatagrid.md index 85873a7b4..e139e8440 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-flat-treedatagrid.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-flat-treedatagrid.md @@ -2,19 +2,18 @@ description: REFERENCE - Built-in Controls --- +import FlatTreeDataGridSourceScreenshot from '/img/gitbook-import/assets/treedatagrid2.gif'; + # Flat Tree Data Grid ## Example -In this example the view model contains an observable collection that is filled with data and then used to create a `FlatTreeDataGridSource` property to bind to the source of the tree data grid. The items of the grid are class `Person`. - - +In this example the view model contains an observable collection that is filled with data and then used to create a `FlatTreeDataGridSource` property to bind to the source of the tree data grid. The items of the grid are class `Person`. ``` ``` - ```csharp title='C# View Model' using Avalonia.Controls.Models.TreeDataGrid; using Avalonia.Controls; @@ -58,7 +57,6 @@ namespace AvaloniaControls.ViewModels ``` - ```csharp title='C# Item Class' public class Person { @@ -75,10 +73,8 @@ public class Person } ``` - - The data source also defines how to map the data model to rows and columns in the tree data grid. Because this example displays flat data, the data source is using a `FlatTreeDataGridSource` property on the view model. There are three columns defined with the `TextColumn` class. Each takes a lambda to return the column value. - + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-hierarchical-treedatagrid.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-hierarchical-treedatagrid.md index 9c21c01b8..2606de745 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-hierarchical-treedatagrid.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treedatagrid/creating-a-hierarchical-treedatagrid.md @@ -2,19 +2,18 @@ description: REFERENCE - Built-in Controls --- +import HierarchicalTreeDataGridSourceScreenshot from '/img/gitbook-import/assets/treedatagrid1.gif'; + # Hierarchical Tree Data Grid ## Example -In this example the view model contains an observable collection that is filled with data and then used to create a `HierarchicalTreeDataGridSource` property to bind on to the source of the tree data grid. The items of the grid are class `Person`. - - +In this example the view model contains an observable collection that is filled with data and then used to create a `HierarchicalTreeDataGridSource` property to bind on to the source of the tree data grid. The items of the grid are class `Person`. ``` ``` - ```csharp title='C# View Model' using Avalonia.Controls.Models.TreeDataGrid; using Avalonia.Controls; @@ -99,7 +98,6 @@ namespace AvaloniaControls.ViewModels ``` - ```csharp title='C# Item Class' public class Person { @@ -110,12 +108,10 @@ public class Person } ``` - - -The data source also defines how to map the data model to rows and columns in the tree data grid. Because this example displays hierarchical data, the data source is using a `HierarchicalTreeDataGridSource` property on the view model. +The data source also defines how to map the data model to rows and columns in the tree data grid. Because this example displays hierarchical data, the data source is using a `HierarchicalTreeDataGridSource` property on the view model. There are three columns defined: -The first column is defined with a `HierarchicalExpanderColumn` surrounding. This element contains a `TextColumn` that takes a lambda to return the column value, and another that returns the children for the row. The column will display with a chevron button that expands or contracts the child rows (if any). The remaining columns are defined with `TextColumn` alone. +The first column is defined with a `HierarchicalExpanderColumn` surrounding. This element contains a `TextColumn` that takes a lambda to return the column value, and another that returns the children for the row. The column will display with a chevron button that expands or contracts the child rows (if any). The remaining columns are defined with `TextColumn` alone. - + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treeview-1.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treeview-1.md index 38bd71255..c3ecdfe43 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treeview-1.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/treeview-1.md @@ -2,17 +2,18 @@ description: REFERENCE - Built-in Controls --- +import TreeViewAnimalHierarchyScreenshot from '/img/gitbook-import/assets/tree1.gif'; +import TreeViewEnhancedAnimalHierarchyScreenshot from '/img/gitbook-import/assets/tree2.gif'; + # Tree View -The tree view control can present hierarchical data and allows item selection. The items are templated so you can customise how they are displayed. +The tree view control can present hierarchical data and allows item selection. The items are templated so you can customise how they are displayed. -There are two data sources: the main items source for the control, this gives the root of the hierarchical data. Then then there is the items source in the item template which allows the control to list the next level in the hierarchical data. +There are two data sources: the main items source for the control, this gives the root of the hierarchical data. Then there is the items source in the item template which allows the control to list the next level in the hierarchical data. ## Example -This example uses a MVVM pattern view model to hold some hierarchical data based on a C# node class. In this example, there is a single root node in the `Nodes` collection of the view model: - - +This example uses a MVVM pattern view model to hold some hierarchical data based on a C# node class. In this example, there is a single root node in the `Nodes` collection of the view model: ```xml @@ -24,7 +25,6 @@ This example uses a MVVM pattern view model to hold some hierarchical data based ``` - ```csharp title='C# View Model' using AvaloniaControls.Models; using System.Collections.ObjectModel; @@ -52,7 +52,6 @@ namespace AvaloniaControls.ViewModels } ``` - ```csharp title='C# Node Class' using System.Collections.ObjectModel; @@ -77,16 +76,12 @@ namespace AvaloniaControls.Models } ``` - - By default the root node (or nodes) is shown. The user can expand or contract each node by clicking on the adjacent arrow. Clicking on the node title selects the item. - + This is a development of the previous example with multiple root nodes, a revised item template, and an initial selection made in the view model code: - - ```xml ``` - ```csharp title='C# View Model' using AvaloniaControls.Models; using System.Collections.ObjectModel; @@ -148,7 +142,6 @@ namespace AvaloniaControls.ViewModels } ``` - ```csharp title='C# Node Class' using System.Collections.ObjectModel; @@ -173,11 +166,9 @@ namespace AvaloniaControls.Models } ``` +The tree view adds a scroll bar when it is needed. The selection can be extended by holding down the Ctrl key. - -The tree view adds a scroll bar when it is needed. The selection can be extended by holding down the Ctrl key. - - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/uniform-grid.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/uniform-grid.md index 3ab3a25f0..d55c5a3d1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/uniform-grid.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/uniform-grid.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import UniformGridFrenchFlagScreenshot from '/img/gitbook-import/assets/image (1) (2).png'; + # Uniform Grid The uniform grid divides the available space evenly in both directions, into cells. You can specify how many divisions to use, and these can be different in either direction. @@ -24,7 +26,7 @@ You will probably use these properties most often: ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/viewbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/viewbox.md index da54e4229..e6135a410 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/viewbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/viewbox.md @@ -2,18 +2,26 @@ description: REFERENCE - Built-in Controls --- -# View Box +import ViewboxScaleUniformBothScreenshot from '/img/gitbook-import/assets/scale-uniform-both.gif'; +import ViewboxScaleUniformFillBothScreenshot from '/img/gitbook-import/assets/scale-uniformtofill-both.gif'; +import ViewboxScaleFillBothScreenshot from '/img/gitbook-import/assets/scale-fill-both.gif'; +import ViewboxScaleNoneBothScreenshot from '/img/gitbook-import/assets/scale-none-both.gif'; -The view box is a container control which can scale its contents. The way in which the contents are stretched can be defined, as well as when the stretch will occur (stretch direction). +import ViewboxScaleUniformDownOnlyScreenshot from '/img/gitbook-import/assets/scale-uniform-downonly.gif'; +import ViewboxScaleUniformUpOnlyScreenshot from '/img/gitbook-import/assets/scale-uniform-uponly.gif'; + +# Viewbox + +The `Viewbox` is a container control which can scale its contents. The way in which the contents are stretched can be defined, as well as when the stretch will occur (stretch direction). ## Useful Properties You will probably use these properties most often: | Property | Default | Description | -| ------------------ | ------- | ------------------------------------------------------------ | +| ------------------ | ------- |--------------------------------------------------------------| | `Stretch` | Uniform | Determines how contents are fitted into the available space. | -| `StretchDirection` | Both | Determines when the scaling occurs. | +| `StretchDirection` | Both | Determines when the scaling occurs. | The values for the `Stretch` property are as follows: @@ -29,9 +37,7 @@ The values for the `StretchDirecton` property are as follows: ### Example -This simple example shows a view box scaling up a circle uniformly (both stretch and direction are default). - - +This simple example shows a `Viewbox` scaling up a circle uniformly (both stretch and direction are default). ```markup @@ -39,18 +45,15 @@ This simple example shows a view box scaling up a circle uniformly (both stretch ``` - ### Demonstrations The following demonstrations show the different combinations of stretch and stretch direction property settings. This first set shows the effect of the stretch property: -
Stretch ValueDemonstration
Uniform
UniformToFill
Fill
None
+
Stretch ValueDemonstration
Uniform
UniformToFill
Fill
None
This set of demonstrations shows the effect of the stretch direction property: -
Stretch DirectionDemonstration
Both
- - +
Stretch DirectionDemonstration
UpOnly
DownOnly
## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/wrappanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/wrappanel.md index aaf2544de..b95169f9d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/wrappanel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/detailed-reference/wrappanel.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import WrapPanelHorizontalScreenshot from '/img/gitbook-import/assets/image (5) (1).png'; +import WrapPanelVerticalScreenshot from '/img/gitbook-import/assets/image (15) (1).png'; + # Wrap Panel The wrap panel uses a default arrangement of (multiple) child elements is in sequence from left to right, while they fit in the width. It starts a new line when there is no space left (including any margins and borders). @@ -26,7 +29,7 @@ You will probably use these properties most often: ``` - + ```xml @@ -38,7 +41,7 @@ You will probably use these properties most often: ``` - + ### More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/dockpanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/dockpanel.md index b7b62a0f9..8d11c97c0 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/dockpanel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/dockpanel.md @@ -2,11 +2,14 @@ description: REFERENCE - Built-in Controls --- +import DockPanelTopScreenshot from '/img/gitbook-import/assets/image (23).png'; +import DockPanelFillNoOverlapScreenshot from '/img/gitbook-import/assets/image (3) (2).png'; + # Dock Panel -The dock panel control arranges its child controls along specified 'docking edges' (top, bottom, left, and right) with the last child filling any remaining space. The dock panel can maintain the child control's dimension that is parallel to the docking edge, so that the child fills all the available space along the docking edge. +The dock panel control arranges its child controls along specified 'docking edges' (top, bottom, left, and right) with the last child filling any remaining space. The dock panel can maintain the child control's dimension that is parallel to the docking edge, so that the child fills all the available space along the docking edge. -For example, if the docking edge on a child control is defined as 'top' and it has a height defined, but no width, it will draw like this: +For example, if the docking edge on a child control is defined as 'top' and it has a height defined, but no width, it will draw like this: @@ -16,15 +19,15 @@ You must define the child control dimension perpendicular to the docking edge, o You can optionally define the dimension that is parallel to the docking edge. In this case, the child will be drawn according to the alignment setting in the same direction. For example, a child with a defined width, docked to the top edge, will obey its horizontal alignment property (default center). -Child controls are docked in the sequence that they are defined in the XAML. When _Avalonia UI_ is sizing a child control, the presence of any previously drawn controls is taken into account. That means there is never any overlap. +Child controls are docked in the sequence that they are defined in the XAML. When _Avalonia UI_ is sizing a child control, the presence of any previously drawn controls is taken into account. That means there is never any overlap. -The last child control defined will fill any remaining space. +The last child control defined will fill any remaining space. :::warning You must always define a last child control (with no dock property), or the docking calculation will not perform correctly. This means that a dock panel requires a minimum of two child controls. ::: -## Useful Properties +## Useful Properties You will probably use these properties most often: @@ -44,7 +47,7 @@ Setting the opacity of the orange rectangle to 0.5 demonstrates that there are n ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/expander.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/expander.md index f48c7fc20..f6ba9addd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/expander.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/expander.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import ExpanderClosedScreenshot from '/img/gitbook-import/assets/image (2) (1) (1).png'; +import ExpanderOpenedScreenshot from '/img/gitbook-import/assets/image (12) (2).png'; + # Expander The expander control has a header area (always visible) and a collapsible content section that can contain a single child control. @@ -16,24 +19,24 @@ You will probably use these properties most often: ```xml - - Hidden Search - - - Search - - Case sensitive? - - + + Hidden Search + + + Search + + Case sensitive? + + ``` - + - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/flyouts.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/flyouts.md index 3d792649e..3f19a6158 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/flyouts.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/flyouts.md @@ -2,11 +2,13 @@ description: REFERENCE - Built-in Controls --- +import FlyoutAttachedScreenshot from '/img/gitbook-import/assets/flyout2.gif'; + # Flyout -Flyouts are dismissible containers that can be attached to some classes of 'host' control; although flyouts themselves are not controls. They show when their host control receives the focus, and are hidden again in a number of different ways. +Flyouts are dismissible containers that can be attached to some classes of 'host' control; although flyouts themselves are not controls. They show when their host control receives the focus, and are hidden again in a number of different ways. -A flyout can contain simple or richer, composed, UI content. +A flyout can contain simple or richer, composed, UI content. Flyouts can be declared as a resource and shared between two or more host controls in an _Avalonia UI_ app. @@ -23,7 +25,7 @@ A flyout is attached to a host control using the host's `Flyout` property. For e ``` :::warning -Only the button and split button controls support the `Flyout` property. You can attach a flyout to other _Avalonia UI_ built-in controls using the `AttachedFlyout` property instead. +Only the button and split button controls support the `Flyout` property. You can attach a flyout to other _Avalonia UI_ built-in controls using the `AttachedFlyout` property instead. ::: For controls that do not have the `Flyout` property, use the `AttachedFlyout` property like this: @@ -51,7 +53,7 @@ public void Border_PointerPressed(object sender, PointerPressedEventArgs args) } ``` - + ## Useful Properties diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/grid.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/grid.md index 0531ee2f5..4d875c268 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/grid.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/grid.md @@ -2,6 +2,8 @@ description: REFERENCE - Controls --- +import GridSpanningColumnsScreenshot from '/img/gitbook-import/assets/grid_example.png'; + # Grid The grid control is useful for arranging child controls in columns and rows. You can define absolute, relative, or proportional row and column geometries for the grid. @@ -147,7 +149,7 @@ Here, after the absolute width 100 has been subtracted (for column 0), column 1 The button is drawn to fill the span from the cell (column 1, row 1) plus one column (to the right) and one row down. The result looks like this: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/gridsplitter.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/gridsplitter.md index 78af8112f..8e436abe9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/gridsplitter.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/gridsplitter.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import GridSplitterColumnsScreenshot from '/img/gitbook-import/assets/gridsplitter-in-action-columns.gif'; +import GridSplitterRowsScreenshot from '/img/gitbook-import/assets/gridsplitter-in-action-rows.gif'; + # Grid Splitter The grid splitter control allows a user to resize the columns or rows in a grid at runtime. The splitter is drawn as a column or row (size can be specified), and has a grip that the user can manipulate at runtime. @@ -28,7 +31,8 @@ This is a column splitter: ``` - + + This is a row splitter: ```markup @@ -39,7 +43,7 @@ This is a row splitter: ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/image.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/image.md index 6ceada3da..3dcb408fe 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/image.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/image.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import ImageUnscaledScreenshot from '/img/gitbook-import/assets/image (6) (1).png'; +import ImageUniformToFillScreenshot from '/img/gitbook-import/assets/image (4) (1) (2).png'; + # Image The image can display raster images from a specified image source. The source can be: @@ -43,7 +46,7 @@ In this next example, introducing the stretch setting `UniformToFill` fits in al ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemscontrol.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemscontrol.md index cf4c27284..66ab42278 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemscontrol.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemscontrol.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Control --- +import ItemsControlScreenshot from '/img/gitbook-import/assets/items.gif'; + # Items Control The items control is the basis for controls that display repeating data (like the list box for example). It has no built-in formatting or interactions; but you can use it with data binding, styling and data templates to create a completely custom repeating data control. @@ -20,8 +22,6 @@ You will probably use these properties most often: This example binds an observable collection of crockery items to an items control, where some custom layout and formatting is provided by a data template: - - ```xml List of crockery: @@ -44,7 +44,6 @@ This example binds an observable collection of crockery items to an items contro ``` - ```csharp title='C# View Model' using AvaloniaControls.Models; using System.Collections.Generic; @@ -73,7 +72,6 @@ namespace AvaloniaControls.ViewModels } ``` - ```csharp title='C# Item Class' public class Crockery { @@ -88,11 +86,9 @@ public class Crockery } ``` +The view resizes horizontally, but content is hidden when it is too high. This control does not have a built-in scrollbar (unlike `ListBox`). - -The view resizes horizontally, but content is hidden when it is too high. This control does not have a built-in scrollbar (unlike the list box). - - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemsrepeater.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemsrepeater.md index 18d55cc84..2103be749 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemsrepeater.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/itemsrepeater.md @@ -2,9 +2,12 @@ description: REFERENCE - Built-in Controls --- +import ItemsRepeaterVerticalScreenshot from '/img/gitbook-import/assets/image (2) (6).png'; +import ItemsRepeaterHorizontalScreenshot from '/img/gitbook-import/assets/repeater.gif'; + # Items Repeater -The items repeater can display repeating data from a bound data source. It has both a layout template and a data template. +The items repeater can display repeating data from a bound data source. It has both a layout template and a data template. :::info The items repeater is a port of the UWP `ItemsRepeater` control. For further information see [here](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/items-repeater). @@ -18,9 +21,7 @@ The default layout template is a vertical stack layout, so that items appear in ## Example -This example binds an observable collection of crockery items to an items repeater control, where some custom layout and formatting for each item is provided by the data template: - - +This example binds an observable collection of crockery items to an items repeater control, where some custom layout and formatting for each item is provided by the data template: ```xml @@ -44,7 +45,6 @@ This example binds an observable collection of crockery items to an items repeat ``` - ```csharp title='C# View Model' using AvaloniaControls.Models; using System.Collections.Generic; @@ -73,7 +73,6 @@ namespace AvaloniaControls.ViewModels } ``` - ```csharp title='C# Item Class' public class Crockery { @@ -88,11 +87,9 @@ public class Crockery } ``` + - - - -By default an items repeater will render the items in a vertical stack layout. You can display the items horizontally by overriding this using a `` element, which must contain a stack layout. For example: +By default, an items repeater will render the items in a vertical stack layout. You can display the items horizontally by overriding this using a `` element, which must contain a stack layout. For example: ```xml @@ -124,7 +121,7 @@ By default an items repeater will render the items in a vertical stack layout. Y The items display horizontally, and those too far to the right would be hidden if it were not for the scroll viewer element added around the items repeater. - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/listbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/listbox.md index 124e9770e..9dfedac95 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/listbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/listbox.md @@ -2,6 +2,11 @@ description: REFERENCE - Built-in Controls --- +import ListBoxStringScreenshot from '/img/gitbook-import/assets/listbox1.gif'; +import ListBoxDataTemplateScreenshot from '/img/gitbook-import/assets/listbox2.gif'; +import ListBoxDevToolsScreenshot from '/img/gitbook-import/assets/image (6) (1) (4).png'; +import ListBoxItemStyleScreenshot from '/img/gitbook-import/assets/listbox3.gif'; + # List Box The list box displays items from an items source collection, on multiple lines, and allows individual or multiple selection. @@ -37,15 +42,13 @@ The following selection modes are available for the list box: These values can be combined, for example: ```markup - ``` ## Example This simple example has the `Items` property set to an array in the C# code-behind. - - ```xml Choose an animal: @@ -53,7 +56,6 @@ This simple example has the `Items` property set to an array in the C# code-behi ``` - ```csharp title='C#' using Avalonia.Controls; using System.Linq; @@ -73,13 +75,11 @@ namespace AvaloniaControls.Views } ``` - - - + ## Item Template -You can customize how an item is displayed by using an **data template** inside the list box `ItemTemplate` element. +You can customize how an item is displayed by using an **data template** inside the list box `ItemTemplate` element. :::info To review the concepts behind **data template**, see [here](../../concepts/templates/). @@ -87,8 +87,6 @@ To review the concepts behind **data template**, see [here](../../concepts/templ This example displays each item inside a blue border with rounded corners. The C# code-behind is the same as before: - - ```xml Choose an animal: @@ -105,7 +103,6 @@ This example displays each item inside a blue border with rounded corners. The C ``` - ```csharp title='C#' using Avalonia.Controls; using System.Linq; @@ -125,24 +122,20 @@ namespace AvaloniaControls.Views } ``` +The list is the fill area of the dock panel here, so its height is set to the remaining. This shows the scrollbar in the list box. - -The list is the fill area of the dock panel here, so its height is set to the remaining. This shows the scrollbar in the list box. - - + ## Item Styling Each item displayed in a list box is drawn inside a `ListBoxItem` element. You can see this using the _Avalonia UI Dev Tools_ (F12), using the **Visual Tools** tab. For example: - + The `ListBoxItem` element acts as a container for the content specified in a `ListBox.ItemTemplate` element; but it is not ever defined in the XAML, instead it is generated by _Avalonia UI_. This means you can target a style to customize the `ListBoxItem` elements in a list box. For example, to give the list items a fixed width of 200 and then right-align them: - - ```xml Choose an animal: @@ -157,7 +150,6 @@ This means you can target a style to customize the `ListBoxItem` elements in a l ``` - ```csharp title='C#' using Avalonia.Controls; using System.Linq; @@ -177,9 +169,7 @@ namespace AvaloniaControls.Views }code ``` - - - + ### More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/maskedtextbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/maskedtextbox.md index 9bd466dea..aca831907 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/maskedtextbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/maskedtextbox.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import MaskedTextBoxScreenshot from '/img/gitbook-import/assets/masked.gif'; + # Masked Text Box The masked text box presents an area for typed (keyboard) input, but where the format and characters permitted can be constrained by a mask pattern formed from special characters. @@ -37,7 +39,7 @@ This is a basic example: ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/menu.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/menu.md index 345efd1d1..09ba3ea67 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/menu.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/menu.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import MenuTopDockScreenshot from '/img/gitbook-import/assets/menu.gif'; +import MenuWithIconScreenshot from '/img/gitbook-import/assets/menu2.gif'; + # Menu The menu control can add menu structure to an application. You will usually place a menu at the top edge of a dock panel control, so that it is drawn at the top of a window. @@ -51,7 +54,7 @@ This example creates a menu docked at the top edge of a window. ``` - + ## Accelerator Keys @@ -65,7 +68,7 @@ It allows the user to access a menu item quickly. It is also sometimes called a The user can access this feature by first pressing the Alt key, and then the accelerator key (or they can be pressed together). This is demonstrated in the second of the menu sequences in the example above. -You will see that accelerator keys, where defined, are underlined on the menu as soon as the Alt key is pressed. Then any sub-menus are dropped down as soon as the accelerator key above is pressed. +You will see that accelerator keys, where defined, are underlined on the menu as soon as the Alt key is pressed. Then any sub-menus are dropped down as soon as the accelerator key above is pressed. Once keyboard interaction has been initiated with the Alt key, the user can also navigate the menus using the keyboard arrow keys. Menu items may be selected using the Enter key on the keyboard. @@ -103,7 +106,7 @@ A menu icon can be displayed by placing an image or a path icon in the ` ``` - + :::info For more detailed guidance on how to add icons to your menus, see [here](../../guides/graphics-and-animation/how-to-add-menu-icons.md). diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/nativemenu.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/nativemenu.md index a6b2cc321..bd358d89a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/nativemenu.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/nativemenu.md @@ -10,7 +10,7 @@ The native menu can display a menu on _macOS_ and some Linux distributions. This control can only be used attached to a tray icon. For full details about the tray icon, see the reference [here](detailed-reference/tray-icon.md). ::: -You can create sub-menus by nesting `` elements. +You can create sub-menus by nesting `` elements. You can add menu separator lines by including a `` element or by adding a menu item with its header set to the minus sign, like this: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/numericupdown.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/numericupdown.md index 4ca8a8d88..eb397cc0f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/numericupdown.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/numericupdown.md @@ -2,17 +2,20 @@ description: REFERENCE - Built-in Controls --- +import NumericUpDownBasicScreenshot from '/img/gitbook-import/assets/updown.gif'; +import NumericUpDownFormatStringScreenshot from '/img/gitbook-import/assets/updown2.gif'; + # Numeric Up-Down -The numeric up-down is an editable numeric input with up and down spinner buttons attached. Non-numeric characters are ignored in the input. The value can also be changed by clicking the buttons, or by using the keyboard arrow keys. The the mouse wheel (if present) will also change the value. +The numeric up-down is an editable numeric input with up and down spinner buttons attached. Non-numeric characters are ignored in the input. The value can also be changed by clicking the buttons, or by using the keyboard arrow keys. The mouse wheel (if present) will also change the value. ## Useful Properties You will probably use these properties most often: | Property | Description | -| ----------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `Value` | The value (double). | +|-------------------------|-----------------------------------------------------------------------------------------------------------------------------| +| `Value` | The value (decimal?). | | `Increment` | The increment used by the button spinner, keyboard and mouse wheel. Default increment is 1. | | `Minimum` | The minimum value allowed. | | `Maximum` | The maximum value allowed. | @@ -32,9 +35,9 @@ This is a basic example of a numeric up-down control. There are no limits to the ``` - + -The value and other properties are doubles; so you can create a custom decimal increment/decrement and range if you need to. +The value and other properties are nullable decimals; so you can create a custom decimal increment/decrement and range if you need to. :::info Remember to specify a `FormatString` property when you create a custom decimal increment and range. @@ -51,7 +54,7 @@ For example: ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/panel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/panel.md index 52b6e0136..5e7593e25 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/panel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/panel.md @@ -2,9 +2,11 @@ description: REFERENCE - Built-in Controls --- +import PanelOverlapBlendScreenshot from '/img/gitbook-import/assets/image (7) (1).png'; + # Panel -The panel is the most basic control that can contain multiple child controls. Child controls are drawn according to their horizontal and vertical alignment properties, and in the sequence that they appear in the XAML. Child controls will overlap if they occupy the same space. +The panel is the most basic control that can contain multiple child controls. Child controls are drawn according to their horizontal and vertical alignment properties, and in the sequence that they appear in the XAML. Child controls will overlap if they occupy the same space. :::info For a discussion about using other panels, see [here](../../basics/user-interface/building-layouts/panels-overview.md). @@ -23,7 +25,7 @@ This example uses some 50% opacities to demonstrate that child controls overlap. ``` - + ## Other Panel Controls diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/progressbar.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/progressbar.md index a6b4faf83..a4cc806b9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/progressbar.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/progressbar.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import ProgressBarScreenshot from '/img/gitbook-import/assets/progressbar.png'; + # Progress Bar The progress bar presents a value as a proportionately filled bar, with the option to show a caption. @@ -30,7 +32,7 @@ The progress caption always shows the value with a percentage sign. This is only ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/relativepanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/relativepanel.md index e8730efda..d18670791 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/relativepanel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/relativepanel.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import RelativePanelScreenshot from '/img/gitbook-import/assets/image (19) (2).png'; + # Relative Panel The relative panel control allows you to arrange its child controls by specifying their position relative to other (sibling) child controls, or in relation to the panel itself. Positions are calculated using the inside of the panel control (content zone) and the outer edge of the margin zone of the child controls. @@ -19,10 +21,10 @@ You use attached relative position properties to specify the layout of child con Where `PositionProperty` property is one of the relative position properties (see table below), and `NameOfSibling` is the name property of one of the other child controls. :::danger -It is an error to give the value of a relative position property as the name of the child control itself. That would be a circular reference! +It is an error to give the value of a relative position property as the name of the child control itself. That would be a circular reference! ::: -You can specify up to four relative position properties per child control - for how the top, bottom, left and right edges are to be calculated. +You can specify up to four relative position properties per child control - for how the top, bottom, left and right edges are to be calculated. :::danger It is an error to define the same relative position property twice for the same child control. @@ -67,7 +69,7 @@ This XAML shows how to arrange some child controls in different ways: The result looks like this: - + Here are some notes about the above example: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollbar.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollbar.md index 3a0de31fe..f8b1bc0c1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollbar.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollbar.md @@ -2,26 +2,26 @@ description: REFERENCE - Built-in Controls --- +import ScrollBarScreenshot from '/img/gitbook-import/assets/scrollbar.gif'; + # Scroll Bar -A scroll bar control can be displayed in a horizontal or vertical orientation. The default value (double) range for the scroll bar is 0-100. +A scroll bar control can be displayed in a horizontal or vertical orientation. The default value (double) range for the scroll bar is 0-100. -You can configure the range and how the value changes (small and large steps). Small steps can be controlled by the keyboard arrow keys, and large steps by mouse clicks in the scroll bar track, or by the page-up and page-down keys. +You can configure the range and how the value changes (small and large steps). Small steps can be controlled by the keyboard arrow keys, and large steps by mouse clicks in the scroll bar track, or by the page-up and page-down keys. -## Useful Properties +## Useful Properties You will probably use these properties most often:
PropertyDescription
OrientationThe orientation of the scroll bar.
VerticalAlignmentThe vertical alignment of the scroll bar in its container. Choose from top, bottom, center and stretch.
HorizontalAlignmentThe horizontal alignment of the scroll bar in its container. Choose from left, right, center and stretch.
:::warning -To create a meaningful layout, you will need to use corresponding orientation and alignment properties. For example, a vertical orientation matches a horizontal alignment. +To create a meaningful layout, you will need to use corresponding orientation and alignment properties. For example, a vertical orientation matches a horizontal alignment. ::: ## Example - - ```xml @@ -33,7 +33,6 @@ To create a meaningful layout, you will need to use corresponding orientation an ``` - ```csharp title='C#' using Avalonia.Controls; using Avalonia.Controls.Primitives; @@ -55,11 +54,9 @@ namespace AvaloniaControls.Views } ``` +With the example code-behind, the text block displays the value of the scrollbar. - -With the example code-behind, the text block displays the value of the scrollbar. - - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollviewer.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollviewer.md index c205004e6..d1571345e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollviewer.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/scrollviewer.md @@ -2,11 +2,11 @@ description: REFERENCE - Built-in Controls --- -# Scroll Viewer - -The scroll viewer control can have content that is bigger than its content zone, and will can provide scroll bars to move hidden content into view. +import ScrollViewerScreenshot from '/img/gitbook-import/assets/scrollview.gif'; +# Scroll Viewer +The scroll viewer control can have content that is bigger than its content zone, and will can provide scroll bars to move hidden content into view. A `ScrollViewer` cannot be contained in a control that has infinite height or width (depending on scrolling direction) such as a `StackPanel`. To avoid it, you can either set fixed Height/Width or MaxHeight/MaxWidth or choose another container panel. @@ -20,7 +20,7 @@ You will probably use these properties most often: If you have a control that can itself scroll (see list below) nested inside a scroll viewer, and the user hits a limit on the control, this property sets whether the outer scroll viewer should continue scrolling or not. You enable or disable this behaviour with an attached property on the inner control, using the format: - `ScrollViewer.IsScrollChainingEnabled=[true|false]`. +`ScrollViewer.IsScrollChainingEnabled=[true|false]` This attached property is available on these controls: @@ -48,7 +48,7 @@ This example creates a stack panel that is bigger than the border it is inside. ``` - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/slider.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/slider.md index 2bb4bba5f..ae4923be4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/slider.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/slider.md @@ -2,9 +2,11 @@ description: REFERENCE - Built-in Controls --- +import SliderScreenshot from '/img/gitbook-import/assets/slider.gif'; + # Slider -The slider control presents its numerical value as the relative position of a slider button along the length of a track. The position is relative to maximum and minimum values. +The slider control presents its numerical value as the relative position of a slider button along the length of a track. The position is relative to maximum and minimum values. Drag interaction on the slider button can alter the value between the maximum and minimum values. Keyboard and click interactions can also nudge the value. @@ -34,7 +36,7 @@ Here the maximum and minimum values are default (0 and 100 respectively). The slider looks like this on Windows: - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/splitview.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/splitview.md index 2817b3c10..082a2a723 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/splitview.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/splitview.md @@ -2,6 +2,9 @@ description: REFERENCE - Built-in Controls --- +import SplitViewScreenshot from '/img/gitbook-import/assets/image (5) (5) (1).png'; +import SplitViewCompactScreenshot from '/img/gitbook-import/assets/splitview2.gif'; + # Split View A split view presents a container with two parts: the main content zone and a side pane. The main content zone is always visible. The pane can be expanded and collapsed. The collapsed pane can be completely hidden, or left slightly open - with enough space to host some icon buttons for example. @@ -57,13 +60,13 @@ The display mode property controls how the pane is drawn in its open and closed The control looks like this, running on Windows: - + ## Compact Display Mode You can use the MVVM pattern with the split view control and one of the compact display mode settings to implement a 'tool pane' style UI. There is enough room on the pane when it is closed to display an icon button that opens the pane. - + :::info To learn how to use the split view control in this way, see the guide [here](../../guides/development-guides/how-to-show-and-hide-a-split-view-pane-with-mvvm.md). diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/stackpanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/stackpanel.md index a3c1c73f7..55b5fb89d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/stackpanel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/controls/stackpanel.md @@ -2,6 +2,8 @@ description: REFERENCE - Built-in Controls --- +import StackPanelVerticalRectanglesScreenshot from '/img/gitbook-import/assets/image (14) (2).png'; + # Stack Panel The stack panel arranges its child controls by stacking them horizontally or vertically. The stack panel is often used to arrange a small subsection of the UI on a page. @@ -34,7 +36,7 @@ The following XAML shows how to create a vertical stack panel. The result shows the child controls stretched to fit the width, and the overall height of the stack panel equal to the sum of the child control heights. - + ## More Information diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/jetbrains-rider-ide/jetbrains-rider-setup.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/jetbrains-rider-ide/jetbrains-rider-setup.md index 4a23c22a4..8e826817a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/jetbrains-rider-ide/jetbrains-rider-setup.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/jetbrains-rider-ide/jetbrains-rider-setup.md @@ -2,6 +2,11 @@ description: REFERENCE --- +import RiderWelcomeScreenshot from '/img/gitbook-import/assets/jetbrains-rider-setup-1-rider-welcome.png'; +import RiderConfigurePluginReposScreenshot from '/img/gitbook-import/assets/jetbrains-rider-setup-2-configure-plugin-repos.png' +import RiderEnterPluginRepoScreenshot from '/img/gitbook-import/assets/jetbrains-rider-setup-3-enter-plugin-repo.png'; +import RiderInstallAvaloniaPluginScreenshot from '/img/gitbook-import/assets/jetbrains-rider-setup-4-plugin-install.png'; + # JetBrains Rider 设置 要设置 _JetBrains Rider_ 以用于开发 _Avalonia UI_,请按照以下步骤进行: @@ -50,21 +55,21 @@ Rider将为您提供 _Avalonia UI_ 最佳的开发体验。它适用于Windows - 点击**Configure**,然后在下拉菜单中点击**Plugins**。 - + **Preferences** 窗口将打开。 - 点击设置(齿轮图标),然后在弹出菜单中点击**Manage Plugin Repositories...**。 - + - 在**Custom Plugin Repositories**对话框中,点击加号(`+`)图标,输入URL `https://plugins.jetbrains.com/plugins/dev/14839` ,然后点击**OK**。 - + - 回到 Preferences 窗口,点击**Marketplace**并在搜索框中输入 `Avalonia`。在搜索结果窗格中看到**AvaloniaRider**时,点击**Install**。 - + - 安装完成后,点击**Restart IDE**(按钮出现)。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/stay-up-to-date/upgrade-from-0.10.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/stay-up-to-date/upgrade-from-0.10.md index e0fe5c7a9..c0580e17f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/stay-up-to-date/upgrade-from-0.10.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/stay-up-to-date/upgrade-from-0.10.md @@ -280,7 +280,7 @@ var focusManager = TopLevel.GetTopLevel(control).FocusManager; 此外,`IFocusManager` API 已更改。 -- 要获取当前聚焦的元素,请使用 `IFocusManager.GetFocusedEleemnt()` +- 要获取当前聚焦的元素,请使用 `IFocusManager.GetFocusedElement()` - 要聚焦一个控件,请使用 `control.Focus()` 目前没有监听 `IFocusManager` 的焦点更改的事件。要监听焦点更改,请添加一个监听器到 `InputElement.GotFocusEvent`: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-and-layout-controls.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-and-layout-controls.md index a12e23629..0b6f6b896 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-and-layout-controls.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-and-layout-controls.md @@ -2,6 +2,11 @@ description: TUTORIALS - Music Store App --- +import MusicStoreBuyButtonScreenshot from './images/buy-button.png'; +import MusicStoreFinishedAddButtonScreenshot from '/img/gitbook-import/assets/image (13) (2).png'; +import MusicStoreAddStylesScreenshot from './images/add-styles.png'; +import MusicStorePrettyButtonScreenshot from './images/pretty-button.png'; + # 添加并排版控件 应用程序的主窗口最终将显示用户收藏的专辑封面列表,右上角会有一个按钮,允许用户添加新的专辑,该按钮将打开一个搜索对话框,用于查找要添加的新专辑。 @@ -34,7 +39,7 @@ description: TUTORIALS - Music Store App - Click **Debug** to compile and run the project. -![](images/buy-button.png) +

您将看到按钮已经出现,但它处于默认位置,而非按照需求所属位于窗口的右上角。 @@ -58,9 +63,7 @@ description: TUTORIALS - Music Store App 点击[这里](./),回顾一下完整的应用程序的外观。 -
- -
+ 您将看到按钮显示一个图标,而不是文本(目前的情况)。这实际上是来自 Fluent Icons 集合的 Microsoft Store 图标,而 Avalonia UI 为您提供了所有这些图标的定义供您使用。 @@ -77,7 +80,7 @@ description: TUTORIALS - Music Store App - 在 _Rider_ 解决方案资源管理器中,右键单击项目。 - 点击 **添加**,然后点击 **Avalonia Styles**。 -![](images/add-styles.png) +

- 输入 **名称** 'Icons',然后按回车键。 - 找到并打开新创建的 **Icons.axaml** 文件。XAML 代码将如下所示: @@ -148,6 +151,6 @@ description: TUTORIALS - Music Store App - 点击 **调试** 以编译和运行项目。 -![](images/pretty-button.png) +

在下一页中,您将学习如何将视图中的按钮(MVVM 模式中的视图)链接到视图模型中的命令,以便它可以在那里执行应用程序逻辑。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-content-to-dialog.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-content-to-dialog.md index 18ebd690c..0873b23a7 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-content-to-dialog.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-content-to-dialog.md @@ -2,15 +2,15 @@ description: TUTORIALS - Music Store App --- +import MusicStoreDialogContentDiagram from '/img/gitbook-import/assets/image (9) (3).png'; + # 添加对话框内容 在这个页面上,您将学习如何向对话框窗口添加一些内容。这些内容将包括搜索控件和对话框关闭按钮,以及一个用于显示专辑封面的占位符列表。这些封面将作为搜索结果加载。 为了布局对话框控件,您将使用 _Avalonia UI_ 内置控件中的停靠面板布局控件。这将使搜索控件无论高度如何,都始终位于对话框的顶部,按钮位于底部。列表将会是停靠面板的“填充”区域,因此它将始终占据所有剩余的内容区域。 -
- -
+ :::info 有关停靠面板控件的完整信息,请参阅[此处](../../reference/controls/dockpanel.md)的参考文档。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-items-to-users-collection.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-items-to-users-collection.md index 8127a4ea3..43ba93391 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-items-to-users-collection.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/add-items-to-users-collection.md @@ -2,6 +2,8 @@ description: TUTORIALS - Music Store App --- +import MusicStoreAddedAlbumsScreenshot from './images/image-20210310175949319.png'; + # 将项目添加到用户的集合中 在本页中,您将实现一个包含用户使用搜索对话框和 **购买专辑** 按钮选择的专辑的集合,并在主窗口中显示它们。 @@ -78,7 +80,7 @@ xmlns:views="clr-namespace:Avalonia.MusicStore.Views" - 点击 **购买专辑**。 - 再次重复。 -![](images/image-20210310175949319.png) +

您将看到在搜索和选择时用户的专辑集合正在构建。但是,如果停止运行应用程序,然后再次启动它,集合将恢复为空。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/album-view.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/album-view.md index 1dcbfa0fd..a110bef3d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/album-view.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/album-view.md @@ -2,6 +2,10 @@ description: TUTORIALS - Music Store App --- +import MusicStoreBeforeTemplateScreenshot from '/img/gitbook-import/assets/image (6) (1) (3) (1).png'; +import MusicStoreBeforeWrapPanelScreenshot from './images/image-20210310010932979.png'; +import MusicStoreWrapPanelScreenshot from './images/image-20210310011526700.png'; + # 专辑视图 在这个页面上,您将通过用图形化的专辑磁贴替换当前显示的文本,继续开发应用程序的搜索结果列表。 @@ -58,9 +62,7 @@ description: TUTORIALS - Music Store App 正如您在上一页中看到的,此时专辑列表只显示了专辑视图模型类的(完全限定的)名称。 -
- -
+ 在这一步中,您将使用项目中由解决方案模板添加的视图定位器类(**ViewLocator.cs** 文件)。该类已经在 **App.axaml** 文件中以数据模板的形式被注册到应用程序的最高级别。数据模板的注册如下所示: @@ -101,7 +103,7 @@ public class AlbumViewModel : ViewModelBase - 单击 **调试** 以编译并运行项目。 - 单击图标按钮。 -![](images/image-20210310010932979.png) +

视图定位器找到了视图 `AlbumView`,并将其用作列表项的数据模板。 @@ -134,6 +136,6 @@ public class AlbumViewModel : ViewModelBase - 单击 **调试** 以编译并运行项目。 - 单击图标按钮。 -![](images/image-20210310011526700.png) +

在下一页中,您将以数据服务的形式添加一些业务逻辑,以便您可以从搜索中获取真实的专辑数据。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-a-modern-looking-window.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-a-modern-looking-window.md index 2bfd5d5cf..d14bf8723 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-a-modern-looking-window.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-a-modern-looking-window.md @@ -2,6 +2,10 @@ description: TUTORIALS - Music Store App --- +import MusicStoreDarkModePreviewScreenshot from './images/dark-mode-preview.png'; +import MusicStoreAcrylicMaterialScreenshot from './images/acrylic-material.png'; +import MusicStoreFullAcrylicWindowScreenshot from './images/full-acrylic-window.png'; + # 窗口样式 在本页中,您将通过对窗口背景应用暗色主题和亚克力模糊效果,来使主窗口看起来现代化。 @@ -27,7 +31,7 @@ description: TUTORIALS - Music Store App 预览窗格现在会切换到暗色模式。 -![](images/dark-mode-preview.png) +

## 亚克力模糊效果 @@ -65,7 +69,7 @@ description: TUTORIALS - Music Store App - 单击 **调试**(IDE 右上角)以编译并运行项目。 -![](images/acrylic-material.png) +

注意,正如预期的那样,亚克力窗口效果覆盖了主窗口的内容区域,但该效果还尚未延伸到标题栏。 @@ -89,6 +93,6 @@ description: TUTORIALS - Music Store App - 单击 **调试** 以编译并运行项目。 -![](images/full-acrylic-window.png) +

现在,您已经将亚克力模糊效果延伸到标题栏中。在下一页中,您将学习如何在窗口中添加并排版控件。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-the-project.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-the-project.md index 7fb28519b..f8e131381 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-the-project.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/creating-the-project.md @@ -2,6 +2,11 @@ description: TUTORIALS - Music Store App --- +import MusicStoreCreateSolutionScreenshot from './images/CreateSolution.png'; +import MusicStoreProjectStructureScreenshot from './images/project-structure.png'; +import MusicStoreRiderDebugButtonScreenshot from './images/debug-button.png' +import MusicStoreNewAppScreenshot from './images/image-20210310192926578.png' + # 创建一个新项目 在本页面上,您将学习如何为应用程序创建一个新项目。 @@ -22,15 +27,11 @@ description: TUTORIALS - Music Store App - 向**解决方案名称**输入 “Avalonia.MusicStore”。 - 点击**创建**。 -
- -
+

这将创建一个新项目,其中包含以下解决方案文件夹和文件: -
- -
+

花一些时间来查看解决方案模板创建的文件和文件夹。您将看到根据 MVVM 模式,创建了以下文件夹: @@ -47,10 +48,10 @@ description: TUTORIALS - Music Store App 按下 IDE 右上角的调试按钮以编译和运行项目。 -![](images/debug-button.png) +

这将显示一个窗口,看起来像这样: -![](images/image-20210310192926578.png) +

它虽然有点简单,但是现在您已经有了一个运行中的应用程序,并且有一个空白的画布可以开始开发。在下一页中,您将学习如何添加一个现代化的亚克力模糊深色背景。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/displaying-images.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/displaying-images.md index d4d9e3f26..5bee9ff34 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/displaying-images.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/displaying-images.md @@ -2,6 +2,8 @@ description: TUTORIALS - Music Store App --- +import MusicStoreDisplayingImagesScreenshot from './images/image-20210310173858088.png'; + # 展示图象 在本页中,您将学习如何从搜索结果中获取每个专辑的封面图像,在每个专辑磁贴视图上显示图像,而不是占位符音符图标。 @@ -199,7 +201,7 @@ private async void DoSearch(string s) - 将此数据绑定和转换器添加到下面的面板元素中: ``` -IsVisible="{Binding Cover, Converter={x:Static ObjectConverters.IsNull}}" +IsVisible="{Binding Cover, Converter={x:Static ObjectConverters.IsNotNull}}" ``` 转换器是数据绑定表达式的扩展,可以在传递给绑定控件之前转换绑定值。`IsNull` 转换器返回一个布尔值,当值对象为 null 时为 true。 @@ -212,7 +214,7 @@ IsVisible="{Binding Cover, Converter={x:Static ObjectConverters.IsNull}}" - 单击图标按钮。 - 输入一些搜索文本。 -![](images/image-20210310173858088.png) +

注意专辑封面逐个加载,并且界面保持响应。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/index.md index 4cd89d473..d6026cb8d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/index.md @@ -2,11 +2,13 @@ description: TUTORIALS --- +import MusicStoreFinishedAppScreenshot from './images/image-20210310184538120.png'; + # 音乐商店应用 在本教程中,您将创建一个基于音乐商店概念的桌面应用程序。该应用程序具有高度图形化的界面,显示专辑封面图像,并使用半透明的“亚克力”效果模糊窗口背景,使其具有非常时尚的外观。在本教程结束时,您将能够搜索 iTunes 在线专辑列表,并选择专辑添加到您自己的列表中。 -![](images/image-20210310184538120.png) +

在本教程中,您将使用 MVVM 模式和 _ReactiveUI_ 框架来管理多个应用程序窗口。您还将使用高级异步技术来实现专辑搜索和其他功能,以保持应用程序的响应性。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/load-data-at-startup.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/load-data-at-startup.md index 003c365d1..ca4baf89c 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/load-data-at-startup.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/load-data-at-startup.md @@ -2,6 +2,8 @@ description: TUTORIALS - Music Store App --- +import MusicStoreLoadedDataStartScreenshot from './images/image-20210310184202271.png'; + # 在启动时加载数据 在本页上,您将添加代码以在应用程序启动时从磁盘加载用户的专辑收藏。 @@ -49,4 +51,4 @@ RxApp.MainThreadScheduler.Schedule(LoadAlbums); - 点击**调试**以编译和运行项目。 -![](images/image-20210310184202271.png) +

diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/mock-search.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/mock-search.md index b16df2697..bfc5ef343 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/mock-search.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/mock-search.md @@ -2,6 +2,8 @@ description: TUTORIALS - Music Store App --- +import MusicStoreMockSearchScreenshot from './images/text-list.png'; + # 模拟搜索 在本页面上,您将为专辑搜索功能创建视图模型,然后将其绑定到新用户控件上的控件上。现在,您将使用模拟的搜索,以便专注于视图模型。 @@ -141,6 +143,6 @@ public MusicStoreViewModel() - 点击 **调试** 编译并运行项目。 -![](images/text-list.png) +

这表明从视图模型中的专辑集合到视图中的列表的数据绑定正在工作,但是视图还没有图形化。在下一页中,您将通过用图形化的专辑磁贴替换文本来进一步开发应用程序。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/opening-a-dialog.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/opening-a-dialog.md index ff47fdc9b..3a68fb0e0 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/opening-a-dialog.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/opening-a-dialog.md @@ -2,6 +2,9 @@ description: TUTORIALS - Music Store App --- +import MusicStoreAddWindowScreenshot from './images/add-window.png'; +import MusicStoreDialogOpenedScreenshot from './images/dialog-opened.png'; + # 打开对话框 在本页面中,您将学习如何使用 _ReactiveUI_ 在应用程序中管理另一个窗口。新窗口最终将包含一个搜索功能,并且有一个按钮可以将找到的专辑封面之一添加到主窗口的列表中。这个新窗口将作为对话框打开,也就是说,在它显示的时候会阻止主窗口的活动。 @@ -18,7 +21,7 @@ description: TUTORIALS - Music Store App - 在提示输入名称时,输入 'MusicStoreWindow'。 - 按下回车键。 -![](images/add-window.png) +

## 对话框窗口样式 @@ -213,7 +216,7 @@ namespace AvaloniaApplication11.Views - 点击 **调试** 以编译和运行项目。 - 点击图标按钮。 -![](images/dialog-opened.png) +

现在对话框窗口在主窗口内居中打开。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/searching-for-albums.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/searching-for-albums.md index 6432b64bb..847b999fd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/searching-for-albums.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/music-store-app/searching-for-albums.md @@ -2,6 +2,11 @@ description: TUTORIALS - Music Store App --- +import MusicStoreiTunesSearchNugetScreenshot from './images/image-20210310013703557.png'; +import MusicStoreAlbumModelDiagram from '/img/gitbook-import/assets/image (2) (1) (3).png'; +import MusicStoreAlbumMvvmDiagram from '/img/gitbook-import/assets/image (25) (4).png'; +import MusicStoreAlbumViewScreenshot from './images/image-20210310110401944.png'; + # 专辑服务 在这一页中,您将为应用程序添加一些业务逻辑。这将允许您替换模拟数据,并从搜索中获取一些真实的专辑数据。这个业务逻辑代码形成了 MVVM 模式中的“模型”部分。 @@ -16,7 +21,7 @@ description: TUTORIALS - Music Store App - 右键单击项目。 - 单击 **管理 NuGet 软件包**。 -![](images/image-20210310013703557.png) +

- 在左上角的搜索框中键入 “itunes”。 - 单击 **iTunesSearch**,然后单击 **安装**。 @@ -25,9 +30,7 @@ description: TUTORIALS - Music Store App 在本教程中,应用程序很简单,您可以在同一个类中实现 MVVM 模式的“模型”部分所需的业务服务。这个类将包含专辑的数据模型和搜索所需的方法。 -
- -
+ 按照以下步骤添加专辑业务逻辑: @@ -80,9 +83,7 @@ namespace Avalonia.MusicStore.Models 在这一步中,您将使用视图模型和(业务逻辑)模型之间的依赖关系的常见模式。这是指视图模型包含数据模型的一个实例,然后根据需要公开其某些属性以进行显示。 -
- -
+ 按照以下步骤准备专辑视图模型: @@ -201,6 +202,6 @@ namespace Avalonia.MusicStore.ViewModels - 点击图标按钮。 - 输入一些搜索文本。 -![](images/image-20210310110401944.png) +

在下一页中,您将学习如何通过获取每个专辑的封面艺术来改善应用程序的外观。磁铁将会显示封面图像,而非音符图标。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-a-data-context.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-a-data-context.md index 690b58e9b..f3723ae94 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-a-data-context.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-a-data-context.md @@ -2,13 +2,16 @@ description: TUTORIALS - To Do List App --- +import ToDoDataContextResolvedArchitectureDiagram from '/img/gitbook-import/assets/image (20) (3).png'; +import ToDoDataContextResolvedScreenshot from '/img/gitbook-import/assets/image (5) (1) (2).png'; + # 添加数据上下文 在本页面中,您将把待办事项列表视图的数据上下文设置为 `ToDoList` 属性。 要设置数据上下文,请按照以下步骤进行: -- 在 **Views** 文件夹中找到 **MainWindowView.axaml** 文件。 +- 在 **Views** 文件夹中找到 **MainWindow.axaml** 文件。 - 完全删除 `` 标签。 - 将 `x:DataType="vm:MainWindowViewModel"` 属性添加到 `` 元素。 - 定位到内容 ``。 @@ -34,14 +37,8 @@ description: TUTORIALS - To Do List App 因此,当数据上下文绑定解析后,排列如下所示: -
- -
- + 现在,如果运行应用程序,_Avalonia UI_ 绑定器将拥有一个适合的数据上下文来进行项控件绑定,并且项目将显示在视图中: -
- -
- + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-item-buttons.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-item-buttons.md index efb3ed58c..d140d244c 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-item-buttons.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/add-item-buttons.md @@ -2,6 +2,9 @@ description: TUTORIALS - To Do List App --- +import ToDoOkDisabledScreenshot from '/img/gitbook-import/assets/image (21) (2).png'; +import ToDoOkEnabledScreenshot from '/img/gitbook-import/assets/image (41).png'; + # 添加项目按钮 在本页面中,您将学习如何通过为添加事项视图中的按钮添加操作来完成待办事项列表应用程序。您将包括一些显示功能,该功能在用户输入后禁用 OK 按钮。 @@ -134,13 +137,8 @@ CancelCommand = ReactiveCommand.Create(() => { }); 运行应用程序并点击 **Add Item**。现在您应该会看到,只有在描述输入框中输入一些文本时,OK 按钮才会启用。 -
- -
+ - -
- -
+ 在下一页中,您将学习如何处理新的待办事项,以便在用户点击 OK 后出现在列表中。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/adding-new-items.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/adding-new-items.md index 7eef4dcc9..7665da099 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/adding-new-items.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/adding-new-items.md @@ -2,6 +2,8 @@ description: TUTORIALS - To Do List App --- +import ToDoAddNewItemsScreenshot from '/img/gitbook-import/assets/image (44).png'; + # 添加新项目 在本教程的早期阶段,当您创建 `ToDoListView` 用户控件时,您添加了一个按钮,以便用户可以添加新项目。在本页面中,您将为按钮添加一个动作。 @@ -74,14 +76,12 @@ dotnet new avalonia.usercontrol -o Views -n AddItemView --namespace ToDoList.Vi 这样,您就得到了一个如下图所示的视图: -
- -
+ 新视图有一个文本框控件,其中有三个属性供您查看: * `AcceptsReturn` 创建一个多行文本框。 -* `Text` 将文本框中显示的文本绑定到视图模型上的 `Description` 属性(您还没有创建视图模型)。 +* `Text` 将文本框中显示的文本绑定到视图模型上的(您在上面创建的) `Description` 属性。 * `Watermark` 当文本框为空时显示一个占位符。 在下一页中,您将学习如何更改主窗口中的视图,以在待办事项列表视图的位置显示新项目视图。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/conclusion.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/conclusion.md index 83545827a..0e40d5909 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/conclusion.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/conclusion.md @@ -2,6 +2,8 @@ description: TUTORIALS - To Do List App --- +import ToDoFinalArchitectureDiagram from '/img/gitbook-import/assets/image (2) (3).png'; + # 结论 在本页面中,您将了解为什么以这种方式实现应用程序,并推荐一些进一步阅读。 @@ -10,9 +12,7 @@ description: TUTORIALS - To Do List App 本教程使用了一个应用程序解决方案架构,该架构采用MVVM模式,并在主窗口的内容之间进行交换以在页面之间导航,同时保留“顶层”视图模型以提供应用程序状态。页面(视图)由 _Avalonia UI_ 用户控件组成。 -
- -
+ 这个教程应用程序针对的是 `Windows` 平台,其中存在主窗口,因此可能看起来是一种过于复杂的方法。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-new-project.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-new-project.md index 1a687b814..30733756d 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-new-project.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-new-project.md @@ -2,9 +2,16 @@ description: TUTORIALS - To Do List App --- +import ToDoCreateNewProjectScreenshot from '/img/gitbook-import/assets/image (43).png'; +import ToDoNewSolutionScreenshot from '/img/gitbook-import/assets/image (3) (1) (1).png'; + # 创建新项目 -在本页中,您将学习如何为待办事项列表应用创建一个新项目。 +在本页中,您将学习如何为待办事项列表应用创建一个新项目。有两种方式可以选择: + +1. **Visual Studio Extension Template**: If you prefer using Visual Studio, follow the instructions below to create your project. + +2. **.NET Core CLI Command**: Alternatively, if you prefer command-line tools, you can use the .NET Core CLI command. Here's how: ## Visual Studio @@ -14,9 +21,7 @@ description: TUTORIALS - To Do List App 有关扩展的完整说明,请参阅:[这里](../../get-started/install-the-avalonia-extension.md). ::: -
- -
+

@@ -31,9 +36,7 @@ description: TUTORIALS - To Do List App 新创建的解决方案将如下所示: -
- -
+ ## .NET Core CLI @@ -53,21 +56,21 @@ dotnet new avalonia.mvvm -o ToDoList -n ToDoList ```bash ToDoList - |- App.axaml - |- App.axaml.cs - |- app.manifest |- Assets | |- avalonia-logo.ico - |- Models - |- Program.cs - |- ToDoList.csproj - |- ViewLocator.cs + |- Models |- ViewModels | |- MainWindowViewModel.cs | |- ViewModelBase.cs |- Views | |- MainWindow.axaml - | |- MainWindow.axaml.cs + | | |- MainWindow.axaml.cs + |- App.axaml + | |- App.axaml.cs + |- app.manifest + |- Program.cs + |- ViewLocator.cs + |- ToDoList.csproj ``` ## MVVM 项目结构 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view-model.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view-model.md index f5e7c1a15..5df594a79 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view-model.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view-model.md @@ -2,6 +2,8 @@ description: TUTORIALS - To Do List App --- +import MvvmArchitectureDiagram from '/img/gitbook-import/assets/image (3) (1) (2).png'; + # 创建视图模型 在本页中,您将学习如何创建一个视图模型,为应用程序提供应用程序逻辑。这是 MVVM 模式的最后一部分,并且它将使用 _ReactiveUI_ 框架。 @@ -47,9 +49,7 @@ namespace ToDoList.ViewModels 在开始填充视图模型数据之前,再次查看 MVVM 模式: -
- -
+ 该模式的声明目的是将视图和视图模型分开,以便例如可以独立测试视图模型。这消除了视图和视图模型之间的依赖关系。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view.md index f50bc2f72..680ead1dc 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/creating-a-view.md @@ -2,6 +2,8 @@ description: TUTORIALS - To Do List App --- +import ToDoCreateANewViewScreenshot from '/img/gitbook-import/assets/image (1) (1).png'; + # 创建新视图 在本页中,您将添加一个视图来显示待办事项列表,其中包含一个添加新项目的按钮。 @@ -102,7 +104,4 @@ namespace ToDoList.Views 如果您使用 Visual Studio 扩展,完成构建后应该可以在预览器中看到控件内容的显示: -
- -
- + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/locating-views.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/locating-views.md index b85ccc266..975b35087 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/locating-views.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/locating-views.md @@ -2,6 +2,8 @@ description: TUTORIALS - To Do List App --- +import ToDoViewLocatorArchitectureDiagram from '/img/gitbook-import/assets/image (45).png'; + # 视图定位器 在本页面中,您将学习到解决方案模板向您的项目添加的视图定位器类是如何使用的。您将看到这如何在主窗口的内容区域内实现“约定优于配置”的范例。 @@ -74,9 +76,7 @@ namespace ToDoList 由于没有其他数据模板匹配,搜索最终会到达应用程序数据模板元素中的 `ViewLocator`。这将运行其检查,如果检查通过,则返回对应视图的实例。在您的应用程序中,这将是待办事项列表视图。 -
- -
+ 通过这种方式,主窗口的内容根据视图模型的类型和命名约定设置为正确的视图。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/main-window-content.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/main-window-content.md index fcf8b7d65..493b107e9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/main-window-content.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/main-window-content.md @@ -2,6 +2,8 @@ description: TUTORIALS - To Do List --- +import ToDoMainWindowContentScreenshot from '/img/gitbook-import/assets/image (4) (1) (1).png'; + # 主窗口内容 此时,您的主窗口仍然显示解决方案模板创建的问候文本。在本页中,您将更改主窗口的内容区域,使其显示您的新用户控件。 @@ -66,8 +68,6 @@ dotnet run 您将看到主窗口,带有新的标题和用户控件: -
- -
+ 这只是视图 - 目前还没有任何实际功能!在接下来的页面上,您将学习如何创建应用程序的工作部分:模型和视图模型。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/navigate-views.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/navigate-views.md index 89479cde6..638f56de4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/navigate-views.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/navigate-views.md @@ -2,13 +2,16 @@ description: TUTORIALS - To Do List App --- +import ToDoNavigationConceptDiagram from '/img/gitbook-import/assets/image (40).png'; +import ToDoNavigationArchitectureDiagram from '/img/gitbook-import/assets/image (38) (2).png'; +import ToDoBeforeNavigationScreenshot from '/img/gitbook-import/assets/image (43) (1).png'; +import ToDoAfterNavigationScreenshot from '/img/gitbook-import/assets/image (21) (1).png'; + # 导航视图 在本页面中,您将学习如何在单击**Add Item**按钮时更改主窗口内容区域中的视图,以显示新项目视图。 -
- -
+ 到目前为止,在本教程中,您已经使用了 MVVM 模式。这意味着应用程序逻辑受到视图模型的控制,而负责在主窗口中显示的视图模型是主窗口视图模型。 @@ -83,9 +86,7 @@ namespace ToDoList.ViewModels
``` -
- -
+ ## 按钮命令 @@ -125,17 +126,9 @@ For information about the concept of binding source expressions, see [here](../. 现在,如果运行应用程序并单击 **Add Item**,您将看到新视图出现。 -
- -
- -
- -
- -
+ -
+ 您有没有注意到这种行为?主窗口交换了其内容区域绑定的视图模型,显示正确加载了添加项目视图! diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/process-a-new-item.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/process-a-new-item.md index 9f4fc0320..9875b82fd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/process-a-new-item.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/process-a-new-item.md @@ -80,8 +80,8 @@ Observable.Merge( 您会记得两个反应式命令的声明是不同的。它们是: ```csharp -public ReactiveCommand Ok { get; } -public ReactiveCommand Cancel { get; } +public ReactiveCommand OkCommand { get; } +public ReactiveCommand CancelCommand { get; } ``` OK 命令在执行时生成一个 `ToDoItem` 类型的对象,而取消命令只生成一个 `Unit` 类型的对象。`Unit` 是 `void` 的反应式版本 - 它表示命令生成的值为空,但仍然通知命令已执行! @@ -101,7 +101,7 @@ OK 命令在执行时生成一个 `ToDoItem` 类型的对象,而取消命令 { ToDoListViewModel.ListItems.Add(newItem); } - ContentViewModel = ToDoListViewModel; + ContentViewModel = ToDoList; }); ``` @@ -110,7 +110,7 @@ OK 命令在执行时生成一个 `ToDoItem` 类型的对象,而取消命令 如果值为空,则表示点击了取消按钮 - 此时无需进一步操作;只需恢复主窗口内容以显示(未更改的)待办事项列表。 ```csharp -ContentViewModel = ToDoListViewModel; +ContentViewModel = ToDoList; ``` 如果值不为空,则表示点击了 OK 按钮;在这种情况下,值应该是包含用户输入的描述的 `ToDoItem` 对象。因此,可以将其添加到列表中。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/wiring-up-the-views.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/wiring-up-the-views.md index 9987879e2..e8d89e004 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/wiring-up-the-views.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorials/todo-list-app/wiring-up-the-views.md @@ -2,6 +2,9 @@ description: TUTORIALS - To Do List App --- +import ToDoDataContextWiringDiagram from '/img/gitbook-import/assets/image (7) (3).png'; +import ToDoBlankAfterWiringScreenshot from '/img/gitbook-import/assets/image (42) (2).png'; + # 数据绑定 现在您已经连接了视图模型和模型(数据服务),下一步是将视图和视图模型关联起来,以便显示项目列表。 @@ -54,14 +57,10 @@ description: TUTORIALS - To Do List App 因此,到目前为止,视图和视图模型的排列情况如下所示: -
- -
+ 这将在任何父级项目中有效,只要该项目具有一个具有 `ListItems` 属性的数据上下文。_Avalonia UI_ 绑定将向上搜索控件树,以定位合适的数据上下文。但是虽然主窗口的数据上下文已经设置好了(在应用程序初始化时 - 参见文件 **App.axaml.cs**),但在此时还没有一个具有 `ListItems` 属性的数据上下文。 因此,如果运行您的应用程序,列表仍然为空! -
- -
+ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/animations/page-transitions.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/animations/page-transitions.md index 8e2b767d6..c6f7b195b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/animations/page-transitions.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/animations/page-transitions.md @@ -6,6 +6,8 @@ title: Page Transitions import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CustomPageTransitionScreenshot from '/img/animations/page-transitions/TransitioningContentControl_03.webp'; + `PageTransitions` are used to render a transition between two views, for example in a [Carousel](../controls/carousel) or [TransitioningContentControl](../controls/TransitioningContentControl) :::warning @@ -270,9 +272,7 @@ public class CustomTransition : IPageTransition } ``` -
- Custom Transition Example -
+ #### Source code [IPageTransition.cs](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Visuals/Animation/IPageTransition.cs) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/community.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/community.md index 45728fe80..d79f110dd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/community.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/community.md @@ -1,7 +1,13 @@ # Community Support +import TelegramLogoScreenshot from '/img/gitbook-import/assets/image (7) (1) (1).png'; +import GitterLogoScreenshot from '/img/gitbook-import/assets/image (38) (1) (1).png'; +import GitterChatScreenshot from '/img/gitbook-import/assets/image (37) (1) (1).png'; + ## Telegram + + You can also access the Avalonia chat using the _Telegram_ app (recommended for the best experience). :::info @@ -10,15 +16,12 @@ You can access the _Telegram_ chat [here](https://t.me/Avalonia). ## Gitter - + We run a chat in English on the Gitter platform. - + :::info Access the chat in your browser using Gitter [here](https://gitter.im/AvaloniaUI/Avalonia). ::: - - - diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/border.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/border.md index 9d133207e..40b96c110 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/border.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/border.md @@ -3,6 +3,9 @@ id: border title: Border --- +import BorderSampleScreenshot from '/img/controls/border/image (2).png'; +import BorderBoxShadowScreenshot from '/img/controls/border/image (8).png'; + The `Border` control decorates a child with a border and background. It can also be used to display rounded corners by setting the [`CornerRadius`](http://reference.avaloniaui.net/api/Avalonia/CornerRadius/) property. An example of a border with a red background, 2 pixel black border, 3 pixel corner radius and a 4 pixel padding around its content: @@ -20,9 +23,7 @@ An example of a border with a red background, 2 pixel black border, 3 pixel corn ``` -
- -
+ ## Box Shadows @@ -61,9 +62,7 @@ To specify multiple shadows, provide a comma-separated list of shadows. ``` -
- -
+ ## Common Properties diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/button.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/button.md index 7f6a597ee..0d659ce63 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/button.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/button.md @@ -3,6 +3,9 @@ id: button title: Button --- +import ButtonBasicScreenshot from '/img/controls/buttons/button/button_basic.png'; +import ButtonColoredScreenshot from '/img/controls/buttons/button/image.png'; + The `Button` control is a [`ContentControl`](../contentcontrol) which reacts to pointer presses. A button notifies clicks by raising the [`Click`](http://reference.avaloniaui.net/api/Avalonia.Controls/Button/61B1E7A8) event. A click is distinct from a `PointerDown` event in that it is raised by default when the button is pressed and then released (although this behavior can be changed by setting the [`ClickMode`](http://reference.avaloniaui.net/api/Avalonia.Controls/ClickMode/) property). @@ -55,17 +58,14 @@ The Button control's full documentation can be found [here](http://reference.ava x:Class="AvaloniaAppTemplate.MainWindow" Title="AvaloniaAppTemplate"> - + ``` -produces following output with **Windows 10**\ - -
- Basic button -
+produces following output with **Windows 10** +Basic button ### Colored button @@ -83,11 +83,9 @@ produces following output with **Windows 10**\ ``` -produces following output with **Windows 10**\ +produces following output with **Windows 10** -
- Colored button -
+Colored button ### Play button diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/splitbutton.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/splitbutton.md index a07b62dbc..b94bccdf7 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/splitbutton.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/splitbutton.md @@ -3,6 +3,11 @@ id: splitbutton title: SplitButton --- +import SplitButtonClosedScreenshot from '/img/controls/buttons/splitbutton/SplitButtonClosed.png'; +import SplitButtonOpenedScreenshot from '/img/controls/buttons/splitbutton/SplitButtonOpened.png'; +import SplitButtonColorPickerScreenshot from '/img/controls/buttons/splitbutton/SplitButton_ColorPickerSample.png'; +import SplitButtonExportButtonScreenshot from '/img/controls/buttons/splitbutton/SplitButton_ExportButtonSample.png'; + The `SplitButton` functions as a [`Button`](button) with primary and secondary parts that can each be pressed separately. The primary part behaves like normal `Button` and the secondary part opens a [`Flyout`](../flyouts) with additional actions. @@ -58,16 +63,11 @@ The user-selection action should be invoked immediately when pressing either the ``` -
- -
- + *SplitButton (Flyout closed)* -
- -
+ *SplitButton (Flyout opened)* @@ -106,9 +106,7 @@ A common use case of a `SplitButton` is for coloring text within an editor. Pres ``` -
- -
+ *Sample of SplitButton for color selection* @@ -133,8 +131,6 @@ Another common example of the `SplitButton` could be an export button. When the ``` -
- -
+ *Sample of a SplitButton with different export options* diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/togglesplitbutton.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/togglesplitbutton.md index 627be38f5..6741f1ef0 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/togglesplitbutton.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/buttons/togglesplitbutton.md @@ -3,6 +3,11 @@ id: togglesplitbutton title: ToggleSplitButton --- +import ToggleSplitButtonClosedUncheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_closed_unchecked.png'; +import ToggleSplitButtonClosedCheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_closed_checked.png'; +import ToggleSplitButtonOpenedCheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_opened_checked.png'; +import ToggleSplitButtonTextListScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_TextListExample.png'; + The `ToggleSplitButton` functions as a [`ToggleButton`](togglebutton) with primary and secondary parts that can each be pressed separately. The primary part behaves like a normal `ToggleButton` and the secondary part opens a [`Flyout`](../flyouts) with additional actions. :::info @@ -66,21 +71,15 @@ Pressing a configuration in the `Flyout` should either (1) turn on the feature w ``` -
- Decription -
+ *SplitButton (Flyout closed, unchecked)* -
- Decription -
+ *SplitButton (Flyout closed, checked)* -
- Decription -
+ *SplitButton (Flyout opened, checked)* @@ -122,10 +121,6 @@ Continuing the text editor example from `SplitButton`, a common use case of the ``` -
- Decription -
- + *Sample of ToggleSplitButton for toggle text lists on and off and selecting the list format* - diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/canvas.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/canvas.md index 74e81cf13..761924466 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/canvas.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/canvas.md @@ -3,6 +3,8 @@ id: canvas title: Canvas --- +import CanvasChildOverlapScreenshot from '/img/controls/canvas/layout-panel-canvas.png'; + The `Canvas` control is a `Panel` which lays out its children by explicit coordinates. You specify the positions of individual child elements by setting the `Canvas.Left` and `Canvas.Top` attached properties on each element. @@ -24,11 +26,7 @@ Here's an example of a Canvas in XAML. The result looks like this. - -
- -
- + Use the Canvas panel with discretion. While it's convenient to be able to precisely control positions of elements in UI for some scenarios, a fixed positioned layout panel causes that area of your UI to be less adaptive to overall app window size changes. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/checkbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/checkbox.md index 99a85a93b..1e7652a73 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/checkbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/checkbox.md @@ -3,6 +3,9 @@ id: checkbox title: CheckBox --- +import CheckBoxTwoStateScreenshot from '/img/controls/checkbox/checkbox_basic.png'; +import CheckBoxThreeStateScreenshot from '/img/controls/checkbox/checkbox_threestate.png'; + The `CheckBox` control is a [`ContentControl`](../controls/contentcontrol) which allows user to check an option. It is usually used to display a boolean option where selection is either _checked_ or _unchecked_. But it also supports three state mode where selection is either _checked_, _indeterminate_ or _unchecked_. ## Common Properties @@ -39,12 +42,9 @@ The `CheckBox` control is a [`ContentControl`](../controls/contentcontrol) which ``` -produces following output with **Windows 10**\ - -
- Basic checkbox -
+produces following output with **Windows 10** +Basic checkbox ### Three state checkbox @@ -64,8 +64,6 @@ produces following output with **Windows 10**\ ``` -produces following output with **Windows 10**\ +produces following output with **Windows 10** -
- Three state checkbox -
\ No newline at end of file +Basic checkbox diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/contentcontrol.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/contentcontrol.md index 69d58a38f..752f67a52 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/contentcontrol.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/contentcontrol.md @@ -3,6 +3,8 @@ id: contentcontrol title: ContentControl --- +import ControlContentStudentScreenshot from '/img/controls/contentcontrol/student-first-last-name (1) (1) (1) (1).png'; + ## Common Properties | Property | Description | @@ -73,7 +75,7 @@ namespace Example } ``` -> Note: The following examples assume an instance of `MainWindowVieModel` is assigned to the Window's `DataContext`. See [the section on `DataContext`](docs/data-binding/the-datacontext) for more information. +> Note: The following examples assume an instance of `MainWindowVieWModel` is assigned to the Window's `DataContext`. See [the section on `DataContext`](docs/data-binding/the-datacontext) for more information. We can display the student's first and last name in a `ContentControl` using the `ContentTemplate` property: @@ -94,9 +96,6 @@ We can display the student's first and last name in a `ContentControl` using the ``` -
- Student first and last name -
- +Student first and last name -For more information see the [data templates](docs/templates/data-templates) section. \ No newline at end of file +For more information see the [data templates](docs/templates/data-templates) section. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/datepicker.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/datepicker.md index a1ffa81e5..f98635880 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/datepicker.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/datepicker.md @@ -6,6 +6,9 @@ title: DatePicker import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import DatePickerSelectedDateScreenshot from '/img/controls/datepicker/selected-date.png'; +import DatePickerUnsetScreenshot from '/img/controls/datepicker/no-date.png'; + The `DatePicker` control allows the user to pick a date value. ## Examples @@ -37,9 +40,7 @@ DatePicker birthDatePicker = new DatePicker(); Use a `DatePicker` to let a user enter a date value. The user picks the date using [ComboBox](combobox.md) selection for month, day, and year values. You can customize the `DatePicker` in various ways to suit your app. -
- A date picker with a date selected. -
+A date picker with a date selected. ### Formatting the date picker @@ -53,9 +54,7 @@ The date picker control has both `Date` / `DateChanged` and `SelectedDate` / `Se The value of `SelectedDate` is used to populate the date picker and is `null` by default. If `SelectedDate` is `null`, the `Date` property is set to 12/31/1600; otherwise, the `Date` value is synchronized with the `SelectedDate` value. When `SelectedDate` is `null`, the picker is 'unset' and shows the field names instead of a date. -
- A date picker with no date selected. -
+A date picker with no date selected. To use the date value in your app, you typically use a data binding to the `SelectedDate` property, or handle the `SelectedDateChanged` event. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/dockpanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/dockpanel.md index f1fb742cb..0cb32afb5 100644 Binary files a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/dockpanel.md and b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/dockpanel.md differ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/flyouts.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/flyouts.md index fcb2e2bef..295e3479c 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/flyouts.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/flyouts.md @@ -3,6 +3,9 @@ id: flyouts title: Flyouts --- +import FlyoutContentScreenshot from '/img/controls/flyouts/flyoutpreview.png'; +import FlyoutMenuScreenshot from '/img/controls/flyouts/menuflyoutpreview.png'; + ## Overview Flyouts are light dismissible containers that show arbitrary UI content. Flyouts are not controls and can be declared as a resource and shared between multiple elements within your app. @@ -44,15 +47,11 @@ Flyouts are light dismissible containers that show arbitrary UI content. Flyouts There are two built-in types of Flyouts: `Flyout` and `MenuFlyout`. A regular `Flyout` has no special logic and is just a simple container for any arbitrary UI content. -
- Basic Flyout -
+Basic Flyout `MenuFlyout`, as the name implies, creates a Menu. -
- Basic MenuFlyout -
+Basic MenuFlyout ## Reference diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/grid.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/grid.md index e72416ae6..7aa23e6ec 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/grid.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/grid.md @@ -3,6 +3,12 @@ id: grid title: Grid --- +import GridSampleScreenshot from '/img/controls/grid/grid_example.png'; +import GridAsteriskScreenshot from '/img/controls/grid/grid_asterisk_example.png'; +import GridAsteriskButtonsScreenshot from '/img/controls/grid/grid_asterisk_example_buttons.png'; +import GridAutoButtonsScreenshot from '/img/controls/grid/grid_auto_example_buttons.png'; +import GridVerboseSampleScreenshot from '/img/controls/grid/grid_example_verbose.png'; + The `Grid` control is a `Panel` control useful for organizing other controls in columns and rows. `ColumnDefinition` and `RowDefinition` properties are used to define absolute, relative, or proportional row and column geometries for the grid. Each control in the grid will be placed using the `Grid.Column` and `Grid.Row` additional properties. It is also possible to have controls that span multiple rows and/or columns by using the `ColumnSpan` and `RowSpan` properties. ## Reference @@ -42,9 +48,7 @@ In the above example we have two keywords: __*__ and **Auto**. Here is explanati The multiplier used in front of the proportional spacing value is used to figure out the relative size for the proportional columns. All proportional columns fit in the space left behind after all explicit values and "Auto" values are calculated. So for the above example the Column 1 will get 1.5 parts plus Column 2 will get 4 parts of the remainder of the space that Column 0 left. Lastly, the Button itself will fill in from the initial Cell 1,1 over one column and down one row because `Grid.RowSpan` and `Grid.ColumnSpan` are set to occupy two units instead of one. -
- Grid Using Properties and Spanning Columns -
+Grid Using Properties and Spanning Columns Here is another example showing the difference between those two. @@ -65,16 +69,11 @@ First let's create sample 2x2 grid in our View, we can achieve this simply by wr As you can see we created equal grid, I left `ShowGridLines` parameter set to `True` for better visibility. - -
- Grid Using Asterisk Symbols -
+Grid Using Asterisk Symbols Now let's fill our grid with some elements, I will fill every field with button, you can use anything you want. -
- Grid Using Asterisk Symbols Filled With Buttons -
+Grid Using Asterisk Symbols Filled With Buttons Now our View code look's like this: @@ -98,13 +97,11 @@ Now our View code look's like this: In this moment our **asterisk** symbols are forcing our grid to become equal, now let's see what will happen when we replace **asterisk** with the **Auto** keyword -
- Grid Using Auto Keyword -
+Grid Using Auto Keyword As you can see our grid become sticky to its content, it is very useful when we have components with variable `Height` property. -This new View code look's like this: +This new View code looks like this: ```markup @@ -148,9 +145,7 @@ For more complex row and column definitions it's possible to explicitly use `Gri ``` -
- Using Verbose Row/Column Definitions -
+Using Verbose Row/Column Definitions ### Common Properties diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/gridsplitter.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/gridsplitter.md index f8aabb17b..58a39eeb8 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/gridsplitter.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/gridsplitter.md @@ -3,6 +3,9 @@ id: gridsplitter title: GridSplitter --- +import GridSplitterColumnsScreenshot from '/img/controls/gridsplitter/gridsplitter-in-action-columns.gif'; +import GridSplitterRowsScreenshot from '/img/controls/gridsplitter/gridsplitter-in-action-rows.gif'; + The `GridSplitter` control is a control that allows a user to resize the space between `Grid` rows or columns. ```markup @@ -13,9 +16,7 @@ The `GridSplitter` control is a control that allows a user to resize the space b ``` -
- GridSplitter in Action for Columns -
+GridSplitter in Action for Columns ```markup @@ -25,9 +26,7 @@ The `GridSplitter` control is a control that allows a user to resize the space b ``` -
- GridSplitter in Action for Rows -
+GridSplitter in Action for Rows ### Reference diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/itemsrepeater.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/itemsrepeater.md index 7ce7aaff0..de9523caf 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/itemsrepeater.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/itemsrepeater.md @@ -3,6 +3,9 @@ id: itemsrepeater title: ItemsRepeater --- +import ItemsRepeaterVerticalScreenshot from '/img/controls/itemsrepeater/itemsrepeatervertical.png'; +import ItemsRepeaterHorizontalScreenshot from '/img/controls/itemsrepeater/itemsrepeaterhorizontal.png'; + A data-driven collection control that incorporates a flexible layout system, custom views, and virtualization. `ItemsRepeater` is a port of the UWP `ItemsRepeater` control. More documentation can be found at: @@ -50,11 +53,10 @@ By default an `ItemsRepeater`, without defining a `Layout` will render them Stac ``` And they will look like so -
- Decription -
+ If you want them to be rendered Horizontally, you need to specify a `Layout` property and the xaml should look a bit like so: + ```xml @@ -73,14 +75,12 @@ If you want them to be rendered Horizontally, you need to specify a `Layout` pro ``` -this will look like this: -
- Decription -
-In the `Layout` property you can also specify `Spacing` between the items, but you cannot define `Classes` nor other complex styles, those needs to be defined on the `ItemsRepeater` if needed. +this will look like this: + +In the `Layout` property you can also specify `Spacing` between the items, but you cannot define `Classes` nor other complex styles, those needs to be defined on the `ItemsRepeater` if needed. ## Reference diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/maskedtextbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/maskedtextbox.md index 1ce9874f2..c9d536a22 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/maskedtextbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/maskedtextbox.md @@ -3,6 +3,9 @@ id: maskedtextbox title: MaskedTextBox --- +import MaskedTextBoxEmptyScreenshot from '/img/controls/maskedtextbox/maskedtextboxexample1.png'; +import MaskedTextBoxTextEntryScreenshot from '/img/controls/maskedtextbox/maskedtextexample.gif'; + The `MaskedTextBox` control is an editable text field where a user can input text. ## Source code @@ -27,15 +30,11 @@ The `MaskedTextBox` control is an editable text field where a user can input tex produces the following output in **Ubuntu** -
- -
+ and it behaves like so when filled in by user input -
- -
+ ### Supported Masks diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/numericupdown.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/numericupdown.md index 3538e14ca..8dbe0c8e0 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/numericupdown.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/numericupdown.md @@ -3,6 +3,8 @@ id: numericupdown title: NumericUpDown --- +import NumericUpDownBasicScreenshot from '/img/controls/numericupdown/numericupdown_basic.png'; + The `NumericUpDown` is an editable numeric input field. The control has a up and down button spinner attached, used to increment and decrement the value in the input field. The value can also be incremented or decremented using the arrow keys or the mouse wheel when the control is selected. @@ -25,11 +27,9 @@ The value stored in the `NumericUpDown` is a double. ``` -produces the following output on **Linux**\ +produces the following output on **Linux** -
- Basic NumericUpDown -
+Basic NumericUpDown ### NumericUpDown with a changed increment and bounds diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/panel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/panel.md index 703ebe742..72c4309f4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/panel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/panel.md @@ -3,6 +3,8 @@ id: panel title: Panel --- +import PanelRectangleLayoutScreenshot from '/img/controls/panel/image (7).png'; + The `Panel` is the base class for controls that can contain multiple children like `DockPanel` or `StackPanel`. The `Panel` class can be useful on its own for very basic layouts, or simply to allow multiple controls to be to be contained. @@ -16,9 +18,7 @@ The `Panel` class can be useful on its own for very basic layouts, or simply to ``` -
- Decription -
+ There are other more useful panels that derive from `Panel`, these include: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/progressbar.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/progressbar.md index e8a8e1e08..426dac3d8 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/progressbar.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/progressbar.md @@ -3,15 +3,15 @@ id: progressbar title: ProgressBar --- +import ProgressBarScreenshot from '/img/controls/progressbar/progressbar (1).png'; + The `ProgressBar` control allow for showing dynamic progress status. ### Customizing the progress text When [`ShowProgressText`](http://reference.avaloniaui.net/api/Avalonia.Controls/ProgressBar/590A8B3E) is `true`, text on the progress bar will be displayed. -
- Basic Progress Bar -
+Basic Progress Bar By default this text shows the percentage completion, according to the [`Value`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/E111DF5B), [`Minimum`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/8F9BD1EA) and [`Maximum`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/C07B22E9). The format of this text can be customised by using the `ProgressTextFormat` property. This expects a string which will be passed to a [`string.Format`](https://docs.microsoft.com/en-us/dotnet/api/system.string.format#system-string-format(system-string-system-object())) call with the value of `ProgressTextFormat` as the format string. The following format items are available at the given indices: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/relativepanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/relativepanel.md index eafae4f45..1df65a7c9 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/relativepanel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/relativepanel.md @@ -3,6 +3,8 @@ id: relativepanel title: RelativePanel --- +import RelativePanelScreenshot from '/img/controls/relativepanel/layout-panel-relative-panel.png'; + The `RelativePanel` control is a `Panel` which lets you layout elements by specifying where they go in relation to other elements and in relation to the panel. By default, an element is positioned in the upper left corner of the panel. @@ -42,9 +44,7 @@ This XAML shows how to arrange elements in a RelativePanel. The result looks like this. -
- Relative panel -
+Relative panel Here are a few things to note about the sizing of the rectangles: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/splitview.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/splitview.md index 62bad1996..4a3d46841 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/splitview.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/splitview.md @@ -3,6 +3,8 @@ id: splitview title: SplitView --- +import SplitViewScreenshot from '/img/controls/splitview/image (9).png'; + Represents a container with two views; one view for the main content and another view that is typically used for navigation commands. ```markup @@ -25,9 +27,7 @@ Represents a container with two views; one view for the main content and another ``` -
- -
+ A split view's content area is always visible. The pane can expand and collapse or remain in an open state, and can present itself from either the left side or right side of an app window. The pane has four modes: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/stackpanel.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/stackpanel.md index 2ffb1185d..ab9bab10b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/stackpanel.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/stackpanel.md @@ -3,6 +3,9 @@ id: stackpanel title: StackPanel --- +import StackPanelRectangleScreenshot from '/img/controls/stackpanel/layout-panel-stack-panel.png'; +import StackPanelRectangleSpacingScreenshot from '/img/controls/stackpanel/image (12).png'; + The `StackPanel` control is a `Panel` which lays out its children by stacking them horizontally or vertically. StackPanel is typically used to arrange a small subsection of the UI on a page. You can use the [**Orientation**](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.stackpanel.orientation) property to specify the direction of the child elements. The default orientation is [**Vertical**](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Orientation). @@ -20,9 +23,7 @@ The following XAML shows how to create a vertical StackPanel of items. The result looks like this. -
- -
+ In a StackPanel, if a child element's size is not set explicitly, it stretches to fill the available width \(or height if the Orientation is **Horizontal**\). In this example, the width of the rectangles is not set. The rectangles expand to fill the entire width of the StackPanel. @@ -37,10 +38,7 @@ StackPanel has a `Spacing` property to allow an even spacing between items. ``` -
- -
- + ### Reference diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/tabcontrol.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/tabcontrol.md index 48263c57b..26b004a22 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/tabcontrol.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/tabcontrol.md @@ -3,13 +3,14 @@ id: tabcontrol title: TabControl --- +import TabControlRibbonScreenshot from '/img/controls/tabcontrol/tabcontrol.gif'; +import TabControlStyledRibbonScreenshot from '/img/controls/tabcontrol/customizedtabcontrol.gif'; + The `TabControl` allows us to switch between different pages by means of tabs like the tabs in web navigators or the ribbon menu \(which uses tabs\) in Word Office for instance. Here is an animation of what you can achieve : -
- Decription -
+ To create this, we'll describe the entire control \(TabControl\) and each individual tab+page \(TabItem\). Here is an example : @@ -43,9 +44,7 @@ To create this, we'll describe the entire control \(TabControl\) and each indivi Let's have a look at a customized `TabControl` : -
- Decription -
+ The grey part is the `TabItem`... Yes, the `TabItem` includes the tab **AND** the page associated to the tab. The tab is called the `header`of the `TabItem`. Moreover, given the way `TabControl` has been implemented, tabs are in a `WrapPanel`. Thus, if you want to color in blue \(like this is done above\) the empty bar of the tabbed bar, you must change the background color of the `WrapPanel` of the `TabControl`. Here is the code used to obtain the result above \(_Note the workaround used to color some tabs : this is due to the way the control is implemented. It might change in the future._\) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/textbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/textbox.md index 0998dd5ee..b465bf104 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/textbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/textbox.md @@ -3,6 +3,11 @@ id: textbox title: TextBox --- +import TextBoxSingleLineScreenshot from '/img/controls/textbox/textbox_basic.png'; +import TextBoxPasswordScreenshot from '/img/controls/textbox/textbox_password.png'; +import TextBoxWatermarkScreenshot from '/img/controls/textbox/textbox_watermark.png'; +import TextBoxMultilineScreenshot from '/img/controls/textbox/textbox_multiline.png'; + The `TextBox` control is an editable text field where a user can input text. ## Reference @@ -33,10 +38,7 @@ The `TextBox` control is an editable text field where a user can input text. produces the following output in **Windows 10** -
- -
- + ### Password input TextBox @@ -56,9 +58,7 @@ produces the following output in **Windows 10** produces the following output in **Windows 10** when text is input -
- -
+ When using the Fluent theme, you can apply the style class, `revealPasswordButton`, and the TextBox will provide an eye 👁 glyph for the user to show the plane text temporally. Please note, the `TextBox` may be written to but not copied from. @@ -86,10 +86,7 @@ Avalonia can show a "watermark" in a `TextBox`, which is a piece of text that is produces the following output in **Windows 10** -
- -
- + ### Multiline TextBox @@ -109,9 +106,7 @@ produces the following output in **Windows 10** produces the following output in **Windows 10** when text is input -
- -
+ ### TextInput Event Handling diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/timepicker.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/timepicker.md index 0b7d24fbe..2ef09e149 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/timepicker.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/timepicker.md @@ -6,6 +6,11 @@ title: TimePicker import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import TimePickerSingleValueScreenshot from '/img/controls/timepicker/image (22) (1).png'; +import TimePickerClockIdentifierScreenshot from '/img/controls/timepicker/image (19).png'; +import TimePickerMinuteIncrementScreenshot from '/img/controls/timepicker/image (10).png'; +import TimePickerUnsetScreenshot from '/img/controls/timepicker/image (20).png'; + The `TimePicker` control allows the user to pick a time value. ## Examples @@ -39,9 +44,7 @@ TimePicker arrivalTimePicker = new TimePicker(); Use a `TimePicker` to let a user enter a single time value. You can customize the `DatePicker` to use a 12-hour or 24-hour clock. -
- -
+ ## 12-hour and 24-hour clocks @@ -52,10 +55,7 @@ By default, the time picker shows a 12-hour clock with an AM/PM selector. You ca ``` -
- -
- + ### Minute increment @@ -65,9 +65,7 @@ You can set the [MinuteIncrement](https://docs.microsoft.com/en-us/uwp/api/windo ``` -
- -
+ ### Time values @@ -75,9 +73,7 @@ The time picker control has both Time / TimeChanged and SelectedTime / SelectedT The value of `SelectedTime` is used to populate the time picker and is `null` by default. If `SelectedTime` is `null`, the `Time` property is set to a [TimeSpan](https://docs.microsoft.com/en-us/dotnet/api/system.timespan?view=dotnet-uwp-10.0\&preserve-view=true) of 0; otherwise, the `Time` value is synchronized with the `SelectedTime` value. When `SelectedTime` is `null`, the picker is 'unset' and shows the field names instead of a time. -
- -
+ **Initializing a time value** diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/transitioningcontentcontrol.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/transitioningcontentcontrol.md index 4793bca3f..eb531776b 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/transitioningcontentcontrol.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/transitioningcontentcontrol.md @@ -3,6 +3,9 @@ id: transitioningcontentcontrol title: TransitioningContentControl --- +import TransitioningContentControlFadeScreenshot from '/img/controls/transitioningcontentcontrol/TransitioningContentControl_01.webp'; +import TransitioningContentControlSlideScreenshot from '/img/controls/transitioningcontentcontrol/TransitioningContentControl_02.webp'; + ## Common Properties | Property | Description | @@ -33,10 +36,7 @@ Let's assume we have a collection of different images and we want to show them i ``` -
- -
- + ## Changing the PageTransition @@ -57,9 +57,7 @@ In the sample below we will change the [PageTransition](../animations/page-trans ``` -
- -
+ ## Disable the PageTransition diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md index 2593e7f52..b7c11e015 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md @@ -3,6 +3,8 @@ id: creating-a-flat-treedatagrid title: Creating a Flat TreeDataGrid --- +import FlatTreeDataGridSourceScreenshot from '/img/controls/treedatagrid/get-started-flat-1.png'; + There are two parts to any `TreeDataGrid`: * The "Source" which is defined in code and describes how your data model will map to the rows and columns of the `TreeDataGrid` @@ -98,6 +100,4 @@ It's now time to add the `TreeDataGrid` control to a window and bind it to the s Run the application and you should see the data appear: -
- -
+ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md index 3ea30ddb1..6a9a280a1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md @@ -3,6 +3,8 @@ id: creating-a-hierarchical-treedatagrid title: Creating a Hierarchical TreeDataGrid --- +import HierarchicalTreeDataGridSourceScreenshot from '/img/controls/treedatagrid/get-started-hierarchical-1.png'; + There are two parts to any `TreeDataGrid`: * The "Source" which is defined in code and describes how your data model will map to the rows and columns of the `TreeDataGrid` @@ -129,6 +131,4 @@ It's now time to add the `TreeDataGrid` control to a window and bind it to the s Run the application and you should see the data appear: -
- -
\ No newline at end of file + \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md index d46695d49..07cb852b5 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md @@ -19,14 +19,11 @@ new TextColumn("First Name", x => x.FirstName) The first generic parameter here is your model type basically, the place where you want to grab data from. Person in this case. The second generic parameter here is the type of the property where you want to grab data from. In this case, it is a string, it will be used to know exactly which type your property has. - -
- -
+![](https://user-images.githubusercontent.com/53405089/157456551-dd394781-903a-4c7b-8874-e631e21534a1.png) This is the signature of the `TextColumn` constructor. There are two most important parameters. The first one will be used to define the column header, usually, it would be a string. In the sample above it is _"First Name"_. The second parameter is an expression to get the value of the property. In the sample above it is _x => x.FirstName_. -**Note**:\ +**Note**: The sample above is taken from [this article](https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/blob/master/docs/get-started-flat.md). If you feel like you need more examples feel free to check it, there is a sample that shows how to use TextColumns and how to run a whole `TreeDataGrid` using them. ### HierarchicalExpanderColumn @@ -41,15 +38,13 @@ new HierarchicalExpanderColumn(new TextColumn("First Nam `HierarchicalExpanderColumn` has only one generic parameter, it is your model type, same as in `TextColumn`, Person in this case. -Let's take a look at the `HierarchicalExpanderColumn` constructor. +Let's take a look at the `HierarchicalExpanderColumn` constructor. -
- -
+![](https://user-images.githubusercontent.com/53405089/157536079-fd14f1ed-0a7d-438a-abba-fd56766709a9.png) The first parameter in the constructor is a nested column, you would usually want to display something besides the expander and that's why you need this parameter. In the sample above, we want to display text and we use `TextColumn` for that. The second parameter is a selector of the child elements, stuff that will be displayed when `Expander` is in the expanded state below the parent element. -**Note**:\ +**Note**: The sample above is taken from [this article](https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/blob/master/docs/get-started-hierarchical.md). If you feel like you need more examples feel free to check it, there is a sample that shows how to use `HierarchicalExpanderColumn` and how to run a whole `TreeDataGrid` using it. ### TemplateColumn @@ -66,8 +61,6 @@ new TemplateColumn( `TemplateColumn` has only one generic parameter, it is your model type, same as in `TextColumn`, Person in this case. Code above will create a column with header _"Selected"_ and `CheckBox` in each cell. -
- -
+![](https://user-images.githubusercontent.com/53405089/157664231-8653bce9-f8d6-4fbc-8e78-e3ff93f1ace2.png) `TemplateColumn` has only two required parameters. The first one is the column header as everywhere. The second is `IDataTemplate` basically, a template that contains stuff that you want to be displayed in the cells of this column. \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/viewbox.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/viewbox.md index 29872697a..0137b6922 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/viewbox.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/controls/viewbox.md @@ -1,11 +1,19 @@ --- id: viewbox -title: ViewBox +title: Viewbox --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import ViewboxScaleUniformBothScreenshot from '/img/controls/viewbox/scale-uniform-both.gif'; +import ViewboxScaleUniformFillBothScreenshot from '/img/controls/viewbox/scale-uniformtofill-both.gif'; +import ViewboxScaleFillBothScreenshot from '/img/controls/viewbox/scale-fill-both.gif'; +import ViewboxScaleNoneBothScreenshot from '/img/controls/viewbox/scale-none-both.gif'; + +import ViewboxScaleUniformUpOnlyScreenshot from '/img/controls/viewbox/scale-uniform-uponly.gif'; +import ViewboxScaleUniformDownOnlyScreenshot from '/img/controls/viewbox/scale-uniform-downonly.gif'; + The `Viewbox` is a decorator control which scales its child. It can be used to scale its child to fit the available space. The `Viewbox` gives its child infinite space in the measure phase. It will constrain either or both sides when arranging it. This depends on the value of the `Stretch`. @@ -85,7 +93,7 @@ new Viewbox

- +

@@ -95,7 +103,7 @@ new Viewbox

- +

@@ -105,7 +113,7 @@ new Viewbox

- +

@@ -115,7 +123,7 @@ new Viewbox

- +

@@ -135,7 +143,7 @@ new Viewbox Both - + @@ -144,7 +152,7 @@ new Viewbox

- +

@@ -154,7 +162,7 @@ new Viewbox

- +

diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/data-binding/data-validation.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/data-binding/data-validation.md index 550a80a7f..a5e0009a4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/data-binding/data-validation.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/data-binding/data-validation.md @@ -3,6 +3,8 @@ id: data-validation title: Data Validation --- +import CustomValidationTooltipScreenshot from '/img/data-binding/data-validation/CustomValidationTooltip.png'; + Avalonia offers different data validation options. In this section we will show you how you can validate the `Properties` of your `ViewModel` and how you can style the displayed error message. ## Validating a property @@ -122,10 +124,7 @@ To display the validation messages, Avalonia has a control called [`DataValidati ``` -
- custom validation style -
- +custom validation style **Custom validation style** diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/developer-tools.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/developer-tools.md index 9ddfb1332..0729c042f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/developer-tools.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/developer-tools.md @@ -3,6 +3,16 @@ id: developer-tools title: Developer Tools --- +import DevToolsOverviewScreenshot from '/img/getting-started/developer-tools/image (23).png'; +import DevToolsPropertiesScreenshot from '/img/getting-started/developer-tools/image (26).png'; +import DevToolsLayoutScreenshot from '/img/getting-started/developer-tools/image (24) (1) (1).png'; +import DevToolsStylesScreenshot from '/img/getting-started/developer-tools/image (27).png'; +import DevToolsOverriddenStylesScreenshot from '/img/getting-started/developer-tools/image (28).png'; +import DevToolsSetterContextMenuScreenshot from '/img/getting-started/developer-tools/image (25).png'; +import DevToolsEventsScreenshot from '/img/getting-started/developer-tools/image (29).png'; +import DevToolsChangePropertyScreenshot from '/img/getting-started/developer-tools/devtools-change-property.gif'; +import DevToolsChangeLayoutScreenshot from '/img/getting-started/developer-tools/devtools-change-layout.gif'; + # Developer Tools Avalonia has an inbuilt DevTools window which is enabled by calling the attached `AttachDevTools()` method in a `Window` constructor. The default templates have this enabled when the program is compiled in `DEBUG` mode: @@ -45,9 +55,7 @@ dotnet add package Avalonia.Diagnostics --version 0.10.0 ::: -
- -
+ There is a known issue when running under .NET core 2.1 that pressing F12 will cause the program to quit. In this case, either switch to .NET core 2.0 or 3.0+ or change the open gesture to something different, such as `Ctrl+F12`. @@ -66,9 +74,7 @@ Allows for quickly checking and editing properties of the control. One can also | Type | Type of the current value | | Priority | Priority of the value | -
- -
+ ### Layout @@ -79,9 +85,7 @@ Control size and size constraints are also shown. If `Width` or `Height` are underlined that means there is an active constraint. Hover over the value to see a tooltip containing relevant information. ::: -
- -
+ ### Styles @@ -96,24 +100,18 @@ If setter value is bound to a resource it will be indicated by a circle followed ::: -
- -
+ :::info If given value has a strikethrough it means that it is being overridden by a value in style with higher priority. ::: -
- -
+ Setters have a context menu that allows for quickly copying names and values to the clipboard. -
- -
+ ## Events @@ -126,9 +124,7 @@ Dotted underline under event name or control type indicates that quick navigatio * Double clicking a control type (and/or name) will navigate to the visual tree tab and select said control. ::: -
- -
+ ## Console @@ -151,12 +147,8 @@ The console can be shown using the "View" → "Console" menu. The console implem ### Changing a property value -
- -
+ ### Changing layout properties -
- -
\ No newline at end of file + \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/ide-support.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/ide-support.md index 8a343bf83..90c9f16ca 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/ide-support.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/ide-support.md @@ -2,6 +2,10 @@ id: ide-support title: IDE Support --- + +import VsXamlPreviewerScreenshot from '/img/getting-started/vs-designer.png'; +import VsSelectProjectPreviewScreenshot from '/img/getting-started/VisualStudioPreviewer_SelectProjectForPreview.png'; + ## JetBrains Rider The [JetBrains Rider](https://www.jetbrains.com/rider/) IDE has built-in support for Avalonia XAML [starting in 2020.3](https://www.jetbrains.com/rider/whatsnew/2020-3/#version-2020-3-avalonia-support) including first-class support for Avalonia-specific XAML features and custom code inspections. @@ -24,9 +28,7 @@ If you're using VS2019 or VS2017 you need to install [the extension for older ve For Visual Studio and ReSharper users, [ReSharper 2020.3 introduces](https://www.jetbrains.com/resharper/whatsnew/2020-3/#version-2020-3-avalonia-support) built-in code analysis, code completion, navigation, and find usages. -
- Shows the XAML Previewer in Visual Studio -
+Shows the XAML Previewer in Visual Studio If your XAML is in a library, Avalonia needs an executable application in order to be able to preview it. Select an executable project from the dropdown on the top right of the designer. Once your project is built, editing the XAML in the editor will cause the preview to update automatically. @@ -127,7 +129,4 @@ If your preview is not shown correctly try to (re-)build the project or solution Moreover if you have more than one project in your solution, you may need to select the project which should be used to render the preview. This can be done with the drop-down shown below. - -
- Shows how to select the project used to render the preview -
\ No newline at end of file +Shows how to select the project used to render the preview diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/jetbrains-rider-setup.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/jetbrains-rider-setup.md index f462da4b8..7e4e00f0a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/jetbrains-rider-setup.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/getting-started/jetbrains-rider-setup.md @@ -3,6 +3,10 @@ id: jetbrains-rider-setup title: JetBrains Rider Setup --- + import RiderWelcomePluginsScreenshot from '/img/getting-started/jetbrains-rider-setup/jetbrains-rider-setup-1-rider-welcome.webp'; + import RiderConfigurePluginsScreenshot from '/img/getting-started/jetbrains-rider-setup/rider-setup-2-configure-plugin-repos.webp'; + import RiderPluginInstallScreenshot from '/img/getting-started/jetbrains-rider-setup/jetbrains-rider-setup-4-plugin-install.webp'; + # JetBrains Rider Setup 1. Download and install the .NET SDK of your choice [Download .NET \(Linux, macOS, and Windows\) \(microsoft.com\)](https://dotnet.microsoft.com/download) @@ -45,21 +49,14 @@ title: JetBrains Rider Setup Once Rider loads you will see the Welcome Screen. Click the `Configure` dropdown and select `Plugins`. -
- Button group -
+Button group A new Preferences Screen will open up. Click the `Settings` icon as shown and select `Manage Plugin Repositories...` - -
- Button group -
+Button group Now click on the `Marketplace` tab and search for `Avalonia`. Select `AvaloniaRider` and click `Install`; accept the warning about Third-Party Plugins; once that's done, click the `Restart IDE` button that appears. -
- Button group -
+Button group Now Rider should be ready to develop Avalonia applications. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/code-behind.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/code-behind.md index 33bfb872a..1b0b68df3 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/code-behind.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/code-behind.md @@ -3,11 +3,11 @@ id: code-behind title: Code Behind --- +import VsCodeBehindScreenshot from '/img/guides/basics/code-behind/codebehind-vs.png'; + [Window](../../controls/window) and [UserControl](../../controls/usercontrol) files also have an associated _code-behind_ file which usually has the extension `.xaml.cs` or `.axaml.cs` and may be displayed collapsed under the XAML file in your editor. Below you can see a `MainWindow.xaml` file along with its markdown file `MainWindow.xaml.cs` in Visual Studio: -
- Code-behind in Visual Studio -
+Code-behind in Visual Studio The code-behind file by default defines a .NET class with the same name as your XAML file, e.g. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/mvvm.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/mvvm.md index db1622680..c0591ddc7 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/mvvm.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/basics/mvvm.md @@ -3,6 +3,8 @@ id: mvvm title: MVVM Architecture --- +import MvvmArchitectureDiagram from '/img/guides/basics/mvvm/mvvm.png'; + The Model-View-ViewModel pattern (MVVM) is a common way of structuring a UI application. It takes advantage of Avalonia's [binding](../../data-binding) system to separate the logic of the application from the display of the application. MVVM might be overkill for a simple application, but as applications grow over time, they usually reach a point where tracking logic in [code-behind](code-behind) becomes problematic for two main reasons: @@ -28,9 +30,7 @@ When we talk about the MVVM pattern, the most important parts are the **View** l One way to imagine an MVVM application is to imagine these two layers as hovering over one another, connected by bindings: -
- Diagram of MVVM -
+ The above example has, at the View layer: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md index f8d4054fc..8dfc52447 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md @@ -3,6 +3,8 @@ id: routing title: Routing --- +import ReactiveUIRoutingScreenshot from '/img/guides/deep-dives/reactiveui/routing/routing.gif'; + [ReactiveUI routing](https://reactiveui.net/docs/handbook/routing/) consists of an [IScreen](https://reactiveui.net/api/reactiveui/iscreen/) that contains current [RoutingState](https://reactiveui.net/api/reactiveui/routingstate/), several [IRoutableViewModel](https://reactiveui.net/api/reactiveui/iroutableviewmodel/)s, and a platform-specific XAML control called [RoutedViewHost](https://github.com/AvaloniaUI/Avalonia/blob/55458cf7af24d6c987268ab5ff8a1ead1173310b/src/Avalonia.ReactiveUI/RoutedViewHost.cs). `RoutingState` manages the view model navigation stack and allows view models to navigate to other view models. `IScreen` is the root of a navigation stack; despite the name, its views don't have to occupy the whole screen. `RoutedViewHost` monitors an instance of `RoutingState`, responding to any changes in the navigation stack by creating and embedding the appropriate view. ## Routing Example @@ -248,6 +250,4 @@ Now, you can run the app and see routing in action! dotnet run --framework netcoreapp2.1 ``` -
- -
+ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md index a0bad17f3..152dc82b4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md @@ -3,6 +3,10 @@ id: running-on-raspbian-lite-via-drm title: Running your Avalonia app on a Raspberry Pi with Raspbian Lite --- +import RaspbianLiteDrmKmsCubeScreenshot from '/img/guides/deep-dives/running-on-raspbian-lite-via-drm/avalonia-raspbian-lite-drm-kmscube.gif'; +import RaspbianLiteDrmDesktopScreenshot from '/img/guides/deep-dives/running-on-raspbian-lite-via-drm/avalonia-raspbian-lite-drm-desktop.jpg'; +import RaspianLiteRaspberryScreenshot from '/img/guides/deep-dives/running-on-raspbian-lite-via-drm/avalonia-raspbian-lite-drm-run-on-raspberry.jpg'; + # Running your Avalonia app on a Raspberry Pi with Raspbian Lite This tutorial shows you how to run your Avalonia app on a Raspberry Pi with Raspbian Lite @@ -69,9 +73,7 @@ sudo kmscube ```` You should see the spinning cube on your Raspberry pi screen now: -
- -
+ ### Step 2 - Prepare Avalonia App @@ -193,9 +195,7 @@ public override void OnFrameworkInitializationCompleted() Now you can run/debug your app on desktop as usual. When you start your app you should see this: -
- -
+ ### Step 3 - Deploy and run on Raspberry @@ -221,8 +221,6 @@ sudo ./path/to/app/AvaloniaRaspbianLiteDrm --drm You should see the app running on your Raspberry Pi now: -
- -
+ If you have a touch display installed, try to slide the slider control :) \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-previewer.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-previewer.md index 36a313b67..248bf26e2 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-previewer.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-previewer.md @@ -3,6 +3,8 @@ id: debugging-previewer title: Debugging Previewer --- +import VsAttachDebuggerScreenshot from '/img/guides/developer-guides/debugging-previewer/132686320-958f30a6-49f8-498f-853c-b9dd17262b54.png'; + By default, even if you would put a breakpoint in Avalonia main repo directly it would not be hit when Previewer executes this code. This is because Previewer is a completely different process usually run by IDE. **Debugging with JetBrains Rider** @@ -45,6 +47,4 @@ But if you need to place breakpoints in the previewer code you may need to use [ You should see a window like this. -
- -
+ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md index 43e3a3fec..9f3ac7280 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md @@ -3,7 +3,9 @@ id: debugging-xamlil title: Debugging the XAML compiler --- -You can debug the XAML compiler adding at your's csproj AvaloniaXamlIlDebuggerLaunch property like this: +import VsAttachDebuggerScreenshot from '/img/guides/developer-guides/debugging-xamlil/132686320-958f30a6-49f8-498f-853c-b9dd17262b54.png'; + +You can debug the XAML compiler by adding the `AvaloniaXamlIlDebuggerLaunch` property to your .csproj like this: ```xml @@ -16,8 +18,6 @@ You can debug the XAML compiler adding at your's csproj AvaloniaXamlIlDebuggerLa If build the project in Visual Studio you should see a window like this: -
- -
+ -on other IDEs, a message will appear in the build output window indicating the PID of the process to attach the debugger to and the elapsed time. If within one minute of starting the build no debugger is attacked to the process, a timeout message will be reported and the build will continue as normal. \ No newline at end of file +On other IDEs, a message will appear in the build output window indicating the PID of the process to attach the debugger to and the elapsed time. If within one minute of starting the build no debugger is attacked to the process, a timeout message will be reported and the build will continue as normal. \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md index 84690649b..3d961f225 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md @@ -3,6 +3,9 @@ id: maintaining-stable-branch-pr-merge-process title: Maintaining Stable Branch --- +import NewFeatureMasterMergeScreenshot from '/img/guides/developer-guides/maintaining-stable-branch-pr-merge-process/image (6).png'; +import NewFeatureBackportScreenshot from '/img/guides/developer-guides/maintaining-stable-branch-pr-merge-process/image (13).png'; + :::warning This Process MUST be followed during any period that `master` branch is allowing breaking changes. ::: @@ -24,9 +27,7 @@ Provided the criteria are met: At this point the git tree should look similar to this. -
- -
+ Now we need to get the new PR merged into the stable branch. @@ -39,8 +40,6 @@ Pay careful attention here, we don't just merge into the stable branch! The git tree should look like this now. -
- -
+ Please also use the `backport-candidate` and `backported 0.10.x` labels on the PRs themselves. \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/release-process.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/release-process.md index a09fe799a..ff90ee1a3 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/release-process.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/guides/developer-guides/release-process.md @@ -3,6 +3,12 @@ id: release-process title: Release Process --- +import ReleaseGitTreeScreenshot from '/img/guides/developer-guides/release-process/image (4).png'; +import ReleasePipelineScreenshot from '/img/guides/developer-guides/release-process/image (1).png'; +import ReleaseBranchScreenshot from '/img/guides/developer-guides/release-process/image (11).png'; +import ReleaseNugetBadgeScreenshot from '/img/guides/developer-guides/release-process/image (17) (1) (1) (1).png'; +import ReleaseDeployScreenshot from '/img/guides/developer-guides/release-process/image (16).png'; + * Create a branch named `release/0.10.2` for example. This branch should be level with the `master` commit that the release will be based on. * Update the version number in the file `SharedVersion.props` i.e. `0.10.2`. * Push the release branch. @@ -11,10 +17,7 @@ If this is the first release of a major version change, i.e. `0.9.0` or `0.10.0` The git tree should now look like this: -
- -
- + * Now login at `dev.azure.com` to access the azure pipelines. Wait for the CI to finish the build. * The package for `0.10.2` should now be on the `avalonia-all` nuget feed. You should run a due diligence test on this build to ensure you are happy with the release and the packages work. @@ -25,25 +28,17 @@ Don't assume the Nuget packages will work just because master was working. In th * Now click on "Releases" and select "Avalonia (master / release)" pipeline as shown below. -
- -
+ * On the release for your release branch `release/0.10.2` click on the badge for "Nuget Release" -
- -
+ -
- -
+ * Then click on `Deploy`. -
- -
+ :::info At this point the packages will deploy to Nuget, it can take between 10 and 20 minutes for them to be indexed and publicly available. [https://www.nuget.org/packages/Avalonia/](https://www.nuget.org/packages/Avalonia/) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/input/routed-events.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/input/routed-events.md index 34fe929b3..979a1e4bc 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/input/routed-events.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/input/routed-events.md @@ -3,6 +3,8 @@ id: routed-events title: Routed Events --- +import InputEventRoutingScreenshot from '/img/input/routed-events/input-event-routing.png'; + Most events in Avalonia are implemented as Routed Events. Routed events are events that are raised on the whole tree rather than just the control that raised the event. ## What Is a Routed Event @@ -220,10 +222,7 @@ Avalonia input events that come in pairs are implemented so that a single user a As an illustration of how input event processing works, consider the following input event example. In the following tree illustration, `leaf element #2` is the source of a `PointerPressed` event: -
- Event routing diagram -
- +Event routing diagram The order of event processing is as follows: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/layout/alignment-margins-and-padding.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/layout/alignment-margins-and-padding.md index 55628c326..d7c1631a2 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/layout/alignment-margins-and-padding.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/layout/alignment-margins-and-padding.md @@ -3,6 +3,12 @@ id: alignment-margins-and-padding title: Alignment, Margins and Padding --- +import LayoutMarginsPaddingAlignmentBasicScreenshot from '/img/layout/alignment-margins-and-padding/layout-margins-padding-alignment-graphic1.png'; +import LayoutMarginsPaddingAlignmentBasicAnnotatedScreenshot from '/img/layout/alignment-margins-and-padding/layout-margins-padding-alignment-graphic2.png'; +import LayoutHorizontalAlignmentScreenshot from '/img/layout/alignment-margins-and-padding/layout-horizontal-alignment-graphic.png'; +import LayoutVerticalAlignmentScreenshot from '/img/layout/alignment-margins-and-padding/layout-vertical-alignment-graphic.png'; +import LayoutMarginsPaddingAlignmentComplexAnnotatedScreenshot from '/img/layout/alignment-margins-and-padding/layout-margins-padding-aligment-graphic3.png'; + An Avalonia control exposes several properties that are used to precisely position child elements. This topic discusses four of the most important properties: `HorizontalAlignment`, `Margin`, `Padding`, and `VerticalAlignment`. The effects of these properties are important to understand, because they provide the basis for controlling the position of elements in Avalonia applications. ### Introduction to Element Positioning @@ -11,9 +17,7 @@ There are numerous ways to position elements using Avalonia. However, achieving The following illustration shows a layout scenario that utilizes several positioning properties. -
- Positioning Example -
+Positioning Example At first glance, the `Button` elements in this illustration may appear to be placed randomly. However, their positions are actually precisely controlled by using a combination of margins, alignments, and padding. @@ -47,9 +51,7 @@ The following example describes how to create the layout in the preceding illust The following diagram provides a close-up view of the various positioning properties that are used in the preceding sample. Subsequent sections in this topic describe in greater detail how to use each positioning property. -
- Positioning Properties -
+Positioning Properties ### Understanding Alignment Properties @@ -79,9 +81,7 @@ The following example shows how to apply the `HorizontalAlignment` property to ` The preceding code yields a layout similar to the following image. The positioning effects of each `HorizontalAlignment` value are visible in the illustration. -
- HorizontalAlignment Sample -
+HorizontalAlignment Sample #### VerticalAlignment Property @@ -121,9 +121,7 @@ The following example shows how to apply the `VerticalAlignment` property to `Bu The preceding code yields a layout similar to the following image. The positioning effects of each `VerticalAlignment` value are visible in the illustration. -
- VerticalAlignment property sample -
+VerticalAlignment property sample ### Understanding Margin Properties @@ -231,6 +229,4 @@ The following example demonstrates each of the concepts that are detailed in thi When compiled, the preceding application yields a UI that looks like the following illustration. The effects of the various property values are evident in the spacing between elements, and significant property values for elements in each column are shown within `TextBlock` elements. -
- Several positioning properties in one application -
\ No newline at end of file +Several positioning properties in one application diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/styling/troubleshooting.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/styling/troubleshooting.md index 109ef2743..5db2ddce7 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/styling/troubleshooting.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/styling/troubleshooting.md @@ -85,7 +85,7 @@ The following code example of styles that can be expected to work on top of defa - ``` diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/templates/data-templates.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/templates/data-templates.md index dc1ed9b48..bb7fa48b0 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/templates/data-templates.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/templates/data-templates.md @@ -3,6 +3,11 @@ id: data-templates title: Data Templates --- +import ControlContentButtonScreenshot from '/img/templates/data-templates/hello-world-button.png'; +import ControlContentStringScreenshot from '/img/templates/data-templates/hello-world-string.png'; +import ControlContentStudentNoTemplateScreenshot from '/img/templates/data-templates/student-no-datatemplate.png'; +import ControlContentStudentScreenshot from '/img/templates/data-templates/student-first-last-name (1) (1) (1) (1) (1).png'; + Many controls have a `Content` property, such as [`ContentControl.Content`](http://reference.avaloniaui.net/api/Avalonia.Controls/ContentControl/4B02A756). `Window` inherits from [`ContentControl`](../controls/contentcontrol), so lets use that as an example. You're probably familiar with what happens when you put a control in the `Window.Content` property - the window displays the control: ```markup @@ -15,10 +20,7 @@ Many controls have a `Content` property, such as [`ContentControl.Content`](http ``` -
- Hello World button -
- +Hello World button Similarly if you put a string as the window content, the window will display the string: @@ -29,9 +31,7 @@ Similarly if you put a string as the window content, the window will display the ``` -
- Hello World string -
+Hello World string But what happens if you try to display an object as the window content? @@ -60,9 +60,7 @@ namespace Example ``` -
- Student without DataTemplate -
+Student without DataTemplate Not very helpful. That's because Avalonia doesn't know _how_ to display an object of type `Student` - because it's not a control it falls back to just calling `.ToString()` on the object. We can tell Avalonia how to display non-control objects by defining a data template. @@ -89,10 +87,7 @@ The easiest way to do this on `Window` (and any control that inherits from `Cont ``` - -
- Student first and last name -
+Student first and last name The data template for the window content doesn't only come from the `ContentTemplate` property. Every control also has a `DataTemplates` collection into which any number of data templates can be placed. If a control doesn't have a template set locally (e.g. in `ContentTemplate`) then it will look in its `DataTemplates` collection for a matching template. If a match isn't found there it will then go on to search its parent's `DataTemplates`, then its grandparent's, and so on until it reaches the `Window`. If it _still_ hasn't found a match it will then look in `App.xaml`/`App.axaml` for a matching `DataTemplate` and finally when all those options have been exhausted it will simply call `.ToString()` on the object. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md index e39f4c946..5d95dd9f4 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md @@ -5,7 +5,7 @@ title: Build and run your Application on a Simulator Please ensure you have followed the guide [create-a-cross-platform-solution.md](../create-a-cross-platform-solution.md "mention"). -Assuming you have created a project called `HelloWord`. Enter the directory `HelloWorld.Android` from the command line. +Assuming you have created a project called `HelloWorld`. Enter the directory `HelloWorld.Android` from the command line. To build the project for Android run the following command. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md index 57b04dcdd..4ca93bcfb 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md @@ -14,8 +14,8 @@ dotnet workload install android ``` :::info -You may need to run the command with `sudo`\ -\ +You may need to run the command with `sudo` + You may also need to uninstall old versions. `dotnet workload remove android` ::: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md index 856c10bd1..51958852c 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md @@ -3,9 +3,11 @@ info: build-and-run-your-application-on-a-simulator title: Build and run your application on a Simulator --- +import SimulatoriPadScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator/image (34).png'; + Please ensure you have followed the guide [create-a-cross-platform-solution.md](../create-a-cross-platform-solution.md "mention"). -Assuming you have created a project called `HelloWord`. Enter the directory `HelloWorld.iOS` from the command line. +Assuming you have created a project called `HelloWorld`. Enter the directory `HelloWorld.iOS` from the command line. To build the project for iOS run the following command. @@ -19,8 +21,6 @@ To run the project in a simulator, run the following command. dotnet run ``` -
- Application running on iPad simulator -
+Application running on iPad simulator If you use `JetBrains Rider` or `Visual Studio for Mac` you can open the solution and run, build and debug your program inside the simulator. \ No newline at end of file diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md index 8ddfd7cd8..23d0a2c08 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md @@ -3,72 +3,65 @@ info: build-and-run-your-application-on-your-iphone-or-ipad title: Build and Run your Application on your iPhone or iPad --- +import BuildiOSOpenXcodeScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/Screenshot 2022-03-17 at 12.09.54.png'; +import BuildiOSCreateXcodeProjectScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (36).png'; +import BuildiOSSelectProjectOptionsScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (30).png'; +import BuildiOSSelectAnyDeviceScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (35).png'; +import BuildiOSAddAdditionalSimulatorsScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (32).png'; +import BuildiOSProvisionPhoneScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/Screenshot 2022-03-17 at 12.19.06.png'; +import BuildiOSSelectDeviceScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (24).png'; +import BuildiOSChangeBundleIdentifierScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (18).png'; +import BuildiOSCertScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (33).png'; + In order to allow dotnet to sideload your application to your iphone or ipad you must first use Xcode to provision your device. Before continuing follow this guide to create a free Apple developer signing certificate. -[Free Provisiong for Xamarin.iOS Applications](https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning) +[Free Provisioning for Xamarin.iOS Applications](https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning) This has to be done by creating an Xcode app project that has the same `bundle identifier` that you will use in your application. 1. Open Xcode -
- -
- + -2\. Select Create a new Xcode project +2. Select Create a new Xcode project -
- -
+ -3\. Select iOS and App and click Next. +3. Select iOS and App and click Next. -
- -
+ -4\. Type in a name for your project and Organisation. Keep all the rest of the information the same. +4. Type in a name for your project and Organisation. Keep all the rest of the information the same. -5\. Choose a directory to save the project. You will not need to keep the project so don't worry too much about where. +5. Choose a directory to save the project. You will not need to keep the project so don't worry too much about where. -6\. In the status bar at the top click on the "Any device (arm64)" +6. In the status bar at the top click on the "Any device (arm64)" -
- -
+ -7\. At the bottom of the list click "Add Additional Simulators..." +7. At the bottom of the list click "Add Additional Simulators..." -
- -
+ -8\. Click on devices and connect your iPhone or iPad with the USB cable. Xcode will start to provision your phone for development. +8. Click on devices and connect your iPhone or iPad with the USB cable. Xcode will start to provision your phone for development. -
- -
+ -9\. Select you iPhone or iPad from the device list. +9. Select you iPhone or iPad from the device list. -
- -
+ -10\. Click the play button and the app will be installed and run on your phone. +10. Click the play button and the app will be installed and run on your phone. If successful you may return to your IDE of choice and open the `info.plist` file from the iOS project. -11\. Change the bundle identifier to the same as the one you choose in Xcode in step 3. +11. Change the bundle identifier to the same as the one you choose in Xcode in step 3. -
- -
+ -12\. Now edit the `.iOS.csproj` file. +12. Now edit the `.iOS.csproj` file. ```xml ios-arm64 @@ -85,9 +78,7 @@ Add a `` tag. To find the value for this open the application `KeyChain Access`. In the search box search for development. -
- -
+ Set the value exactly as the bold text at the top of the window on your selected development certificate. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md index 5629430b6..5a3534715 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md @@ -18,8 +18,8 @@ dotnet workload install ios ``` :::info -You may need to run the command with `sudo`\ -\ +You may need to run the command with `sudo` + You may also need to uninstall old versions. `dotnet workload remove ios` ::: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md index 2322210c6..ed4885fd5 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md @@ -3,6 +3,10 @@ id: add-and-layout-controls title: Add and Layout Controls --- +import MusicStoreBuyButtonScreenshot from '/img/tutorials/music-store-app/add-and-layout-controls/buy-button.png'; +import MusicStoreAddStylesScreenshot from '/img/tutorials/music-store-app/add-and-layout-controls/add-styles.png'; +import MusicStorePrettyButtonScreenshot from '/img/tutorials/music-store-app/add-and-layout-controls/pretty-button.png'; + ## Add and Layout some Controls Let's start by adding a `Button` to the `MainWindow`. The button will allow the `user` to purchase music in order to add to their collection. @@ -60,9 +64,7 @@ public class MainWindowViewModel : ViewModelBase Pressing the `Debug Button` again to run the program we can see we have a button and when clicked setting a breakpoint inside the `BuyMusicCommand` code we can see that the code is executed when it's hit. -
- Buy Button -
+Buy Button Let's position the button to the top right of the screen and make it look a bit nicer. @@ -94,9 +96,7 @@ Let's create a file just for Icons. In Rider right click on the project and select `Add` → `Avalonia Styles` -
- Add Styles -
+Add Styles Enter the name `Icons` when prompted and press `Enter`. @@ -156,6 +156,4 @@ Return to `MainWindow.axaml`, we can add the Icon to the Button like so... Running the application we now have a nice button. -
- Pretty Button -
\ No newline at end of file +Pretty Button diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md index 13ebde540..d1d4fb6dd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md @@ -3,6 +3,10 @@ id: add-content-to-dialog title: Add Content to Dialog --- +import MusicStoreMockSearchScreenshot from '/img/tutorials/music-store-app/add-content-to-dialog/text-list.png'; +import MusicStoreBeforeWrapPanelScreenshot from '/img/tutorials/music-store-app/add-content-to-dialog/image-20210310010932979.png'; +import MusicStoreWrapPanelScreenshot from '/img/tutorials/music-store-app/add-content-to-dialog/image-20210310011526700.png'; + ## Adding Content to the Dialog Inside the dialog we would like the user to search for albums, and then select an album to buy. @@ -275,10 +279,7 @@ Your `MusicStoreWindow.axaml` should look like this. Run the application: - -
- -
+ Our items are showing in the List... but not very visual. @@ -333,9 +334,7 @@ We shall come back to the `Bindings` in a moment, for now lets run the applicati As can be seen the albums are displayed vertically. However it would be nice to have them horizontally and wrap around. -
- -
+ Luckily `ListBox` provides a solution to this with something called `ItemsPanelTemplate`. By default the `ListBox` has its `ItemPanel` property set to an `ItemsPanelTemplate` which contains a `StackPanel`, we can change this to a `WrapPanel` like so. @@ -351,9 +350,7 @@ Luckily `ListBox` provides a solution to this with something called `ItemsPanelT Now when we run the application we get: -
- -
+ As our list gets more items, that will wrap around onto the next line, and the user will be able to scroll. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md index 23ce7a6ab..83df24ebd 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md @@ -3,6 +3,8 @@ id: add-items-to-users-collection title: Add Items to User Collection --- +import MusicStoreAddedAlbumsScreenshot from '/img/tutorials/music-store-app/add-items-to-users-collection/image-20210310175949319.png'; + ## Adding Albums to the Users Collection Ok so now the user can find albums to purchase, it would be nice if the user could see which albums are in their collection. To do this we can add a similar UI to the MainWindow. @@ -112,8 +114,6 @@ Notice we check the result for `null`, this is because the `user` may have cance Lets run the program and see if it works. -
- -
+ For the finishing touch we simply need to add persistence to the application. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md index 9d8d85c8f..e365f2484 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md @@ -3,6 +3,10 @@ info: creating-a-modern-looking-window title: Creating a Modern looking Window --- +import MusicStoreDarkModePreviewScreenshot from '/img/tutorials/music-store-app/creating-a-modern-looking-window/dark-mode-preview.png'; +import MusicStoreAcrylicMaterialScreenshot from '/img/tutorials/music-store-app/creating-a-modern-looking-window/acrylic-material.png'; +import MusicStoreFullAcrylicWindowScreenshot from '/img/tutorials/music-store-app/creating-a-modern-looking-window/full-acrylic-window.png'; + ## Use Dark Mode and Add a little Acrylic Let's try and make this look a little more modern by applying `Dark` mode and some `Acrylic` styling to the Window. @@ -30,9 +34,7 @@ Let's try and make this look a little more modern by applying `Dark` mode and so The previewer knows about changes you make to the file your editing, but it doesn't know about changes in other files. This is why you need to build the project if another file was changed. -
- -
+ 1. After where it says `Title="Avalonia.MusicStore"` add the following code: @@ -90,11 +92,9 @@ Now click the `Debug` `Button` to run the application again. Notice we have a nice acrylic window effect. Shame about the titlebar, though. Let's see how we can make that blend in a bit more. -
- -
+ -\*Note, Linux users can not yet take advantage of this due to limitations of X11. The code will run and the window will still work on Linux, but the full effect will not be realised. +*Note, Linux users can not yet take advantage of this due to limitations of X11. The code will run and the window will still work on Linux, but the full effect will not be realised. 1. It is possible to have Avalonia render into the `titlebar`, allowing us to create a more blended look. Modern web browsers tend to render tabs into the titlebar with this technique. @@ -120,9 +120,6 @@ Notice we have a nice acrylic window effect. Shame about the titlebar, though. L Press the `Debug` button again to run. - -
- Full acrlic window -
+Full acrylic window Perfect, a modern looking Window, Avalonia is able to render every pixel. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md index 8f40bcf7d..92d67f8fe 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md @@ -3,6 +3,11 @@ id: creating-the-project title: Create the Project --- +import MusicStoreCreateSolutionScreenshot from '/img/tutorials/music-store-app/creating-the-project/CreateSolution.png'; +import MusicStoreProjectStructureScreenshot from '/img/tutorials/music-store-app/creating-the-project/project-structure.png'; +import MusicStoreRiderDebugButtonScreenshot from '/img/tutorials/music-store-app/creating-the-project/debug-button.png'; +import MusicStoreNewAppScreenshot from '/img/tutorials/music-store-app/creating-the-project/image-20210310192926578.png'; + ### Creating a New Project From the Rider Welcome Screen, click on `New Solution`. This will open a dialog with Project Types on the left and some input fields on the right. @@ -11,15 +16,11 @@ At the bottom on the left hand side under the heading `Other` you will see `Aval Click the `Create` button. -
- -
+ A new project will be created with the following structure. -
- -
+ The folders are: @@ -45,14 +46,10 @@ Some of the important files are: Press the debug button top right of the IDE to compile and run the project. -
- -
+ This will show a Window that looks like: -
- -
+ A little plain but we now have a running application, and a blank canvas to start from. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/displaying-images.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/displaying-images.md index a1e7e32e8..dcc33f1bf 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/displaying-images.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/displaying-images.md @@ -3,6 +3,8 @@ info: displaying-images title: Displaying Images --- +import MusicStoreDisplayingImagesScreenshot from '/img/tutorials/music-store-app/displaying-images/image-20210310173858088.png'; + ## Displaying Album Cover Images So we have the Albums showing with the Artist name and Title, however, if we can download the Album art and display it, this will really bring the app alive. @@ -162,6 +164,4 @@ Now run the application and search for your favourite artist. Notice how the Albums covers load one by one, but that the UI remains responsive. -
- -
\ No newline at end of file + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/index.md index c179a34e1..c78b0e770 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/index.md @@ -1,5 +1,8 @@ # Music Store App +import MusicStoreFinishedAppScreenshot from '/img/tutorials/music-store-app/image-20210310184538120.png'; +import MusicStoreMvvmDiagram from '/img/tutorials/music-store-app/mvvm.png'; + :::info The completed project can be found at [https://github.com/AvaloniaUI/Avalonia.MusicStore](https://github.com/AvaloniaUI/Avalonia.MusicStore). @@ -12,10 +15,7 @@ This guide has instructions for Rider on macOS, however the steps will be almost Our livestream assumes some knowledge of [XAML](../../guides/basics/introduction-to-xaml.md), [MVVM ](../../guides/basics/mvvm.md)development, however this guide should fill in the gaps for beginners. -
- -
- + ## A little background to Avalonia @@ -39,9 +39,7 @@ MVVM is simply a way to enforce [Separation of concerns](https://en.wikipedia.or Following the MVVM approach will alleviate these difficulties and help keep your UI code scalable. -
- -
+ **How does MVVM work?** diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md index 9e8e3fcaf..d145a5746 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md @@ -3,6 +3,8 @@ info: load-data-at-startup title: Load data at Startup --- +import MusicStoreLoadedDataStartScreenshot from '/img/tutorials/music-store-app/load-data-at-startup/image-20210310184202271.png'; + ## Loading Albums on Startup Our backend code provides a nice way to load the users collection from disk. @@ -38,6 +40,4 @@ As you can see it firstly uses the business logic apis to load the list of `Albu Note we then re-iterate over the `Albums` and asynchronously load each cover. Note that we do this after adding all the albums to the list, as its more important to quickly show the user all the albums available and then load the images. -
- -
\ No newline at end of file + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md index 2730f6567..8a8b60a00 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md @@ -3,6 +3,9 @@ id: opening-a-dialog title: Opening a Dialog --- +import MusicStoreAddWindowScreenshot from '/img/tutorials/music-store-app/opening-a-dialog/add-window.png'; +import MusicStoreDialogOpenedScreenshot from '/img/tutorials/music-store-app/opening-a-dialog/dialog-opened.png'; + ## Opening a Dialog Opening a dialog is an advanced topic, if you are very new to Avalonia, try not to get too stuck on this section, you may want to just copy in the code and move on. Then come back once you have a better understanding of some of the basics. @@ -13,9 +16,7 @@ First we need to add a Window to the project, right click on the `Views` folder When prompted name this MusicStoreWindow and press the `Enter` key. -
- Add Window -
+Add Window This will add the following code: @@ -196,8 +197,6 @@ Also set `Width` and `Height` properties of the `MusicStoreWindows` `` e Now run the application and click the Store button. -
- Dialog opened -
+Dialog opened As you can see the dialog window is opened perfectly centered inside the MainWindow. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md index 88923c2b3..91b24e8d1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md @@ -3,6 +3,9 @@ info: searching-for-albums title: Searching for Albums --- +import MusicStoreiTunesSearchNugetScreenshot from '/img/tutorials/music-store-app/searching-for-albums/image-20210310013703557.png'; +import MusicStoreAlbumViewScreenshot from '/img/tutorials/music-store-app/searching-for-albums/image-20210310110401944.png'; + ## Searching For Albums In order for our application to work we are going to need some business logic. This code is not relevant to the tutorial, except for the fact that it will provide the following services: @@ -19,9 +22,7 @@ This will open the `Packages` tool at the bottom of the IDE, like so. Search for `ItunesSearch` and press the green `+` button on the right hand side to install it. -
- -
+ 1. In the `Models` folder add a new class called `Album` and paste in the following code. @@ -211,6 +212,4 @@ SearchResults.Add(new AlbumViewModel()); Now run the application and click the store button, then search for an artist or album name. If all has gone to plan you should see the progressbar animating whilst the server is busy processing the request and then you should see some results appear in the list. -
- -
+ diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md index 15b31b7f9..e3bcf78f8 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md @@ -3,6 +3,11 @@ id: setup-development-environment title: Setup Development Environment --- +import MusicStoreRiderWelcomeScreenshot from '/img/tutorials/music-store-app/setup-development-environment/rider-welcome.png'; +import MusicStoreConfigurePluginReposScreenshot from '/img/tutorials/music-store-app/setup-development-environment/configure-plugin-repos.png'; +import MusicStoreEnterPluginRepoScreenshot from '/img/tutorials/music-store-app/setup-development-environment/enter-plugin-repo.png'; +import MusicStorePluginInstallScreenshot from '/img/tutorials/music-store-app/setup-development-environment/plugin-install.png'; + ### Setting up your development environment 1. Download and install .NET 5 SDK [Download .NET \(Linux, macOS, and Windows\) \(microsoft.com\)](https://dotnet.microsoft.com/download) @@ -41,27 +46,18 @@ Examples: Once Rider loads you will see the Welcome Screen. Click the `Configure` dropdown and select `Plugins`. -
- rider welcome -
+Rider welcome A new Preferences Screen will open up. Click the `Settings` icon as shown and select `Manage Plugin Repositories...` -
- configure-plugin-repos -
+Configure plugin repos Click the `+` icon and enter the URL `https://plugins.jetbrains.com/plugins/dev/14839`then click `OK` -
- enter-plugin-repo -
+Enter plugin repo Now click on the `Marketplace` tab and search for `Avalonia`. Select `AvaloniaRider` and click `Install` then once that's done, click the `Restart IDE` button that will appear. -
- plugin-install -
- +Plugin install Now Rider should be ready to develop Avalonia applications. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/running-in-the-browser.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/running-in-the-browser.md index ecf19c0d2..c0c18966e 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/running-in-the-browser.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/running-in-the-browser.md @@ -32,7 +32,7 @@ dotnet new avalonia.xplat 5. In order to run simply do: ```bash -cd WebTest.Web +cd WebTest.Browser dotnet run ``` @@ -50,4 +50,4 @@ Legacy Blazor backend is still available for compatability and can be referenced ## Troubleshooting -If you have not performed the step to install required workloads, you will encounter errors when running the app in your browser later (e.g. `System.DllNotFoundException: libSkiaSharp`) and you will need to rebuild again before the app will run. \ No newline at end of file +If you have not performed the step to install required workloads, you will encounter errors when running the app in your browser later (e.g. `System.DllNotFoundException: libSkiaSharp`) and you will need to rebuild again before the app will run. diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md index c4649787a..e5c6f180f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md @@ -3,6 +3,10 @@ id: adding-new-items title: Adding new Items --- +import ToDoAddNewItemsEmptyScreenshot from '/img/tutorials/todo-list-app/adding-new-items/adding-new-items-view.png'; +import ToDoAddNewItemNavigationScreenshot from '/img/tutorials/todo-list-app/adding-new-items/adding-new-item-run.gif'; +import ToDoAddNewItemResultScreenshot from '/img/tutorials/todo-list-app/adding-new-items/adding-new-items-2-run.gif'; + When we originally created the `TodoListView` we added an "Add an item" button. It's time now to make that button do something. When the button is clicked we want to replace the list of items with a new view which will allow the user to enter the description of a new item. ### Create the view @@ -30,9 +34,7 @@ Views/AddItemView.axaml This gives us a view which looks like this: -
- The view -
+The view The only new thing here is the `` control which is a control that allows a user to input text. We set three properties on it: @@ -164,9 +166,7 @@ If you're familiar with WPF or UWP you may think it strange that we're binding ` If you now run the application and click the "Add an item" button you should see the new view appear. -
- The running application -
+The running application Now we have the "Add new item" view appearing we need to make it work. In particular we need to enable/disable the OK button depending on whether the user has typed anything in the `Description`. @@ -369,7 +369,4 @@ Finally we subscribe to the result of the observable sequence. If the command re ### Run the application - -
- The running application -
\ No newline at end of file +The running application diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md index af74ff5ab..1e00973cf 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md @@ -3,13 +3,13 @@ id: creating-a-new-project title: Creating a new project --- +import ToDoVsCreateNewProjectScreenshot from '/img/tutorials/todo-list-app/creating-a-new-project/image (5).png'; + ## Visual Studio The easiest way to get started with Avalonia from Visual Studio is to [install the extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) from the Visual Studio Marketplace. Once that is installed, you can create an Avalonia MVVM application: -
- Decription -
+ - Start Visual Studio - Select "Create a new project" from the start window or `File -> New -> Project` from the main menu diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md index b1e584ab5..9639f7025 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md @@ -3,6 +3,9 @@ id: creating-a-view title: Creating a View --- +import ToDoViewPreviewerScreenshot from '/img/tutorials/todo-list-app/creating-a-view/creating-a-view-todolistview.png'; +import ToDoViewScreenshot from '/img/tutorials/todo-list-app/creating-a-view/creating-a-view-run.png'; + Let's first create a view to display a list of TODO items together with a button to add a new item. Because this is a first tutorial, we're going to first just populate the view with some hard-coded data. In later steps we'll use the MVVM pattern to populate this view. @@ -93,9 +96,7 @@ Edit the contents of `Views/TodoListView.axaml` to contain the following: If you're using the Visual Studio extension you should see the contents of the control displayed in the previewer after completing a build: -
- Designer view -
+Designer view ### What does it all mean? diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/index.md index a0dfe4086..2d4ef6641 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/index.md @@ -1,14 +1,14 @@ # ToDo List App +import ToDoFinishedAppScreenshot from '/img/tutorials/todo-list-app/image (14).png'; + In this tutorial we're going to be creating a simple TODO application in Avalonia using the Model-View-ViewModel \(MVVM\) pattern. :::info You can find the code for the completed application [here](https://github.com/grokys/todo-tutorial). ::: -
- Decription -
+ ## Model-View-ViewModel \(MVVM\) diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md index 454da9c6f..155469eba 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md @@ -3,6 +3,8 @@ id: wiring-up-the-views title: Wiring up the Views --- +import ToDoWiredViewScreenshot from '/img/tutorials/todo-list-app/wiring-up-the-views/wiring-up-views-run.png'; + Now that we've got the view models set up, we need to make our views use these view models. We do this by making use of Avalonia's [data binding](../../getting-started/programming-with-avalonia/data-binding) feature. ## Update MainWindow @@ -97,6 +99,4 @@ How each item is displayed is controlled by the `ItemTemplate`. The `ItemTemplat If you now run the application you will see the items in the \(fake\) database displayed. -
- The running application -
\ No newline at end of file + diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/datatemplates.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/datatemplates.md index e0a317e97..6a72f8960 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/datatemplates.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/datatemplates.md @@ -1,6 +1,6 @@ --- info: datatemplates -title: DataTempaltes +title: DataTemplates --- As styles aren't stored in `Resources`, neither are `DataTemplates`. Instead, `DataTemplates` are placed in a `DataTemplates` collection on each control \(and on `Application`\): @@ -25,4 +25,4 @@ Data templates in Avalonia can also target interfaces and derived classes \(whic ## DataTemplateSelector -In WPF you can create a `DataTemplateSelector` to select or create a `DataTemplate` based on the provided data. In Avalonia you cannot do this, but you can implement `IDataTemplate` which can be seen as a good replacement for the `DataTemplateSelector`. Please find a sample [here](https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/DataTemplates/IDataTemplateSample). \ No newline at end of file +In WPF you can create a `DataTemplateSelector` to select or create a `DataTemplate` based on the provided data. In Avalonia you cannot do this, but you can implement `IDataTemplate` which can be seen as a good replacement for the `DataTemplateSelector`. Please find a sample [here](https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/DataTemplates/IDataTemplateSample). diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/index.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/index.md index edfe2a77b..65c700f41 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/index.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.10.x/wpf-developer-tips/index.md @@ -86,7 +86,7 @@ private void OnControl_Unloaded(object sender, RoutedEventArgs e) **Avalonia** ``` TemplateApplied += OnControl_Loaded; -private void BuildControl_Loaded(object sender, RoutedEventArgs e) +private void OnControl_Loaded(object sender, RoutedEventArgs e) { } @@ -129,4 +129,4 @@ TextRunProperties.SetTextDecorations(TextDecorations.Underline); **Avalonia** ```csharp TextRunProperties.Underline = true; -``` \ No newline at end of file +``` diff --git a/sidebars.js b/sidebars.js index a327acec6..378c463c5 100644 --- a/sidebars.js +++ b/sidebars.js @@ -16,9 +16,13 @@ const sidebars = { 'get-started/install', 'get-started/set-up-an-editor', { - type: 'category', - label: 'Test Drive', - items: [ + 'type': 'category', + 'label': 'Test Drive', + 'link' : { + 'type' : 'doc', + 'id': 'get-started/test-drive/index' + }, + 'items': [ 'get-started/test-drive/introduction', 'get-started/test-drive/create-a-project', 'get-started/test-drive/main-window', diff --git a/src/css/custom.css b/src/css/custom.css index b4684da4d..9057f189c 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -115,6 +115,13 @@ img.rounded-corners { border-radius: 50px; } +img.center { + display: block; + margin-left: auto; + margin-right: auto; + padding-bottom: 1rem; +} + .docusaurus-highlight-code-line { background-color: rgb(72, 77, 91); display: block; diff --git a/static/img/controls/colorpicker/color-palette-flat-half.png b/static/img/controls/colorpicker/color-palette-flat-half.png new file mode 100644 index 000000000..aa1c9091c Binary files /dev/null and b/static/img/controls/colorpicker/color-palette-flat-half.png differ diff --git a/static/img/controls/colorpicker/color-palette-flat.png b/static/img/controls/colorpicker/color-palette-flat.png new file mode 100644 index 000000000..acd3253fd Binary files /dev/null and b/static/img/controls/colorpicker/color-palette-flat.png differ diff --git a/static/img/controls/colorpicker/color-palette-fluent.png b/static/img/controls/colorpicker/color-palette-fluent.png new file mode 100644 index 000000000..3218a10c5 Binary files /dev/null and b/static/img/controls/colorpicker/color-palette-fluent.png differ diff --git a/static/img/controls/colorpicker/color-palette-material-half.png b/static/img/controls/colorpicker/color-palette-material-half.png new file mode 100644 index 000000000..332011747 Binary files /dev/null and b/static/img/controls/colorpicker/color-palette-material-half.png differ diff --git a/static/img/controls/colorpicker/color-palette-material.png b/static/img/controls/colorpicker/color-palette-material.png new file mode 100644 index 000000000..b5ea07ece Binary files /dev/null and b/static/img/controls/colorpicker/color-palette-material.png differ diff --git a/static/img/controls/colorpicker/color-palette-sixteen.png b/static/img/controls/colorpicker/color-palette-sixteen.png new file mode 100644 index 000000000..22bbd838e Binary files /dev/null and b/static/img/controls/colorpicker/color-palette-sixteen.png differ diff --git a/static/img/gitbook-import/assets/progressbar.PNG b/static/img/gitbook-import/assets/progressbar.png similarity index 100% rename from static/img/gitbook-import/assets/progressbar.PNG rename to static/img/gitbook-import/assets/progressbar.png diff --git a/versioned_docs/version-0.10.x/animations/page-transitions.md b/versioned_docs/version-0.10.x/animations/page-transitions.md index 8e2b767d6..c6f7b195b 100644 --- a/versioned_docs/version-0.10.x/animations/page-transitions.md +++ b/versioned_docs/version-0.10.x/animations/page-transitions.md @@ -6,6 +6,8 @@ title: Page Transitions import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CustomPageTransitionScreenshot from '/img/animations/page-transitions/TransitioningContentControl_03.webp'; + `PageTransitions` are used to render a transition between two views, for example in a [Carousel](../controls/carousel) or [TransitioningContentControl](../controls/TransitioningContentControl) :::warning @@ -270,9 +272,7 @@ public class CustomTransition : IPageTransition } ``` -
- Custom Transition Example -
+ #### Source code [IPageTransition.cs](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Visuals/Animation/IPageTransition.cs) diff --git a/versioned_docs/version-0.10.x/community.md b/versioned_docs/version-0.10.x/community.md index 45728fe80..d79f110dd 100644 --- a/versioned_docs/version-0.10.x/community.md +++ b/versioned_docs/version-0.10.x/community.md @@ -1,7 +1,13 @@ # Community Support +import TelegramLogoScreenshot from '/img/gitbook-import/assets/image (7) (1) (1).png'; +import GitterLogoScreenshot from '/img/gitbook-import/assets/image (38) (1) (1).png'; +import GitterChatScreenshot from '/img/gitbook-import/assets/image (37) (1) (1).png'; + ## Telegram + + You can also access the Avalonia chat using the _Telegram_ app (recommended for the best experience). :::info @@ -10,15 +16,12 @@ You can access the _Telegram_ chat [here](https://t.me/Avalonia). ## Gitter - + We run a chat in English on the Gitter platform. - + :::info Access the chat in your browser using Gitter [here](https://gitter.im/AvaloniaUI/Avalonia). ::: - - - diff --git a/versioned_docs/version-0.10.x/controls/border.md b/versioned_docs/version-0.10.x/controls/border.md index 9d133207e..40b96c110 100644 --- a/versioned_docs/version-0.10.x/controls/border.md +++ b/versioned_docs/version-0.10.x/controls/border.md @@ -3,6 +3,9 @@ id: border title: Border --- +import BorderSampleScreenshot from '/img/controls/border/image (2).png'; +import BorderBoxShadowScreenshot from '/img/controls/border/image (8).png'; + The `Border` control decorates a child with a border and background. It can also be used to display rounded corners by setting the [`CornerRadius`](http://reference.avaloniaui.net/api/Avalonia/CornerRadius/) property. An example of a border with a red background, 2 pixel black border, 3 pixel corner radius and a 4 pixel padding around its content: @@ -20,9 +23,7 @@ An example of a border with a red background, 2 pixel black border, 3 pixel corn ``` -
- -
+ ## Box Shadows @@ -61,9 +62,7 @@ To specify multiple shadows, provide a comma-separated list of shadows. ``` -
- -
+ ## Common Properties diff --git a/versioned_docs/version-0.10.x/controls/buttons/button.md b/versioned_docs/version-0.10.x/controls/buttons/button.md index 7f6a597ee..0d659ce63 100644 --- a/versioned_docs/version-0.10.x/controls/buttons/button.md +++ b/versioned_docs/version-0.10.x/controls/buttons/button.md @@ -3,6 +3,9 @@ id: button title: Button --- +import ButtonBasicScreenshot from '/img/controls/buttons/button/button_basic.png'; +import ButtonColoredScreenshot from '/img/controls/buttons/button/image.png'; + The `Button` control is a [`ContentControl`](../contentcontrol) which reacts to pointer presses. A button notifies clicks by raising the [`Click`](http://reference.avaloniaui.net/api/Avalonia.Controls/Button/61B1E7A8) event. A click is distinct from a `PointerDown` event in that it is raised by default when the button is pressed and then released (although this behavior can be changed by setting the [`ClickMode`](http://reference.avaloniaui.net/api/Avalonia.Controls/ClickMode/) property). @@ -55,17 +58,14 @@ The Button control's full documentation can be found [here](http://reference.ava x:Class="AvaloniaAppTemplate.MainWindow" Title="AvaloniaAppTemplate"> - +
``` -produces following output with **Windows 10**\ - -
- Basic button -
+produces following output with **Windows 10** +Basic button ### Colored button @@ -83,11 +83,9 @@ produces following output with **Windows 10**\ ``` -produces following output with **Windows 10**\ +produces following output with **Windows 10** -
- Colored button -
+Colored button ### Play button diff --git a/versioned_docs/version-0.10.x/controls/buttons/splitbutton.md b/versioned_docs/version-0.10.x/controls/buttons/splitbutton.md index a07b62dbc..b94bccdf7 100644 --- a/versioned_docs/version-0.10.x/controls/buttons/splitbutton.md +++ b/versioned_docs/version-0.10.x/controls/buttons/splitbutton.md @@ -3,6 +3,11 @@ id: splitbutton title: SplitButton --- +import SplitButtonClosedScreenshot from '/img/controls/buttons/splitbutton/SplitButtonClosed.png'; +import SplitButtonOpenedScreenshot from '/img/controls/buttons/splitbutton/SplitButtonOpened.png'; +import SplitButtonColorPickerScreenshot from '/img/controls/buttons/splitbutton/SplitButton_ColorPickerSample.png'; +import SplitButtonExportButtonScreenshot from '/img/controls/buttons/splitbutton/SplitButton_ExportButtonSample.png'; + The `SplitButton` functions as a [`Button`](button) with primary and secondary parts that can each be pressed separately. The primary part behaves like normal `Button` and the secondary part opens a [`Flyout`](../flyouts) with additional actions. @@ -58,16 +63,11 @@ The user-selection action should be invoked immediately when pressing either the ``` -
- -
- + *SplitButton (Flyout closed)* -
- -
+ *SplitButton (Flyout opened)* @@ -106,9 +106,7 @@ A common use case of a `SplitButton` is for coloring text within an editor. Pres ``` -
- -
+ *Sample of SplitButton for color selection* @@ -133,8 +131,6 @@ Another common example of the `SplitButton` could be an export button. When the ``` -
- -
+ *Sample of a SplitButton with different export options* diff --git a/versioned_docs/version-0.10.x/controls/buttons/togglesplitbutton.md b/versioned_docs/version-0.10.x/controls/buttons/togglesplitbutton.md index 627be38f5..6741f1ef0 100644 --- a/versioned_docs/version-0.10.x/controls/buttons/togglesplitbutton.md +++ b/versioned_docs/version-0.10.x/controls/buttons/togglesplitbutton.md @@ -3,6 +3,11 @@ id: togglesplitbutton title: ToggleSplitButton --- +import ToggleSplitButtonClosedUncheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_closed_unchecked.png'; +import ToggleSplitButtonClosedCheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_closed_checked.png'; +import ToggleSplitButtonOpenedCheckedScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_opened_checked.png'; +import ToggleSplitButtonTextListScreenshot from '/img/controls/buttons/togglesplitbutton/ToggleSplitButton_TextListExample.png'; + The `ToggleSplitButton` functions as a [`ToggleButton`](togglebutton) with primary and secondary parts that can each be pressed separately. The primary part behaves like a normal `ToggleButton` and the secondary part opens a [`Flyout`](../flyouts) with additional actions. :::info @@ -66,21 +71,15 @@ Pressing a configuration in the `Flyout` should either (1) turn on the feature w ``` -
- Decription -
+ *SplitButton (Flyout closed, unchecked)* -
- Decription -
+ *SplitButton (Flyout closed, checked)* -
- Decription -
+ *SplitButton (Flyout opened, checked)* @@ -122,10 +121,6 @@ Continuing the text editor example from `SplitButton`, a common use case of the ``` -
- Decription -
- + *Sample of ToggleSplitButton for toggle text lists on and off and selecting the list format* - diff --git a/versioned_docs/version-0.10.x/controls/canvas.md b/versioned_docs/version-0.10.x/controls/canvas.md index 74e81cf13..761924466 100644 --- a/versioned_docs/version-0.10.x/controls/canvas.md +++ b/versioned_docs/version-0.10.x/controls/canvas.md @@ -3,6 +3,8 @@ id: canvas title: Canvas --- +import CanvasChildOverlapScreenshot from '/img/controls/canvas/layout-panel-canvas.png'; + The `Canvas` control is a `Panel` which lays out its children by explicit coordinates. You specify the positions of individual child elements by setting the `Canvas.Left` and `Canvas.Top` attached properties on each element. @@ -24,11 +26,7 @@ Here's an example of a Canvas in XAML. The result looks like this. - -
- -
- + Use the Canvas panel with discretion. While it's convenient to be able to precisely control positions of elements in UI for some scenarios, a fixed positioned layout panel causes that area of your UI to be less adaptive to overall app window size changes. diff --git a/versioned_docs/version-0.10.x/controls/checkbox.md b/versioned_docs/version-0.10.x/controls/checkbox.md index 99a85a93b..1e7652a73 100644 --- a/versioned_docs/version-0.10.x/controls/checkbox.md +++ b/versioned_docs/version-0.10.x/controls/checkbox.md @@ -3,6 +3,9 @@ id: checkbox title: CheckBox --- +import CheckBoxTwoStateScreenshot from '/img/controls/checkbox/checkbox_basic.png'; +import CheckBoxThreeStateScreenshot from '/img/controls/checkbox/checkbox_threestate.png'; + The `CheckBox` control is a [`ContentControl`](../controls/contentcontrol) which allows user to check an option. It is usually used to display a boolean option where selection is either _checked_ or _unchecked_. But it also supports three state mode where selection is either _checked_, _indeterminate_ or _unchecked_. ## Common Properties @@ -39,12 +42,9 @@ The `CheckBox` control is a [`ContentControl`](../controls/contentcontrol) which ``` -produces following output with **Windows 10**\ - -
- Basic checkbox -
+produces following output with **Windows 10** +Basic checkbox ### Three state checkbox @@ -64,8 +64,6 @@ produces following output with **Windows 10**\ ``` -produces following output with **Windows 10**\ +produces following output with **Windows 10** -
- Three state checkbox -
\ No newline at end of file +Basic checkbox diff --git a/versioned_docs/version-0.10.x/controls/contentcontrol.md b/versioned_docs/version-0.10.x/controls/contentcontrol.md index 69d58a38f..c3a4d6db7 100644 --- a/versioned_docs/version-0.10.x/controls/contentcontrol.md +++ b/versioned_docs/version-0.10.x/controls/contentcontrol.md @@ -3,6 +3,8 @@ id: contentcontrol title: ContentControl --- +import ControlContentStudentScreenshot from '/img/controls/contentcontrol/student-first-last-name (1) (1) (1) (1).png'; + ## Common Properties | Property | Description | @@ -73,7 +75,7 @@ namespace Example } ``` -> Note: The following examples assume an instance of `MainWindowVieModel` is assigned to the Window's `DataContext`. See [the section on `DataContext`](docs/data-binding/the-datacontext) for more information. +> Note: The following examples assume an instance of `MainWindowViewModel` is assigned to the Window's `DataContext`. See [the section on `DataContext`](docs/data-binding/the-datacontext) for more information. We can display the student's first and last name in a `ContentControl` using the `ContentTemplate` property: @@ -94,9 +96,6 @@ We can display the student's first and last name in a `ContentControl` using the ``` -
- Student first and last name -
- +Student first and last name -For more information see the [data templates](docs/templates/data-templates) section. \ No newline at end of file +For more information see the [data templates](docs/templates/data-templates) section. diff --git a/versioned_docs/version-0.10.x/controls/datepicker.md b/versioned_docs/version-0.10.x/controls/datepicker.md index a1ffa81e5..f98635880 100644 --- a/versioned_docs/version-0.10.x/controls/datepicker.md +++ b/versioned_docs/version-0.10.x/controls/datepicker.md @@ -6,6 +6,9 @@ title: DatePicker import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import DatePickerSelectedDateScreenshot from '/img/controls/datepicker/selected-date.png'; +import DatePickerUnsetScreenshot from '/img/controls/datepicker/no-date.png'; + The `DatePicker` control allows the user to pick a date value. ## Examples @@ -37,9 +40,7 @@ DatePicker birthDatePicker = new DatePicker(); Use a `DatePicker` to let a user enter a date value. The user picks the date using [ComboBox](combobox.md) selection for month, day, and year values. You can customize the `DatePicker` in various ways to suit your app. -
- A date picker with a date selected. -
+A date picker with a date selected. ### Formatting the date picker @@ -53,9 +54,7 @@ The date picker control has both `Date` / `DateChanged` and `SelectedDate` / `Se The value of `SelectedDate` is used to populate the date picker and is `null` by default. If `SelectedDate` is `null`, the `Date` property is set to 12/31/1600; otherwise, the `Date` value is synchronized with the `SelectedDate` value. When `SelectedDate` is `null`, the picker is 'unset' and shows the field names instead of a date. -
- A date picker with no date selected. -
+A date picker with no date selected. To use the date value in your app, you typically use a data binding to the `SelectedDate` property, or handle the `SelectedDateChanged` event. diff --git a/versioned_docs/version-0.10.x/controls/dockpanel.md b/versioned_docs/version-0.10.x/controls/dockpanel.md index f1fb742cb..0cb32afb5 100644 Binary files a/versioned_docs/version-0.10.x/controls/dockpanel.md and b/versioned_docs/version-0.10.x/controls/dockpanel.md differ diff --git a/versioned_docs/version-0.10.x/controls/flyouts.md b/versioned_docs/version-0.10.x/controls/flyouts.md index fcb2e2bef..295e3479c 100644 --- a/versioned_docs/version-0.10.x/controls/flyouts.md +++ b/versioned_docs/version-0.10.x/controls/flyouts.md @@ -3,6 +3,9 @@ id: flyouts title: Flyouts --- +import FlyoutContentScreenshot from '/img/controls/flyouts/flyoutpreview.png'; +import FlyoutMenuScreenshot from '/img/controls/flyouts/menuflyoutpreview.png'; + ## Overview Flyouts are light dismissible containers that show arbitrary UI content. Flyouts are not controls and can be declared as a resource and shared between multiple elements within your app. @@ -44,15 +47,11 @@ Flyouts are light dismissible containers that show arbitrary UI content. Flyouts There are two built-in types of Flyouts: `Flyout` and `MenuFlyout`. A regular `Flyout` has no special logic and is just a simple container for any arbitrary UI content. -
- Basic Flyout -
+Basic Flyout `MenuFlyout`, as the name implies, creates a Menu. -
- Basic MenuFlyout -
+Basic MenuFlyout ## Reference diff --git a/versioned_docs/version-0.10.x/controls/grid.md b/versioned_docs/version-0.10.x/controls/grid.md index e72416ae6..7aa23e6ec 100644 --- a/versioned_docs/version-0.10.x/controls/grid.md +++ b/versioned_docs/version-0.10.x/controls/grid.md @@ -3,6 +3,12 @@ id: grid title: Grid --- +import GridSampleScreenshot from '/img/controls/grid/grid_example.png'; +import GridAsteriskScreenshot from '/img/controls/grid/grid_asterisk_example.png'; +import GridAsteriskButtonsScreenshot from '/img/controls/grid/grid_asterisk_example_buttons.png'; +import GridAutoButtonsScreenshot from '/img/controls/grid/grid_auto_example_buttons.png'; +import GridVerboseSampleScreenshot from '/img/controls/grid/grid_example_verbose.png'; + The `Grid` control is a `Panel` control useful for organizing other controls in columns and rows. `ColumnDefinition` and `RowDefinition` properties are used to define absolute, relative, or proportional row and column geometries for the grid. Each control in the grid will be placed using the `Grid.Column` and `Grid.Row` additional properties. It is also possible to have controls that span multiple rows and/or columns by using the `ColumnSpan` and `RowSpan` properties. ## Reference @@ -42,9 +48,7 @@ In the above example we have two keywords: __*__ and **Auto**. Here is explanati The multiplier used in front of the proportional spacing value is used to figure out the relative size for the proportional columns. All proportional columns fit in the space left behind after all explicit values and "Auto" values are calculated. So for the above example the Column 1 will get 1.5 parts plus Column 2 will get 4 parts of the remainder of the space that Column 0 left. Lastly, the Button itself will fill in from the initial Cell 1,1 over one column and down one row because `Grid.RowSpan` and `Grid.ColumnSpan` are set to occupy two units instead of one. -
- Grid Using Properties and Spanning Columns -
+Grid Using Properties and Spanning Columns Here is another example showing the difference between those two. @@ -65,16 +69,11 @@ First let's create sample 2x2 grid in our View, we can achieve this simply by wr As you can see we created equal grid, I left `ShowGridLines` parameter set to `True` for better visibility. - -
- Grid Using Asterisk Symbols -
+Grid Using Asterisk Symbols Now let's fill our grid with some elements, I will fill every field with button, you can use anything you want. -
- Grid Using Asterisk Symbols Filled With Buttons -
+Grid Using Asterisk Symbols Filled With Buttons Now our View code look's like this: @@ -98,13 +97,11 @@ Now our View code look's like this: In this moment our **asterisk** symbols are forcing our grid to become equal, now let's see what will happen when we replace **asterisk** with the **Auto** keyword -
- Grid Using Auto Keyword -
+Grid Using Auto Keyword As you can see our grid become sticky to its content, it is very useful when we have components with variable `Height` property. -This new View code look's like this: +This new View code looks like this: ```markup @@ -148,9 +145,7 @@ For more complex row and column definitions it's possible to explicitly use `Gri ``` -
- Using Verbose Row/Column Definitions -
+Using Verbose Row/Column Definitions ### Common Properties diff --git a/versioned_docs/version-0.10.x/controls/gridsplitter.md b/versioned_docs/version-0.10.x/controls/gridsplitter.md index f8aabb17b..58a39eeb8 100644 --- a/versioned_docs/version-0.10.x/controls/gridsplitter.md +++ b/versioned_docs/version-0.10.x/controls/gridsplitter.md @@ -3,6 +3,9 @@ id: gridsplitter title: GridSplitter --- +import GridSplitterColumnsScreenshot from '/img/controls/gridsplitter/gridsplitter-in-action-columns.gif'; +import GridSplitterRowsScreenshot from '/img/controls/gridsplitter/gridsplitter-in-action-rows.gif'; + The `GridSplitter` control is a control that allows a user to resize the space between `Grid` rows or columns. ```markup @@ -13,9 +16,7 @@ The `GridSplitter` control is a control that allows a user to resize the space b ``` -
- GridSplitter in Action for Columns -
+GridSplitter in Action for Columns ```markup @@ -25,9 +26,7 @@ The `GridSplitter` control is a control that allows a user to resize the space b ``` -
- GridSplitter in Action for Rows -
+GridSplitter in Action for Rows ### Reference diff --git a/versioned_docs/version-0.10.x/controls/itemsrepeater.md b/versioned_docs/version-0.10.x/controls/itemsrepeater.md index 7ce7aaff0..de9523caf 100644 --- a/versioned_docs/version-0.10.x/controls/itemsrepeater.md +++ b/versioned_docs/version-0.10.x/controls/itemsrepeater.md @@ -3,6 +3,9 @@ id: itemsrepeater title: ItemsRepeater --- +import ItemsRepeaterVerticalScreenshot from '/img/controls/itemsrepeater/itemsrepeatervertical.png'; +import ItemsRepeaterHorizontalScreenshot from '/img/controls/itemsrepeater/itemsrepeaterhorizontal.png'; + A data-driven collection control that incorporates a flexible layout system, custom views, and virtualization. `ItemsRepeater` is a port of the UWP `ItemsRepeater` control. More documentation can be found at: @@ -50,11 +53,10 @@ By default an `ItemsRepeater`, without defining a `Layout` will render them Stac ``` And they will look like so -
- Decription -
+ If you want them to be rendered Horizontally, you need to specify a `Layout` property and the xaml should look a bit like so: + ```xml @@ -73,14 +75,12 @@ If you want them to be rendered Horizontally, you need to specify a `Layout` pro ``` -this will look like this: -
- Decription -
-In the `Layout` property you can also specify `Spacing` between the items, but you cannot define `Classes` nor other complex styles, those needs to be defined on the `ItemsRepeater` if needed. +this will look like this: + +In the `Layout` property you can also specify `Spacing` between the items, but you cannot define `Classes` nor other complex styles, those needs to be defined on the `ItemsRepeater` if needed. ## Reference diff --git a/versioned_docs/version-0.10.x/controls/maskedtextbox.md b/versioned_docs/version-0.10.x/controls/maskedtextbox.md index 1ce9874f2..c9d536a22 100644 --- a/versioned_docs/version-0.10.x/controls/maskedtextbox.md +++ b/versioned_docs/version-0.10.x/controls/maskedtextbox.md @@ -3,6 +3,9 @@ id: maskedtextbox title: MaskedTextBox --- +import MaskedTextBoxEmptyScreenshot from '/img/controls/maskedtextbox/maskedtextboxexample1.png'; +import MaskedTextBoxTextEntryScreenshot from '/img/controls/maskedtextbox/maskedtextexample.gif'; + The `MaskedTextBox` control is an editable text field where a user can input text. ## Source code @@ -27,15 +30,11 @@ The `MaskedTextBox` control is an editable text field where a user can input tex produces the following output in **Ubuntu** -
- -
+ and it behaves like so when filled in by user input -
- -
+ ### Supported Masks diff --git a/versioned_docs/version-0.10.x/controls/numericupdown.md b/versioned_docs/version-0.10.x/controls/numericupdown.md index 3538e14ca..8dbe0c8e0 100644 --- a/versioned_docs/version-0.10.x/controls/numericupdown.md +++ b/versioned_docs/version-0.10.x/controls/numericupdown.md @@ -3,6 +3,8 @@ id: numericupdown title: NumericUpDown --- +import NumericUpDownBasicScreenshot from '/img/controls/numericupdown/numericupdown_basic.png'; + The `NumericUpDown` is an editable numeric input field. The control has a up and down button spinner attached, used to increment and decrement the value in the input field. The value can also be incremented or decremented using the arrow keys or the mouse wheel when the control is selected. @@ -25,11 +27,9 @@ The value stored in the `NumericUpDown` is a double. ``` -produces the following output on **Linux**\ +produces the following output on **Linux** -
- Basic NumericUpDown -
+Basic NumericUpDown ### NumericUpDown with a changed increment and bounds diff --git a/versioned_docs/version-0.10.x/controls/panel.md b/versioned_docs/version-0.10.x/controls/panel.md index 703ebe742..72c4309f4 100644 --- a/versioned_docs/version-0.10.x/controls/panel.md +++ b/versioned_docs/version-0.10.x/controls/panel.md @@ -3,6 +3,8 @@ id: panel title: Panel --- +import PanelRectangleLayoutScreenshot from '/img/controls/panel/image (7).png'; + The `Panel` is the base class for controls that can contain multiple children like `DockPanel` or `StackPanel`. The `Panel` class can be useful on its own for very basic layouts, or simply to allow multiple controls to be to be contained. @@ -16,9 +18,7 @@ The `Panel` class can be useful on its own for very basic layouts, or simply to ``` -
- Decription -
+ There are other more useful panels that derive from `Panel`, these include: diff --git a/versioned_docs/version-0.10.x/controls/progressbar.md b/versioned_docs/version-0.10.x/controls/progressbar.md index e8a8e1e08..426dac3d8 100644 --- a/versioned_docs/version-0.10.x/controls/progressbar.md +++ b/versioned_docs/version-0.10.x/controls/progressbar.md @@ -3,15 +3,15 @@ id: progressbar title: ProgressBar --- +import ProgressBarScreenshot from '/img/controls/progressbar/progressbar (1).png'; + The `ProgressBar` control allow for showing dynamic progress status. ### Customizing the progress text When [`ShowProgressText`](http://reference.avaloniaui.net/api/Avalonia.Controls/ProgressBar/590A8B3E) is `true`, text on the progress bar will be displayed. -
- Basic Progress Bar -
+Basic Progress Bar By default this text shows the percentage completion, according to the [`Value`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/E111DF5B), [`Minimum`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/8F9BD1EA) and [`Maximum`](http://reference.avaloniaui.net/api/Avalonia.Controls.Primitives/RangeBase/C07B22E9). The format of this text can be customised by using the `ProgressTextFormat` property. This expects a string which will be passed to a [`string.Format`](https://docs.microsoft.com/en-us/dotnet/api/system.string.format#system-string-format(system-string-system-object())) call with the value of `ProgressTextFormat` as the format string. The following format items are available at the given indices: diff --git a/versioned_docs/version-0.10.x/controls/relativepanel.md b/versioned_docs/version-0.10.x/controls/relativepanel.md index eafae4f45..1df65a7c9 100644 --- a/versioned_docs/version-0.10.x/controls/relativepanel.md +++ b/versioned_docs/version-0.10.x/controls/relativepanel.md @@ -3,6 +3,8 @@ id: relativepanel title: RelativePanel --- +import RelativePanelScreenshot from '/img/controls/relativepanel/layout-panel-relative-panel.png'; + The `RelativePanel` control is a `Panel` which lets you layout elements by specifying where they go in relation to other elements and in relation to the panel. By default, an element is positioned in the upper left corner of the panel. @@ -42,9 +44,7 @@ This XAML shows how to arrange elements in a RelativePanel. The result looks like this. -
- Relative panel -
+Relative panel Here are a few things to note about the sizing of the rectangles: diff --git a/versioned_docs/version-0.10.x/controls/splitview.md b/versioned_docs/version-0.10.x/controls/splitview.md index 62bad1996..4a3d46841 100644 --- a/versioned_docs/version-0.10.x/controls/splitview.md +++ b/versioned_docs/version-0.10.x/controls/splitview.md @@ -3,6 +3,8 @@ id: splitview title: SplitView --- +import SplitViewScreenshot from '/img/controls/splitview/image (9).png'; + Represents a container with two views; one view for the main content and another view that is typically used for navigation commands. ```markup @@ -25,9 +27,7 @@ Represents a container with two views; one view for the main content and another ``` -
- -
+ A split view's content area is always visible. The pane can expand and collapse or remain in an open state, and can present itself from either the left side or right side of an app window. The pane has four modes: diff --git a/versioned_docs/version-0.10.x/controls/stackpanel.md b/versioned_docs/version-0.10.x/controls/stackpanel.md index 2ffb1185d..ab9bab10b 100644 --- a/versioned_docs/version-0.10.x/controls/stackpanel.md +++ b/versioned_docs/version-0.10.x/controls/stackpanel.md @@ -3,6 +3,9 @@ id: stackpanel title: StackPanel --- +import StackPanelRectangleScreenshot from '/img/controls/stackpanel/layout-panel-stack-panel.png'; +import StackPanelRectangleSpacingScreenshot from '/img/controls/stackpanel/image (12).png'; + The `StackPanel` control is a `Panel` which lays out its children by stacking them horizontally or vertically. StackPanel is typically used to arrange a small subsection of the UI on a page. You can use the [**Orientation**](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.stackpanel.orientation) property to specify the direction of the child elements. The default orientation is [**Vertical**](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Orientation). @@ -20,9 +23,7 @@ The following XAML shows how to create a vertical StackPanel of items. The result looks like this. -
- -
+ In a StackPanel, if a child element's size is not set explicitly, it stretches to fill the available width \(or height if the Orientation is **Horizontal**\). In this example, the width of the rectangles is not set. The rectangles expand to fill the entire width of the StackPanel. @@ -37,10 +38,7 @@ StackPanel has a `Spacing` property to allow an even spacing between items. ``` -
- -
- + ### Reference diff --git a/versioned_docs/version-0.10.x/controls/tabcontrol.md b/versioned_docs/version-0.10.x/controls/tabcontrol.md index 48263c57b..26b004a22 100644 --- a/versioned_docs/version-0.10.x/controls/tabcontrol.md +++ b/versioned_docs/version-0.10.x/controls/tabcontrol.md @@ -3,13 +3,14 @@ id: tabcontrol title: TabControl --- +import TabControlRibbonScreenshot from '/img/controls/tabcontrol/tabcontrol.gif'; +import TabControlStyledRibbonScreenshot from '/img/controls/tabcontrol/customizedtabcontrol.gif'; + The `TabControl` allows us to switch between different pages by means of tabs like the tabs in web navigators or the ribbon menu \(which uses tabs\) in Word Office for instance. Here is an animation of what you can achieve : -
- Decription -
+ To create this, we'll describe the entire control \(TabControl\) and each individual tab+page \(TabItem\). Here is an example : @@ -43,9 +44,7 @@ To create this, we'll describe the entire control \(TabControl\) and each indivi Let's have a look at a customized `TabControl` : -
- Decription -
+ The grey part is the `TabItem`... Yes, the `TabItem` includes the tab **AND** the page associated to the tab. The tab is called the `header`of the `TabItem`. Moreover, given the way `TabControl` has been implemented, tabs are in a `WrapPanel`. Thus, if you want to color in blue \(like this is done above\) the empty bar of the tabbed bar, you must change the background color of the `WrapPanel` of the `TabControl`. Here is the code used to obtain the result above \(_Note the workaround used to color some tabs : this is due to the way the control is implemented. It might change in the future._\) diff --git a/versioned_docs/version-0.10.x/controls/textbox.md b/versioned_docs/version-0.10.x/controls/textbox.md index 0998dd5ee..b465bf104 100644 --- a/versioned_docs/version-0.10.x/controls/textbox.md +++ b/versioned_docs/version-0.10.x/controls/textbox.md @@ -3,6 +3,11 @@ id: textbox title: TextBox --- +import TextBoxSingleLineScreenshot from '/img/controls/textbox/textbox_basic.png'; +import TextBoxPasswordScreenshot from '/img/controls/textbox/textbox_password.png'; +import TextBoxWatermarkScreenshot from '/img/controls/textbox/textbox_watermark.png'; +import TextBoxMultilineScreenshot from '/img/controls/textbox/textbox_multiline.png'; + The `TextBox` control is an editable text field where a user can input text. ## Reference @@ -33,10 +38,7 @@ The `TextBox` control is an editable text field where a user can input text. produces the following output in **Windows 10** -
- -
- + ### Password input TextBox @@ -56,9 +58,7 @@ produces the following output in **Windows 10** produces the following output in **Windows 10** when text is input -
- -
+ When using the Fluent theme, you can apply the style class, `revealPasswordButton`, and the TextBox will provide an eye 👁 glyph for the user to show the plane text temporally. Please note, the `TextBox` may be written to but not copied from. @@ -86,10 +86,7 @@ Avalonia can show a "watermark" in a `TextBox`, which is a piece of text that is produces the following output in **Windows 10** -
- -
- + ### Multiline TextBox @@ -109,9 +106,7 @@ produces the following output in **Windows 10** produces the following output in **Windows 10** when text is input -
- -
+ ### TextInput Event Handling diff --git a/versioned_docs/version-0.10.x/controls/timepicker.md b/versioned_docs/version-0.10.x/controls/timepicker.md index 0b7d24fbe..2ef09e149 100644 --- a/versioned_docs/version-0.10.x/controls/timepicker.md +++ b/versioned_docs/version-0.10.x/controls/timepicker.md @@ -6,6 +6,11 @@ title: TimePicker import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import TimePickerSingleValueScreenshot from '/img/controls/timepicker/image (22) (1).png'; +import TimePickerClockIdentifierScreenshot from '/img/controls/timepicker/image (19).png'; +import TimePickerMinuteIncrementScreenshot from '/img/controls/timepicker/image (10).png'; +import TimePickerUnsetScreenshot from '/img/controls/timepicker/image (20).png'; + The `TimePicker` control allows the user to pick a time value. ## Examples @@ -39,9 +44,7 @@ TimePicker arrivalTimePicker = new TimePicker(); Use a `TimePicker` to let a user enter a single time value. You can customize the `DatePicker` to use a 12-hour or 24-hour clock. -
- -
+ ## 12-hour and 24-hour clocks @@ -52,10 +55,7 @@ By default, the time picker shows a 12-hour clock with an AM/PM selector. You ca ``` -
- -
- + ### Minute increment @@ -65,9 +65,7 @@ You can set the [MinuteIncrement](https://docs.microsoft.com/en-us/uwp/api/windo ``` -
- -
+ ### Time values @@ -75,9 +73,7 @@ The time picker control has both Time / TimeChanged and SelectedTime / SelectedT The value of `SelectedTime` is used to populate the time picker and is `null` by default. If `SelectedTime` is `null`, the `Time` property is set to a [TimeSpan](https://docs.microsoft.com/en-us/dotnet/api/system.timespan?view=dotnet-uwp-10.0\&preserve-view=true) of 0; otherwise, the `Time` value is synchronized with the `SelectedTime` value. When `SelectedTime` is `null`, the picker is 'unset' and shows the field names instead of a time. -
- -
+ **Initializing a time value** diff --git a/versioned_docs/version-0.10.x/controls/transitioningcontentcontrol.md b/versioned_docs/version-0.10.x/controls/transitioningcontentcontrol.md index 4793bca3f..eb531776b 100644 --- a/versioned_docs/version-0.10.x/controls/transitioningcontentcontrol.md +++ b/versioned_docs/version-0.10.x/controls/transitioningcontentcontrol.md @@ -3,6 +3,9 @@ id: transitioningcontentcontrol title: TransitioningContentControl --- +import TransitioningContentControlFadeScreenshot from '/img/controls/transitioningcontentcontrol/TransitioningContentControl_01.webp'; +import TransitioningContentControlSlideScreenshot from '/img/controls/transitioningcontentcontrol/TransitioningContentControl_02.webp'; + ## Common Properties | Property | Description | @@ -33,10 +36,7 @@ Let's assume we have a collection of different images and we want to show them i ``` -
- -
- + ## Changing the PageTransition @@ -57,9 +57,7 @@ In the sample below we will change the [PageTransition](../animations/page-trans ``` -
- -
+ ## Disable the PageTransition diff --git a/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md b/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md index 2593e7f52..b7c11e015 100644 --- a/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md +++ b/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-flat-treedatagrid.md.md @@ -3,6 +3,8 @@ id: creating-a-flat-treedatagrid title: Creating a Flat TreeDataGrid --- +import FlatTreeDataGridSourceScreenshot from '/img/controls/treedatagrid/get-started-flat-1.png'; + There are two parts to any `TreeDataGrid`: * The "Source" which is defined in code and describes how your data model will map to the rows and columns of the `TreeDataGrid` @@ -98,6 +100,4 @@ It's now time to add the `TreeDataGrid` control to a window and bind it to the s Run the application and you should see the data appear: -
- -
+ diff --git a/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md b/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md index 3ea30ddb1..6a9a280a1 100644 --- a/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md +++ b/versioned_docs/version-0.10.x/controls/treedatagrid/creating-a-hierarchical-treedatagrid.md @@ -3,6 +3,8 @@ id: creating-a-hierarchical-treedatagrid title: Creating a Hierarchical TreeDataGrid --- +import HierarchicalTreeDataGridSourceScreenshot from '/img/controls/treedatagrid/get-started-hierarchical-1.png'; + There are two parts to any `TreeDataGrid`: * The "Source" which is defined in code and describes how your data model will map to the rows and columns of the `TreeDataGrid` @@ -129,6 +131,4 @@ It's now time to add the `TreeDataGrid` control to a window and bind it to the s Run the application and you should see the data appear: -
- -
\ No newline at end of file + \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md b/versioned_docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md index d46695d49..07cb852b5 100644 --- a/versioned_docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md +++ b/versioned_docs/version-0.10.x/controls/treedatagrid/treedatagrid-column-types.md @@ -19,14 +19,11 @@ new TextColumn("First Name", x => x.FirstName) The first generic parameter here is your model type basically, the place where you want to grab data from. Person in this case. The second generic parameter here is the type of the property where you want to grab data from. In this case, it is a string, it will be used to know exactly which type your property has. - -
- -
+![](https://user-images.githubusercontent.com/53405089/157456551-dd394781-903a-4c7b-8874-e631e21534a1.png) This is the signature of the `TextColumn` constructor. There are two most important parameters. The first one will be used to define the column header, usually, it would be a string. In the sample above it is _"First Name"_. The second parameter is an expression to get the value of the property. In the sample above it is _x => x.FirstName_. -**Note**:\ +**Note**: The sample above is taken from [this article](https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/blob/master/docs/get-started-flat.md). If you feel like you need more examples feel free to check it, there is a sample that shows how to use TextColumns and how to run a whole `TreeDataGrid` using them. ### HierarchicalExpanderColumn @@ -41,15 +38,13 @@ new HierarchicalExpanderColumn(new TextColumn("First Nam `HierarchicalExpanderColumn` has only one generic parameter, it is your model type, same as in `TextColumn`, Person in this case. -Let's take a look at the `HierarchicalExpanderColumn` constructor. +Let's take a look at the `HierarchicalExpanderColumn` constructor. -
- -
+![](https://user-images.githubusercontent.com/53405089/157536079-fd14f1ed-0a7d-438a-abba-fd56766709a9.png) The first parameter in the constructor is a nested column, you would usually want to display something besides the expander and that's why you need this parameter. In the sample above, we want to display text and we use `TextColumn` for that. The second parameter is a selector of the child elements, stuff that will be displayed when `Expander` is in the expanded state below the parent element. -**Note**:\ +**Note**: The sample above is taken from [this article](https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/blob/master/docs/get-started-hierarchical.md). If you feel like you need more examples feel free to check it, there is a sample that shows how to use `HierarchicalExpanderColumn` and how to run a whole `TreeDataGrid` using it. ### TemplateColumn @@ -66,8 +61,6 @@ new TemplateColumn( `TemplateColumn` has only one generic parameter, it is your model type, same as in `TextColumn`, Person in this case. Code above will create a column with header _"Selected"_ and `CheckBox` in each cell. -
- -
+![](https://user-images.githubusercontent.com/53405089/157664231-8653bce9-f8d6-4fbc-8e78-e3ff93f1ace2.png) `TemplateColumn` has only two required parameters. The first one is the column header as everywhere. The second is `IDataTemplate` basically, a template that contains stuff that you want to be displayed in the cells of this column. \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/controls/viewbox.md b/versioned_docs/version-0.10.x/controls/viewbox.md index 29872697a..0137b6922 100644 --- a/versioned_docs/version-0.10.x/controls/viewbox.md +++ b/versioned_docs/version-0.10.x/controls/viewbox.md @@ -1,11 +1,19 @@ --- id: viewbox -title: ViewBox +title: Viewbox --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import ViewboxScaleUniformBothScreenshot from '/img/controls/viewbox/scale-uniform-both.gif'; +import ViewboxScaleUniformFillBothScreenshot from '/img/controls/viewbox/scale-uniformtofill-both.gif'; +import ViewboxScaleFillBothScreenshot from '/img/controls/viewbox/scale-fill-both.gif'; +import ViewboxScaleNoneBothScreenshot from '/img/controls/viewbox/scale-none-both.gif'; + +import ViewboxScaleUniformUpOnlyScreenshot from '/img/controls/viewbox/scale-uniform-uponly.gif'; +import ViewboxScaleUniformDownOnlyScreenshot from '/img/controls/viewbox/scale-uniform-downonly.gif'; + The `Viewbox` is a decorator control which scales its child. It can be used to scale its child to fit the available space. The `Viewbox` gives its child infinite space in the measure phase. It will constrain either or both sides when arranging it. This depends on the value of the `Stretch`. @@ -85,7 +93,7 @@ new Viewbox

- +

@@ -95,7 +103,7 @@ new Viewbox

- +

@@ -105,7 +113,7 @@ new Viewbox

- +

@@ -115,7 +123,7 @@ new Viewbox

- +

@@ -135,7 +143,7 @@ new Viewbox Both - + @@ -144,7 +152,7 @@ new Viewbox

- +

@@ -154,7 +162,7 @@ new Viewbox

- +

diff --git a/versioned_docs/version-0.10.x/data-binding/data-validation.md b/versioned_docs/version-0.10.x/data-binding/data-validation.md index 550a80a7f..a5e0009a4 100644 --- a/versioned_docs/version-0.10.x/data-binding/data-validation.md +++ b/versioned_docs/version-0.10.x/data-binding/data-validation.md @@ -3,6 +3,8 @@ id: data-validation title: Data Validation --- +import CustomValidationTooltipScreenshot from '/img/data-binding/data-validation/CustomValidationTooltip.png'; + Avalonia offers different data validation options. In this section we will show you how you can validate the `Properties` of your `ViewModel` and how you can style the displayed error message. ## Validating a property @@ -122,10 +124,7 @@ To display the validation messages, Avalonia has a control called [`DataValidati ``` -
- custom validation style -
- +custom validation style **Custom validation style** diff --git a/versioned_docs/version-0.10.x/getting-started/developer-tools.md b/versioned_docs/version-0.10.x/getting-started/developer-tools.md index 9ddfb1332..0729c042f 100644 --- a/versioned_docs/version-0.10.x/getting-started/developer-tools.md +++ b/versioned_docs/version-0.10.x/getting-started/developer-tools.md @@ -3,6 +3,16 @@ id: developer-tools title: Developer Tools --- +import DevToolsOverviewScreenshot from '/img/getting-started/developer-tools/image (23).png'; +import DevToolsPropertiesScreenshot from '/img/getting-started/developer-tools/image (26).png'; +import DevToolsLayoutScreenshot from '/img/getting-started/developer-tools/image (24) (1) (1).png'; +import DevToolsStylesScreenshot from '/img/getting-started/developer-tools/image (27).png'; +import DevToolsOverriddenStylesScreenshot from '/img/getting-started/developer-tools/image (28).png'; +import DevToolsSetterContextMenuScreenshot from '/img/getting-started/developer-tools/image (25).png'; +import DevToolsEventsScreenshot from '/img/getting-started/developer-tools/image (29).png'; +import DevToolsChangePropertyScreenshot from '/img/getting-started/developer-tools/devtools-change-property.gif'; +import DevToolsChangeLayoutScreenshot from '/img/getting-started/developer-tools/devtools-change-layout.gif'; + # Developer Tools Avalonia has an inbuilt DevTools window which is enabled by calling the attached `AttachDevTools()` method in a `Window` constructor. The default templates have this enabled when the program is compiled in `DEBUG` mode: @@ -45,9 +55,7 @@ dotnet add package Avalonia.Diagnostics --version 0.10.0 ::: -
- -
+ There is a known issue when running under .NET core 2.1 that pressing F12 will cause the program to quit. In this case, either switch to .NET core 2.0 or 3.0+ or change the open gesture to something different, such as `Ctrl+F12`. @@ -66,9 +74,7 @@ Allows for quickly checking and editing properties of the control. One can also | Type | Type of the current value | | Priority | Priority of the value | -
- -
+ ### Layout @@ -79,9 +85,7 @@ Control size and size constraints are also shown. If `Width` or `Height` are underlined that means there is an active constraint. Hover over the value to see a tooltip containing relevant information. ::: -
- -
+ ### Styles @@ -96,24 +100,18 @@ If setter value is bound to a resource it will be indicated by a circle followed ::: -
- -
+ :::info If given value has a strikethrough it means that it is being overridden by a value in style with higher priority. ::: -
- -
+ Setters have a context menu that allows for quickly copying names and values to the clipboard. -
- -
+ ## Events @@ -126,9 +124,7 @@ Dotted underline under event name or control type indicates that quick navigatio * Double clicking a control type (and/or name) will navigate to the visual tree tab and select said control. ::: -
- -
+ ## Console @@ -151,12 +147,8 @@ The console can be shown using the "View" → "Console" menu. The console implem ### Changing a property value -
- -
+ ### Changing layout properties -
- -
\ No newline at end of file + \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/getting-started/ide-support.md b/versioned_docs/version-0.10.x/getting-started/ide-support.md index 8a343bf83..90c9f16ca 100644 --- a/versioned_docs/version-0.10.x/getting-started/ide-support.md +++ b/versioned_docs/version-0.10.x/getting-started/ide-support.md @@ -2,6 +2,10 @@ id: ide-support title: IDE Support --- + +import VsXamlPreviewerScreenshot from '/img/getting-started/vs-designer.png'; +import VsSelectProjectPreviewScreenshot from '/img/getting-started/VisualStudioPreviewer_SelectProjectForPreview.png'; + ## JetBrains Rider The [JetBrains Rider](https://www.jetbrains.com/rider/) IDE has built-in support for Avalonia XAML [starting in 2020.3](https://www.jetbrains.com/rider/whatsnew/2020-3/#version-2020-3-avalonia-support) including first-class support for Avalonia-specific XAML features and custom code inspections. @@ -24,9 +28,7 @@ If you're using VS2019 or VS2017 you need to install [the extension for older ve For Visual Studio and ReSharper users, [ReSharper 2020.3 introduces](https://www.jetbrains.com/resharper/whatsnew/2020-3/#version-2020-3-avalonia-support) built-in code analysis, code completion, navigation, and find usages. -
- Shows the XAML Previewer in Visual Studio -
+Shows the XAML Previewer in Visual Studio If your XAML is in a library, Avalonia needs an executable application in order to be able to preview it. Select an executable project from the dropdown on the top right of the designer. Once your project is built, editing the XAML in the editor will cause the preview to update automatically. @@ -127,7 +129,4 @@ If your preview is not shown correctly try to (re-)build the project or solution Moreover if you have more than one project in your solution, you may need to select the project which should be used to render the preview. This can be done with the drop-down shown below. - -
- Shows how to select the project used to render the preview -
\ No newline at end of file +Shows how to select the project used to render the preview diff --git a/versioned_docs/version-0.10.x/getting-started/jetbrains-rider-setup.md b/versioned_docs/version-0.10.x/getting-started/jetbrains-rider-setup.md index f462da4b8..7e4e00f0a 100644 --- a/versioned_docs/version-0.10.x/getting-started/jetbrains-rider-setup.md +++ b/versioned_docs/version-0.10.x/getting-started/jetbrains-rider-setup.md @@ -3,6 +3,10 @@ id: jetbrains-rider-setup title: JetBrains Rider Setup --- + import RiderWelcomePluginsScreenshot from '/img/getting-started/jetbrains-rider-setup/jetbrains-rider-setup-1-rider-welcome.webp'; + import RiderConfigurePluginsScreenshot from '/img/getting-started/jetbrains-rider-setup/rider-setup-2-configure-plugin-repos.webp'; + import RiderPluginInstallScreenshot from '/img/getting-started/jetbrains-rider-setup/jetbrains-rider-setup-4-plugin-install.webp'; + # JetBrains Rider Setup 1. Download and install the .NET SDK of your choice [Download .NET \(Linux, macOS, and Windows\) \(microsoft.com\)](https://dotnet.microsoft.com/download) @@ -45,21 +49,14 @@ title: JetBrains Rider Setup Once Rider loads you will see the Welcome Screen. Click the `Configure` dropdown and select `Plugins`. -
- Button group -
+Button group A new Preferences Screen will open up. Click the `Settings` icon as shown and select `Manage Plugin Repositories...` - -
- Button group -
+Button group Now click on the `Marketplace` tab and search for `Avalonia`. Select `AvaloniaRider` and click `Install`; accept the warning about Third-Party Plugins; once that's done, click the `Restart IDE` button that appears. -
- Button group -
+Button group Now Rider should be ready to develop Avalonia applications. diff --git a/versioned_docs/version-0.10.x/guides/basics/code-behind.md b/versioned_docs/version-0.10.x/guides/basics/code-behind.md index 33bfb872a..1b0b68df3 100644 --- a/versioned_docs/version-0.10.x/guides/basics/code-behind.md +++ b/versioned_docs/version-0.10.x/guides/basics/code-behind.md @@ -3,11 +3,11 @@ id: code-behind title: Code Behind --- +import VsCodeBehindScreenshot from '/img/guides/basics/code-behind/codebehind-vs.png'; + [Window](../../controls/window) and [UserControl](../../controls/usercontrol) files also have an associated _code-behind_ file which usually has the extension `.xaml.cs` or `.axaml.cs` and may be displayed collapsed under the XAML file in your editor. Below you can see a `MainWindow.xaml` file along with its markdown file `MainWindow.xaml.cs` in Visual Studio: -
- Code-behind in Visual Studio -
+Code-behind in Visual Studio The code-behind file by default defines a .NET class with the same name as your XAML file, e.g. diff --git a/versioned_docs/version-0.10.x/guides/basics/mvvm.md b/versioned_docs/version-0.10.x/guides/basics/mvvm.md index db1622680..c0591ddc7 100644 --- a/versioned_docs/version-0.10.x/guides/basics/mvvm.md +++ b/versioned_docs/version-0.10.x/guides/basics/mvvm.md @@ -3,6 +3,8 @@ id: mvvm title: MVVM Architecture --- +import MvvmArchitectureDiagram from '/img/guides/basics/mvvm/mvvm.png'; + The Model-View-ViewModel pattern (MVVM) is a common way of structuring a UI application. It takes advantage of Avalonia's [binding](../../data-binding) system to separate the logic of the application from the display of the application. MVVM might be overkill for a simple application, but as applications grow over time, they usually reach a point where tracking logic in [code-behind](code-behind) becomes problematic for two main reasons: @@ -28,9 +30,7 @@ When we talk about the MVVM pattern, the most important parts are the **View** l One way to imagine an MVVM application is to imagine these two layers as hovering over one another, connected by bindings: -
- Diagram of MVVM -
+ The above example has, at the View layer: diff --git a/versioned_docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md b/versioned_docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md index f8d4054fc..8dfc52447 100644 --- a/versioned_docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md +++ b/versioned_docs/version-0.10.x/guides/deep-dives/reactiveui/routing.md @@ -3,6 +3,8 @@ id: routing title: Routing --- +import ReactiveUIRoutingScreenshot from '/img/guides/deep-dives/reactiveui/routing/routing.gif'; + [ReactiveUI routing](https://reactiveui.net/docs/handbook/routing/) consists of an [IScreen](https://reactiveui.net/api/reactiveui/iscreen/) that contains current [RoutingState](https://reactiveui.net/api/reactiveui/routingstate/), several [IRoutableViewModel](https://reactiveui.net/api/reactiveui/iroutableviewmodel/)s, and a platform-specific XAML control called [RoutedViewHost](https://github.com/AvaloniaUI/Avalonia/blob/55458cf7af24d6c987268ab5ff8a1ead1173310b/src/Avalonia.ReactiveUI/RoutedViewHost.cs). `RoutingState` manages the view model navigation stack and allows view models to navigate to other view models. `IScreen` is the root of a navigation stack; despite the name, its views don't have to occupy the whole screen. `RoutedViewHost` monitors an instance of `RoutingState`, responding to any changes in the navigation stack by creating and embedding the appropriate view. ## Routing Example @@ -248,6 +250,4 @@ Now, you can run the app and see routing in action! dotnet run --framework netcoreapp2.1 ``` -
- -
+ diff --git a/versioned_docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md b/versioned_docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md index a0bad17f3..152dc82b4 100644 --- a/versioned_docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md +++ b/versioned_docs/version-0.10.x/guides/deep-dives/running-on-raspbian-lite-via-drm.md @@ -3,6 +3,10 @@ id: running-on-raspbian-lite-via-drm title: Running your Avalonia app on a Raspberry Pi with Raspbian Lite --- +import RaspbianLiteDrmKmsCubeScreenshot from '/img/guides/deep-dives/running-on-raspbian-lite-via-drm/avalonia-raspbian-lite-drm-kmscube.gif'; +import RaspbianLiteDrmDesktopScreenshot from '/img/guides/deep-dives/running-on-raspbian-lite-via-drm/avalonia-raspbian-lite-drm-desktop.jpg'; +import RaspianLiteRaspberryScreenshot from '/img/guides/deep-dives/running-on-raspbian-lite-via-drm/avalonia-raspbian-lite-drm-run-on-raspberry.jpg'; + # Running your Avalonia app on a Raspberry Pi with Raspbian Lite This tutorial shows you how to run your Avalonia app on a Raspberry Pi with Raspbian Lite @@ -69,9 +73,7 @@ sudo kmscube ```` You should see the spinning cube on your Raspberry pi screen now: -
- -
+ ### Step 2 - Prepare Avalonia App @@ -193,9 +195,7 @@ public override void OnFrameworkInitializationCompleted() Now you can run/debug your app on desktop as usual. When you start your app you should see this: -
- -
+ ### Step 3 - Deploy and run on Raspberry @@ -221,8 +221,6 @@ sudo ./path/to/app/AvaloniaRaspbianLiteDrm --drm You should see the app running on your Raspberry Pi now: -
- -
+ If you have a touch display installed, try to slide the slider control :) \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/guides/developer-guides/debugging-previewer.md b/versioned_docs/version-0.10.x/guides/developer-guides/debugging-previewer.md index 36a313b67..9d78c14fa 100644 --- a/versioned_docs/version-0.10.x/guides/developer-guides/debugging-previewer.md +++ b/versioned_docs/version-0.10.x/guides/developer-guides/debugging-previewer.md @@ -3,6 +3,8 @@ id: debugging-previewer title: Debugging Previewer --- +import VsAttachDebuggerScreenshot from '/img/guides/developer-guides/debugging-previewer/132686320-958f30a6-49f8-498f-853c-b9dd17262b54.png'; + By default, even if you would put a breakpoint in Avalonia main repo directly it would not be hit when Previewer executes this code. This is because Previewer is a completely different process usually run by IDE. **Debugging with JetBrains Rider** @@ -39,12 +41,10 @@ while (!Debugger.IsAttached) This code will attach debugger to the previewer programmatically. -But if you need to place breakpoints in the previewer code you may need to use [dnSpy](https://github.com/dnSpy/dnSpy) or something similar because Visual Studio doesen't support that. +But if you need to place breakpoints in the previewer code you may need to use [dnSpy](https://github.com/dnSpy/dnSpy) or something similar because Visual Studio doesn't support that. **How would I understand that I have launched a debugger?** You should see a window like this. -
- -
+ diff --git a/versioned_docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md b/versioned_docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md index 43e3a3fec..9f3ac7280 100644 --- a/versioned_docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md +++ b/versioned_docs/version-0.10.x/guides/developer-guides/debugging-xamlil.md @@ -3,7 +3,9 @@ id: debugging-xamlil title: Debugging the XAML compiler --- -You can debug the XAML compiler adding at your's csproj AvaloniaXamlIlDebuggerLaunch property like this: +import VsAttachDebuggerScreenshot from '/img/guides/developer-guides/debugging-xamlil/132686320-958f30a6-49f8-498f-853c-b9dd17262b54.png'; + +You can debug the XAML compiler by adding the `AvaloniaXamlIlDebuggerLaunch` property to your .csproj like this: ```xml @@ -16,8 +18,6 @@ You can debug the XAML compiler adding at your's csproj AvaloniaXamlIlDebuggerLa If build the project in Visual Studio you should see a window like this: -
- -
+ -on other IDEs, a message will appear in the build output window indicating the PID of the process to attach the debugger to and the elapsed time. If within one minute of starting the build no debugger is attacked to the process, a timeout message will be reported and the build will continue as normal. \ No newline at end of file +On other IDEs, a message will appear in the build output window indicating the PID of the process to attach the debugger to and the elapsed time. If within one minute of starting the build no debugger is attacked to the process, a timeout message will be reported and the build will continue as normal. \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md b/versioned_docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md index 84690649b..39b00d35a 100644 --- a/versioned_docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md +++ b/versioned_docs/version-0.10.x/guides/developer-guides/maintaining-stable-branch-pr-merge-process.md @@ -3,6 +3,9 @@ id: maintaining-stable-branch-pr-merge-process title: Maintaining Stable Branch --- +import NewFeatureMasterMergeScreenshot from '/img/guides/developer-guides/maintaining-stable-branch-pr-merge-process/image (6).png'; +import NewFeatureBackportScreenshot from '/img/guides/developer-guides/maintaining-stable-branch-pr-merge-process/image (13).png'; + :::warning This Process MUST be followed during any period that `master` branch is allowing breaking changes. ::: @@ -24,9 +27,7 @@ Provided the criteria are met: At this point the git tree should look similar to this. -
- -
+ Now we need to get the new PR merged into the stable branch. @@ -39,8 +40,6 @@ Pay careful attention here, we don't just merge into the stable branch! The git tree should look like this now. -
- -
+ -Please also use the `backport-candidate` and `backported 0.10.x` labels on the PRs themselves. \ No newline at end of file +Please also use the `backport-candidate` and `backported 0.10.x` labels on the PRs themselves. diff --git a/versioned_docs/version-0.10.x/guides/developer-guides/release-process.md b/versioned_docs/version-0.10.x/guides/developer-guides/release-process.md index a09fe799a..ff90ee1a3 100644 --- a/versioned_docs/version-0.10.x/guides/developer-guides/release-process.md +++ b/versioned_docs/version-0.10.x/guides/developer-guides/release-process.md @@ -3,6 +3,12 @@ id: release-process title: Release Process --- +import ReleaseGitTreeScreenshot from '/img/guides/developer-guides/release-process/image (4).png'; +import ReleasePipelineScreenshot from '/img/guides/developer-guides/release-process/image (1).png'; +import ReleaseBranchScreenshot from '/img/guides/developer-guides/release-process/image (11).png'; +import ReleaseNugetBadgeScreenshot from '/img/guides/developer-guides/release-process/image (17) (1) (1) (1).png'; +import ReleaseDeployScreenshot from '/img/guides/developer-guides/release-process/image (16).png'; + * Create a branch named `release/0.10.2` for example. This branch should be level with the `master` commit that the release will be based on. * Update the version number in the file `SharedVersion.props` i.e. `0.10.2`. * Push the release branch. @@ -11,10 +17,7 @@ If this is the first release of a major version change, i.e. `0.9.0` or `0.10.0` The git tree should now look like this: -
- -
- + * Now login at `dev.azure.com` to access the azure pipelines. Wait for the CI to finish the build. * The package for `0.10.2` should now be on the `avalonia-all` nuget feed. You should run a due diligence test on this build to ensure you are happy with the release and the packages work. @@ -25,25 +28,17 @@ Don't assume the Nuget packages will work just because master was working. In th * Now click on "Releases" and select "Avalonia (master / release)" pipeline as shown below. -
- -
+ * On the release for your release branch `release/0.10.2` click on the badge for "Nuget Release" -
- -
+ -
- -
+ * Then click on `Deploy`. -
- -
+ :::info At this point the packages will deploy to Nuget, it can take between 10 and 20 minutes for them to be indexed and publicly available. [https://www.nuget.org/packages/Avalonia/](https://www.nuget.org/packages/Avalonia/) diff --git a/versioned_docs/version-0.10.x/input/routed-events.md b/versioned_docs/version-0.10.x/input/routed-events.md index 34fe929b3..979a1e4bc 100644 --- a/versioned_docs/version-0.10.x/input/routed-events.md +++ b/versioned_docs/version-0.10.x/input/routed-events.md @@ -3,6 +3,8 @@ id: routed-events title: Routed Events --- +import InputEventRoutingScreenshot from '/img/input/routed-events/input-event-routing.png'; + Most events in Avalonia are implemented as Routed Events. Routed events are events that are raised on the whole tree rather than just the control that raised the event. ## What Is a Routed Event @@ -220,10 +222,7 @@ Avalonia input events that come in pairs are implemented so that a single user a As an illustration of how input event processing works, consider the following input event example. In the following tree illustration, `leaf element #2` is the source of a `PointerPressed` event: -
- Event routing diagram -
- +Event routing diagram The order of event processing is as follows: diff --git a/versioned_docs/version-0.10.x/layout/alignment-margins-and-padding.md b/versioned_docs/version-0.10.x/layout/alignment-margins-and-padding.md index 55628c326..d7c1631a2 100644 --- a/versioned_docs/version-0.10.x/layout/alignment-margins-and-padding.md +++ b/versioned_docs/version-0.10.x/layout/alignment-margins-and-padding.md @@ -3,6 +3,12 @@ id: alignment-margins-and-padding title: Alignment, Margins and Padding --- +import LayoutMarginsPaddingAlignmentBasicScreenshot from '/img/layout/alignment-margins-and-padding/layout-margins-padding-alignment-graphic1.png'; +import LayoutMarginsPaddingAlignmentBasicAnnotatedScreenshot from '/img/layout/alignment-margins-and-padding/layout-margins-padding-alignment-graphic2.png'; +import LayoutHorizontalAlignmentScreenshot from '/img/layout/alignment-margins-and-padding/layout-horizontal-alignment-graphic.png'; +import LayoutVerticalAlignmentScreenshot from '/img/layout/alignment-margins-and-padding/layout-vertical-alignment-graphic.png'; +import LayoutMarginsPaddingAlignmentComplexAnnotatedScreenshot from '/img/layout/alignment-margins-and-padding/layout-margins-padding-aligment-graphic3.png'; + An Avalonia control exposes several properties that are used to precisely position child elements. This topic discusses four of the most important properties: `HorizontalAlignment`, `Margin`, `Padding`, and `VerticalAlignment`. The effects of these properties are important to understand, because they provide the basis for controlling the position of elements in Avalonia applications. ### Introduction to Element Positioning @@ -11,9 +17,7 @@ There are numerous ways to position elements using Avalonia. However, achieving The following illustration shows a layout scenario that utilizes several positioning properties. -
- Positioning Example -
+Positioning Example At first glance, the `Button` elements in this illustration may appear to be placed randomly. However, their positions are actually precisely controlled by using a combination of margins, alignments, and padding. @@ -47,9 +51,7 @@ The following example describes how to create the layout in the preceding illust The following diagram provides a close-up view of the various positioning properties that are used in the preceding sample. Subsequent sections in this topic describe in greater detail how to use each positioning property. -
- Positioning Properties -
+Positioning Properties ### Understanding Alignment Properties @@ -79,9 +81,7 @@ The following example shows how to apply the `HorizontalAlignment` property to ` The preceding code yields a layout similar to the following image. The positioning effects of each `HorizontalAlignment` value are visible in the illustration. -
- HorizontalAlignment Sample -
+HorizontalAlignment Sample #### VerticalAlignment Property @@ -121,9 +121,7 @@ The following example shows how to apply the `VerticalAlignment` property to `Bu The preceding code yields a layout similar to the following image. The positioning effects of each `VerticalAlignment` value are visible in the illustration. -
- VerticalAlignment property sample -
+VerticalAlignment property sample ### Understanding Margin Properties @@ -231,6 +229,4 @@ The following example demonstrates each of the concepts that are detailed in thi When compiled, the preceding application yields a UI that looks like the following illustration. The effects of the various property values are evident in the spacing between elements, and significant property values for elements in each column are shown within `TextBlock` elements. -
- Several positioning properties in one application -
\ No newline at end of file +Several positioning properties in one application diff --git a/versioned_docs/version-0.10.x/styling/troubleshooting.md b/versioned_docs/version-0.10.x/styling/troubleshooting.md index 109ef2743..5db2ddce7 100644 --- a/versioned_docs/version-0.10.x/styling/troubleshooting.md +++ b/versioned_docs/version-0.10.x/styling/troubleshooting.md @@ -85,7 +85,7 @@ The following code example of styles that can be expected to work on top of defa - ``` diff --git a/versioned_docs/version-0.10.x/templates/data-templates.md b/versioned_docs/version-0.10.x/templates/data-templates.md index dc1ed9b48..bb7fa48b0 100644 --- a/versioned_docs/version-0.10.x/templates/data-templates.md +++ b/versioned_docs/version-0.10.x/templates/data-templates.md @@ -3,6 +3,11 @@ id: data-templates title: Data Templates --- +import ControlContentButtonScreenshot from '/img/templates/data-templates/hello-world-button.png'; +import ControlContentStringScreenshot from '/img/templates/data-templates/hello-world-string.png'; +import ControlContentStudentNoTemplateScreenshot from '/img/templates/data-templates/student-no-datatemplate.png'; +import ControlContentStudentScreenshot from '/img/templates/data-templates/student-first-last-name (1) (1) (1) (1) (1).png'; + Many controls have a `Content` property, such as [`ContentControl.Content`](http://reference.avaloniaui.net/api/Avalonia.Controls/ContentControl/4B02A756). `Window` inherits from [`ContentControl`](../controls/contentcontrol), so lets use that as an example. You're probably familiar with what happens when you put a control in the `Window.Content` property - the window displays the control: ```markup @@ -15,10 +20,7 @@ Many controls have a `Content` property, such as [`ContentControl.Content`](http ``` -
- Hello World button -
- +Hello World button Similarly if you put a string as the window content, the window will display the string: @@ -29,9 +31,7 @@ Similarly if you put a string as the window content, the window will display the ``` -
- Hello World string -
+Hello World string But what happens if you try to display an object as the window content? @@ -60,9 +60,7 @@ namespace Example ``` -
- Student without DataTemplate -
+Student without DataTemplate Not very helpful. That's because Avalonia doesn't know _how_ to display an object of type `Student` - because it's not a control it falls back to just calling `.ToString()` on the object. We can tell Avalonia how to display non-control objects by defining a data template. @@ -89,10 +87,7 @@ The easiest way to do this on `Window` (and any control that inherits from `Cont ``` - -
- Student first and last name -
+Student first and last name The data template for the window content doesn't only come from the `ContentTemplate` property. Every control also has a `DataTemplates` collection into which any number of data templates can be placed. If a control doesn't have a template set locally (e.g. in `ContentTemplate`) then it will look in its `DataTemplates` collection for a matching template. If a match isn't found there it will then go on to search its parent's `DataTemplates`, then its grandparent's, and so on until it reaches the `Window`. If it _still_ hasn't found a match it will then look in `App.xaml`/`App.axaml` for a matching `DataTemplate` and finally when all those options have been exhausted it will simply call `.ToString()` on the object. diff --git a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md index e39f4c946..5d95dd9f4 100644 --- a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md +++ b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/build-and-run-your-application-on-a-simulator.md @@ -5,7 +5,7 @@ title: Build and run your Application on a Simulator Please ensure you have followed the guide [create-a-cross-platform-solution.md](../create-a-cross-platform-solution.md "mention"). -Assuming you have created a project called `HelloWord`. Enter the directory `HelloWorld.Android` from the command line. +Assuming you have created a project called `HelloWorld`. Enter the directory `HelloWorld.Android` from the command line. To build the project for Android run the following command. diff --git a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md index 57b04dcdd..4ca93bcfb 100644 --- a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md +++ b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/android/setting-up-your-developer-environment-for-android.md @@ -14,8 +14,8 @@ dotnet workload install android ``` :::info -You may need to run the command with `sudo`\ -\ +You may need to run the command with `sudo` + You may also need to uninstall old versions. `dotnet workload remove android` ::: diff --git a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md index 856c10bd1..51958852c 100644 --- a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md +++ b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator.md @@ -3,9 +3,11 @@ info: build-and-run-your-application-on-a-simulator title: Build and run your application on a Simulator --- +import SimulatoriPadScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-a-simulator/image (34).png'; + Please ensure you have followed the guide [create-a-cross-platform-solution.md](../create-a-cross-platform-solution.md "mention"). -Assuming you have created a project called `HelloWord`. Enter the directory `HelloWorld.iOS` from the command line. +Assuming you have created a project called `HelloWorld`. Enter the directory `HelloWorld.iOS` from the command line. To build the project for iOS run the following command. @@ -19,8 +21,6 @@ To run the project in a simulator, run the following command. dotnet run ``` -
- Application running on iPad simulator -
+Application running on iPad simulator If you use `JetBrains Rider` or `Visual Studio for Mac` you can open the solution and run, build and debug your program inside the simulator. \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md index 8ddfd7cd8..23d0a2c08 100644 --- a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md +++ b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad.md @@ -3,72 +3,65 @@ info: build-and-run-your-application-on-your-iphone-or-ipad title: Build and Run your Application on your iPhone or iPad --- +import BuildiOSOpenXcodeScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/Screenshot 2022-03-17 at 12.09.54.png'; +import BuildiOSCreateXcodeProjectScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (36).png'; +import BuildiOSSelectProjectOptionsScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (30).png'; +import BuildiOSSelectAnyDeviceScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (35).png'; +import BuildiOSAddAdditionalSimulatorsScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (32).png'; +import BuildiOSProvisionPhoneScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/Screenshot 2022-03-17 at 12.19.06.png'; +import BuildiOSSelectDeviceScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (24).png'; +import BuildiOSChangeBundleIdentifierScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (18).png'; +import BuildiOSCertScreenshot from '/img/tutorials/developing-for-mobile/ios/build-and-run-your-application-on-your-iphone-or-ipad/image (33).png'; + In order to allow dotnet to sideload your application to your iphone or ipad you must first use Xcode to provision your device. Before continuing follow this guide to create a free Apple developer signing certificate. -[Free Provisiong for Xamarin.iOS Applications](https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning) +[Free Provisioning for Xamarin.iOS Applications](https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning) This has to be done by creating an Xcode app project that has the same `bundle identifier` that you will use in your application. 1. Open Xcode -
- -
- + -2\. Select Create a new Xcode project +2. Select Create a new Xcode project -
- -
+ -3\. Select iOS and App and click Next. +3. Select iOS and App and click Next. -
- -
+ -4\. Type in a name for your project and Organisation. Keep all the rest of the information the same. +4. Type in a name for your project and Organisation. Keep all the rest of the information the same. -5\. Choose a directory to save the project. You will not need to keep the project so don't worry too much about where. +5. Choose a directory to save the project. You will not need to keep the project so don't worry too much about where. -6\. In the status bar at the top click on the "Any device (arm64)" +6. In the status bar at the top click on the "Any device (arm64)" -
- -
+ -7\. At the bottom of the list click "Add Additional Simulators..." +7. At the bottom of the list click "Add Additional Simulators..." -
- -
+ -8\. Click on devices and connect your iPhone or iPad with the USB cable. Xcode will start to provision your phone for development. +8. Click on devices and connect your iPhone or iPad with the USB cable. Xcode will start to provision your phone for development. -
- -
+ -9\. Select you iPhone or iPad from the device list. +9. Select you iPhone or iPad from the device list. -
- -
+ -10\. Click the play button and the app will be installed and run on your phone. +10. Click the play button and the app will be installed and run on your phone. If successful you may return to your IDE of choice and open the `info.plist` file from the iOS project. -11\. Change the bundle identifier to the same as the one you choose in Xcode in step 3. +11. Change the bundle identifier to the same as the one you choose in Xcode in step 3. -
- -
+ -12\. Now edit the `.iOS.csproj` file. +12. Now edit the `.iOS.csproj` file. ```xml ios-arm64 @@ -85,9 +78,7 @@ Add a `` tag. To find the value for this open the application `KeyChain Access`. In the search box search for development. -
- -
+ Set the value exactly as the bold text at the top of the window on your selected development certificate. diff --git a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md index 5629430b6..5a3534715 100644 --- a/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md +++ b/versioned_docs/version-0.10.x/tutorials/developing-for-mobile/ios/setting-up-your-developer-environment-for-ios.md @@ -18,8 +18,8 @@ dotnet workload install ios ``` :::info -You may need to run the command with `sudo`\ -\ +You may need to run the command with `sudo` + You may also need to uninstall old versions. `dotnet workload remove ios` ::: diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md index 2322210c6..ed4885fd5 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/add-and-layout-controls.md @@ -3,6 +3,10 @@ id: add-and-layout-controls title: Add and Layout Controls --- +import MusicStoreBuyButtonScreenshot from '/img/tutorials/music-store-app/add-and-layout-controls/buy-button.png'; +import MusicStoreAddStylesScreenshot from '/img/tutorials/music-store-app/add-and-layout-controls/add-styles.png'; +import MusicStorePrettyButtonScreenshot from '/img/tutorials/music-store-app/add-and-layout-controls/pretty-button.png'; + ## Add and Layout some Controls Let's start by adding a `Button` to the `MainWindow`. The button will allow the `user` to purchase music in order to add to their collection. @@ -60,9 +64,7 @@ public class MainWindowViewModel : ViewModelBase Pressing the `Debug Button` again to run the program we can see we have a button and when clicked setting a breakpoint inside the `BuyMusicCommand` code we can see that the code is executed when it's hit. -
- Buy Button -
+Buy Button Let's position the button to the top right of the screen and make it look a bit nicer. @@ -94,9 +96,7 @@ Let's create a file just for Icons. In Rider right click on the project and select `Add` → `Avalonia Styles` -
- Add Styles -
+Add Styles Enter the name `Icons` when prompted and press `Enter`. @@ -156,6 +156,4 @@ Return to `MainWindow.axaml`, we can add the Icon to the Button like so... Running the application we now have a nice button. -
- Pretty Button -
\ No newline at end of file +Pretty Button diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md index 13ebde540..d1d4fb6dd 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/add-content-to-dialog.md @@ -3,6 +3,10 @@ id: add-content-to-dialog title: Add Content to Dialog --- +import MusicStoreMockSearchScreenshot from '/img/tutorials/music-store-app/add-content-to-dialog/text-list.png'; +import MusicStoreBeforeWrapPanelScreenshot from '/img/tutorials/music-store-app/add-content-to-dialog/image-20210310010932979.png'; +import MusicStoreWrapPanelScreenshot from '/img/tutorials/music-store-app/add-content-to-dialog/image-20210310011526700.png'; + ## Adding Content to the Dialog Inside the dialog we would like the user to search for albums, and then select an album to buy. @@ -275,10 +279,7 @@ Your `MusicStoreWindow.axaml` should look like this. Run the application: - -
- -
+ Our items are showing in the List... but not very visual. @@ -333,9 +334,7 @@ We shall come back to the `Bindings` in a moment, for now lets run the applicati As can be seen the albums are displayed vertically. However it would be nice to have them horizontally and wrap around. -
- -
+ Luckily `ListBox` provides a solution to this with something called `ItemsPanelTemplate`. By default the `ListBox` has its `ItemPanel` property set to an `ItemsPanelTemplate` which contains a `StackPanel`, we can change this to a `WrapPanel` like so. @@ -351,9 +350,7 @@ Luckily `ListBox` provides a solution to this with something called `ItemsPanelT Now when we run the application we get: -
- -
+ As our list gets more items, that will wrap around onto the next line, and the user will be able to scroll. diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md index 23ce7a6ab..83df24ebd 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/add-items-to-users-collection.md @@ -3,6 +3,8 @@ id: add-items-to-users-collection title: Add Items to User Collection --- +import MusicStoreAddedAlbumsScreenshot from '/img/tutorials/music-store-app/add-items-to-users-collection/image-20210310175949319.png'; + ## Adding Albums to the Users Collection Ok so now the user can find albums to purchase, it would be nice if the user could see which albums are in their collection. To do this we can add a similar UI to the MainWindow. @@ -112,8 +114,6 @@ Notice we check the result for `null`, this is because the `user` may have cance Lets run the program and see if it works. -
- -
+ For the finishing touch we simply need to add persistence to the application. diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md index 9d8d85c8f..e365f2484 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-a-modern-looking-window.md @@ -3,6 +3,10 @@ info: creating-a-modern-looking-window title: Creating a Modern looking Window --- +import MusicStoreDarkModePreviewScreenshot from '/img/tutorials/music-store-app/creating-a-modern-looking-window/dark-mode-preview.png'; +import MusicStoreAcrylicMaterialScreenshot from '/img/tutorials/music-store-app/creating-a-modern-looking-window/acrylic-material.png'; +import MusicStoreFullAcrylicWindowScreenshot from '/img/tutorials/music-store-app/creating-a-modern-looking-window/full-acrylic-window.png'; + ## Use Dark Mode and Add a little Acrylic Let's try and make this look a little more modern by applying `Dark` mode and some `Acrylic` styling to the Window. @@ -30,9 +34,7 @@ Let's try and make this look a little more modern by applying `Dark` mode and so The previewer knows about changes you make to the file your editing, but it doesn't know about changes in other files. This is why you need to build the project if another file was changed. -
- -
+ 1. After where it says `Title="Avalonia.MusicStore"` add the following code: @@ -90,11 +92,9 @@ Now click the `Debug` `Button` to run the application again. Notice we have a nice acrylic window effect. Shame about the titlebar, though. Let's see how we can make that blend in a bit more. -
- -
+ -\*Note, Linux users can not yet take advantage of this due to limitations of X11. The code will run and the window will still work on Linux, but the full effect will not be realised. +*Note, Linux users can not yet take advantage of this due to limitations of X11. The code will run and the window will still work on Linux, but the full effect will not be realised. 1. It is possible to have Avalonia render into the `titlebar`, allowing us to create a more blended look. Modern web browsers tend to render tabs into the titlebar with this technique. @@ -120,9 +120,6 @@ Notice we have a nice acrylic window effect. Shame about the titlebar, though. L Press the `Debug` button again to run. - -
- Full acrlic window -
+Full acrylic window Perfect, a modern looking Window, Avalonia is able to render every pixel. diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md index 8f40bcf7d..92d67f8fe 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/creating-the-project.md @@ -3,6 +3,11 @@ id: creating-the-project title: Create the Project --- +import MusicStoreCreateSolutionScreenshot from '/img/tutorials/music-store-app/creating-the-project/CreateSolution.png'; +import MusicStoreProjectStructureScreenshot from '/img/tutorials/music-store-app/creating-the-project/project-structure.png'; +import MusicStoreRiderDebugButtonScreenshot from '/img/tutorials/music-store-app/creating-the-project/debug-button.png'; +import MusicStoreNewAppScreenshot from '/img/tutorials/music-store-app/creating-the-project/image-20210310192926578.png'; + ### Creating a New Project From the Rider Welcome Screen, click on `New Solution`. This will open a dialog with Project Types on the left and some input fields on the right. @@ -11,15 +16,11 @@ At the bottom on the left hand side under the heading `Other` you will see `Aval Click the `Create` button. -
- -
+ A new project will be created with the following structure. -
- -
+ The folders are: @@ -45,14 +46,10 @@ Some of the important files are: Press the debug button top right of the IDE to compile and run the project. -
- -
+ This will show a Window that looks like: -
- -
+ A little plain but we now have a running application, and a blank canvas to start from. diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/displaying-images.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/displaying-images.md index a1e7e32e8..dcc33f1bf 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/displaying-images.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/displaying-images.md @@ -3,6 +3,8 @@ info: displaying-images title: Displaying Images --- +import MusicStoreDisplayingImagesScreenshot from '/img/tutorials/music-store-app/displaying-images/image-20210310173858088.png'; + ## Displaying Album Cover Images So we have the Albums showing with the Artist name and Title, however, if we can download the Album art and display it, this will really bring the app alive. @@ -162,6 +164,4 @@ Now run the application and search for your favourite artist. Notice how the Albums covers load one by one, but that the UI remains responsive. -
- -
\ No newline at end of file + diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/index.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/index.md index 7dc804baf..7eedb0d9e 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/index.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/index.md @@ -1,5 +1,8 @@ # Music Store App +import MusicStoreFinishedAppScreenshot from '/img/tutorials/music-store-app/image-20210310184538120.png'; +import MusicStoreMvvmDiagram from '/img/tutorials/music-store-app/mvvm.png'; + :::info The completed project can be found at [https://github.com/AvaloniaUI/Avalonia.MusicStore](https://github.com/AvaloniaUI/Avalonia.MusicStore). @@ -12,10 +15,7 @@ This guide has instructions for Rider on macOS, however the steps will be almost Our livestream assumes some knowledge of [XAML](../../guides/basics/introduction-to-xaml.md), [MVVM ](../../guides/basics/mvvm.md)development, however this guide should fill in the gaps for beginners. -
- -
- + ## A little background to Avalonia @@ -39,9 +39,7 @@ MVVM is simply a way to enforce [Separation of concerns](https://en.wikipedia.or Following the MVVM approach will alleviate these difficulties and help keep your UI code scalable. -
- -
+ **How does MVVM work?** diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md index 9e8e3fcaf..d145a5746 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/load-data-at-startup.md @@ -3,6 +3,8 @@ info: load-data-at-startup title: Load data at Startup --- +import MusicStoreLoadedDataStartScreenshot from '/img/tutorials/music-store-app/load-data-at-startup/image-20210310184202271.png'; + ## Loading Albums on Startup Our backend code provides a nice way to load the users collection from disk. @@ -38,6 +40,4 @@ As you can see it firstly uses the business logic apis to load the list of `Albu Note we then re-iterate over the `Albums` and asynchronously load each cover. Note that we do this after adding all the albums to the list, as its more important to quickly show the user all the albums available and then load the images. -
- -
\ No newline at end of file + diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md index 2730f6567..8a8b60a00 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/opening-a-dialog.md @@ -3,6 +3,9 @@ id: opening-a-dialog title: Opening a Dialog --- +import MusicStoreAddWindowScreenshot from '/img/tutorials/music-store-app/opening-a-dialog/add-window.png'; +import MusicStoreDialogOpenedScreenshot from '/img/tutorials/music-store-app/opening-a-dialog/dialog-opened.png'; + ## Opening a Dialog Opening a dialog is an advanced topic, if you are very new to Avalonia, try not to get too stuck on this section, you may want to just copy in the code and move on. Then come back once you have a better understanding of some of the basics. @@ -13,9 +16,7 @@ First we need to add a Window to the project, right click on the `Views` folder When prompted name this MusicStoreWindow and press the `Enter` key. -
- Add Window -
+Add Window This will add the following code: @@ -196,8 +197,6 @@ Also set `Width` and `Height` properties of the `MusicStoreWindows` `` e Now run the application and click the Store button. -
- Dialog opened -
+Dialog opened As you can see the dialog window is opened perfectly centered inside the MainWindow. diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md index 88923c2b3..91b24e8d1 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/searching-for-albums.md @@ -3,6 +3,9 @@ info: searching-for-albums title: Searching for Albums --- +import MusicStoreiTunesSearchNugetScreenshot from '/img/tutorials/music-store-app/searching-for-albums/image-20210310013703557.png'; +import MusicStoreAlbumViewScreenshot from '/img/tutorials/music-store-app/searching-for-albums/image-20210310110401944.png'; + ## Searching For Albums In order for our application to work we are going to need some business logic. This code is not relevant to the tutorial, except for the fact that it will provide the following services: @@ -19,9 +22,7 @@ This will open the `Packages` tool at the bottom of the IDE, like so. Search for `ItunesSearch` and press the green `+` button on the right hand side to install it. -
- -
+ 1. In the `Models` folder add a new class called `Album` and paste in the following code. @@ -211,6 +212,4 @@ SearchResults.Add(new AlbumViewModel()); Now run the application and click the store button, then search for an artist or album name. If all has gone to plan you should see the progressbar animating whilst the server is busy processing the request and then you should see some results appear in the list. -
- -
+ diff --git a/versioned_docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md b/versioned_docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md index 15b31b7f9..e3bcf78f8 100644 --- a/versioned_docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md +++ b/versioned_docs/version-0.10.x/tutorials/music-store-app/setup-development-environment.md @@ -3,6 +3,11 @@ id: setup-development-environment title: Setup Development Environment --- +import MusicStoreRiderWelcomeScreenshot from '/img/tutorials/music-store-app/setup-development-environment/rider-welcome.png'; +import MusicStoreConfigurePluginReposScreenshot from '/img/tutorials/music-store-app/setup-development-environment/configure-plugin-repos.png'; +import MusicStoreEnterPluginRepoScreenshot from '/img/tutorials/music-store-app/setup-development-environment/enter-plugin-repo.png'; +import MusicStorePluginInstallScreenshot from '/img/tutorials/music-store-app/setup-development-environment/plugin-install.png'; + ### Setting up your development environment 1. Download and install .NET 5 SDK [Download .NET \(Linux, macOS, and Windows\) \(microsoft.com\)](https://dotnet.microsoft.com/download) @@ -41,27 +46,18 @@ Examples: Once Rider loads you will see the Welcome Screen. Click the `Configure` dropdown and select `Plugins`. -
- rider welcome -
+Rider welcome A new Preferences Screen will open up. Click the `Settings` icon as shown and select `Manage Plugin Repositories...` -
- configure-plugin-repos -
+Configure plugin repos Click the `+` icon and enter the URL `https://plugins.jetbrains.com/plugins/dev/14839`then click `OK` -
- enter-plugin-repo -
+Enter plugin repo Now click on the `Marketplace` tab and search for `Avalonia`. Select `AvaloniaRider` and click `Install` then once that's done, click the `Restart IDE` button that will appear. -
- plugin-install -
- +Plugin install Now Rider should be ready to develop Avalonia applications. diff --git a/versioned_docs/version-0.10.x/tutorials/running-in-the-browser.md b/versioned_docs/version-0.10.x/tutorials/running-in-the-browser.md index ecf19c0d2..c0c18966e 100644 --- a/versioned_docs/version-0.10.x/tutorials/running-in-the-browser.md +++ b/versioned_docs/version-0.10.x/tutorials/running-in-the-browser.md @@ -32,7 +32,7 @@ dotnet new avalonia.xplat 5. In order to run simply do: ```bash -cd WebTest.Web +cd WebTest.Browser dotnet run ``` @@ -50,4 +50,4 @@ Legacy Blazor backend is still available for compatability and can be referenced ## Troubleshooting -If you have not performed the step to install required workloads, you will encounter errors when running the app in your browser later (e.g. `System.DllNotFoundException: libSkiaSharp`) and you will need to rebuild again before the app will run. \ No newline at end of file +If you have not performed the step to install required workloads, you will encounter errors when running the app in your browser later (e.g. `System.DllNotFoundException: libSkiaSharp`) and you will need to rebuild again before the app will run. diff --git a/versioned_docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md b/versioned_docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md index c4649787a..e5c6f180f 100644 --- a/versioned_docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md +++ b/versioned_docs/version-0.10.x/tutorials/todo-list-app/adding-new-items.md @@ -3,6 +3,10 @@ id: adding-new-items title: Adding new Items --- +import ToDoAddNewItemsEmptyScreenshot from '/img/tutorials/todo-list-app/adding-new-items/adding-new-items-view.png'; +import ToDoAddNewItemNavigationScreenshot from '/img/tutorials/todo-list-app/adding-new-items/adding-new-item-run.gif'; +import ToDoAddNewItemResultScreenshot from '/img/tutorials/todo-list-app/adding-new-items/adding-new-items-2-run.gif'; + When we originally created the `TodoListView` we added an "Add an item" button. It's time now to make that button do something. When the button is clicked we want to replace the list of items with a new view which will allow the user to enter the description of a new item. ### Create the view @@ -30,9 +34,7 @@ Views/AddItemView.axaml This gives us a view which looks like this: -
- The view -
+The view The only new thing here is the `` control which is a control that allows a user to input text. We set three properties on it: @@ -164,9 +166,7 @@ If you're familiar with WPF or UWP you may think it strange that we're binding ` If you now run the application and click the "Add an item" button you should see the new view appear. -
- The running application -
+The running application Now we have the "Add new item" view appearing we need to make it work. In particular we need to enable/disable the OK button depending on whether the user has typed anything in the `Description`. @@ -369,7 +369,4 @@ Finally we subscribe to the result of the observable sequence. If the command re ### Run the application - -
- The running application -
\ No newline at end of file +The running application diff --git a/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md b/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md index af74ff5ab..1e00973cf 100644 --- a/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md +++ b/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-new-project.md @@ -3,13 +3,13 @@ id: creating-a-new-project title: Creating a new project --- +import ToDoVsCreateNewProjectScreenshot from '/img/tutorials/todo-list-app/creating-a-new-project/image (5).png'; + ## Visual Studio The easiest way to get started with Avalonia from Visual Studio is to [install the extension](https://marketplace.visualstudio.com/items?itemName=AvaloniaTeam.AvaloniaforVisualStudio) from the Visual Studio Marketplace. Once that is installed, you can create an Avalonia MVVM application: -
- Decription -
+ - Start Visual Studio - Select "Create a new project" from the start window or `File -> New -> Project` from the main menu diff --git a/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md b/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md index b1e584ab5..0b02c63f8 100644 --- a/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md +++ b/versioned_docs/version-0.10.x/tutorials/todo-list-app/creating-a-view.md @@ -3,6 +3,9 @@ id: creating-a-view title: Creating a View --- +import ToDoViewPreviewerScreenshot from '/img/tutorials/todo-list-app/creating-a-view/creating-a-view-todolistview.png'; +import ToDoViewScreenshot from '/img/tutorials/todo-list-app/creating-a-view/creating-a-view-run.png'; + Let's first create a view to display a list of TODO items together with a button to add a new item. Because this is a first tutorial, we're going to first just populate the view with some hard-coded data. In later steps we'll use the MVVM pattern to populate this view. @@ -93,9 +96,7 @@ Edit the contents of `Views/TodoListView.axaml` to contain the following: If you're using the Visual Studio extension you should see the contents of the control displayed in the previewer after completing a build: -
- Designer view -
+Designer view ### What does it all mean? @@ -195,8 +196,5 @@ Using the XML namespace we've just declared we now place the `TodoListView` cont If you now run the application (by pressing `F5` in Visual Studio or executing `dotnet run` in .NET Core) you should see the application running in all its glory: -
- The running application -
- +The running application \ No newline at end of file diff --git a/versioned_docs/version-0.10.x/tutorials/todo-list-app/index.md b/versioned_docs/version-0.10.x/tutorials/todo-list-app/index.md index a0dfe4086..2d4ef6641 100644 --- a/versioned_docs/version-0.10.x/tutorials/todo-list-app/index.md +++ b/versioned_docs/version-0.10.x/tutorials/todo-list-app/index.md @@ -1,14 +1,14 @@ # ToDo List App +import ToDoFinishedAppScreenshot from '/img/tutorials/todo-list-app/image (14).png'; + In this tutorial we're going to be creating a simple TODO application in Avalonia using the Model-View-ViewModel \(MVVM\) pattern. :::info You can find the code for the completed application [here](https://github.com/grokys/todo-tutorial). ::: -
- Decription -
+ ## Model-View-ViewModel \(MVVM\) diff --git a/versioned_docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md b/versioned_docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md index 454da9c6f..155469eba 100644 --- a/versioned_docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md +++ b/versioned_docs/version-0.10.x/tutorials/todo-list-app/wiring-up-the-views.md @@ -3,6 +3,8 @@ id: wiring-up-the-views title: Wiring up the Views --- +import ToDoWiredViewScreenshot from '/img/tutorials/todo-list-app/wiring-up-the-views/wiring-up-views-run.png'; + Now that we've got the view models set up, we need to make our views use these view models. We do this by making use of Avalonia's [data binding](../../getting-started/programming-with-avalonia/data-binding) feature. ## Update MainWindow @@ -97,6 +99,4 @@ How each item is displayed is controlled by the `ItemTemplate`. The `ItemTemplat If you now run the application you will see the items in the \(fake\) database displayed. -
- The running application -
\ No newline at end of file + diff --git a/versioned_docs/version-0.10.x/wpf-developer-tips/datatemplates.md b/versioned_docs/version-0.10.x/wpf-developer-tips/datatemplates.md index e0a317e97..6a72f8960 100644 --- a/versioned_docs/version-0.10.x/wpf-developer-tips/datatemplates.md +++ b/versioned_docs/version-0.10.x/wpf-developer-tips/datatemplates.md @@ -1,6 +1,6 @@ --- info: datatemplates -title: DataTempaltes +title: DataTemplates --- As styles aren't stored in `Resources`, neither are `DataTemplates`. Instead, `DataTemplates` are placed in a `DataTemplates` collection on each control \(and on `Application`\): @@ -25,4 +25,4 @@ Data templates in Avalonia can also target interfaces and derived classes \(whic ## DataTemplateSelector -In WPF you can create a `DataTemplateSelector` to select or create a `DataTemplate` based on the provided data. In Avalonia you cannot do this, but you can implement `IDataTemplate` which can be seen as a good replacement for the `DataTemplateSelector`. Please find a sample [here](https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/DataTemplates/IDataTemplateSample). \ No newline at end of file +In WPF you can create a `DataTemplateSelector` to select or create a `DataTemplate` based on the provided data. In Avalonia you cannot do this, but you can implement `IDataTemplate` which can be seen as a good replacement for the `DataTemplateSelector`. Please find a sample [here](https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/DataTemplates/IDataTemplateSample). diff --git a/versioned_docs/version-0.10.x/wpf-developer-tips/index.md b/versioned_docs/version-0.10.x/wpf-developer-tips/index.md index edfe2a77b..65c700f41 100644 --- a/versioned_docs/version-0.10.x/wpf-developer-tips/index.md +++ b/versioned_docs/version-0.10.x/wpf-developer-tips/index.md @@ -86,7 +86,7 @@ private void OnControl_Unloaded(object sender, RoutedEventArgs e) **Avalonia** ``` TemplateApplied += OnControl_Loaded; -private void BuildControl_Loaded(object sender, RoutedEventArgs e) +private void OnControl_Loaded(object sender, RoutedEventArgs e) { } @@ -129,4 +129,4 @@ TextRunProperties.SetTextDecorations(TextDecorations.Underline); **Avalonia** ```csharp TextRunProperties.Underline = true; -``` \ No newline at end of file +```