Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
zdpcdt committed Aug 4, 2023
2 parents 9d0b2c9 + fbf2033 commit 35cc6a0
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 194 deletions.
4 changes: 2 additions & 2 deletions i18n/zh-Hans/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"description": "The label for category ToDo List App in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Music Store App": {
"message": "Music Store App",
"message": "音乐商店应用",
"description": "The label for category Music Store App in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Basics": {
Expand Down Expand Up @@ -144,7 +144,7 @@
"description": "The label for category Deployment in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Reference": {
"message": "Reference",
"message": "参考资料",
"description": "The label for category Reference in sidebar documentationSidebar"
},
"sidebar.documentationSidebar.category.Built-in Controls": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,46 @@
description: REFERENCE
---

# Animation Settings
# 动画设置

This section contains full lists of the _Avalonia UI_ animation settings:
本节包含 _Avalonia UI_ 动画设置的完整列表:

* Easing Functions
* Fill Modes
* Playback Direction
* Repeat
* 缓动函数(Easing Functions
* 填充模式(Fill Modes
* 播放方向(Playback Direction
* 重复(Repeat

## Easing Functions
## 缓动函数(Easing Functions

<table><thead><tr><th width="216">Profile</th><th>Setting</th></tr></thead><tbody><tr><td><img src='/img/gitbook-import/assets/image (67).png' alt=''/></td><td><code>SineEaseOut</code></td></tr></tbody></table>
<table><thead><tr><th width="216">配置</th><th>设置</th></tr></thead><tbody><tr><td><img src='/img/gitbook-import/assets/image (67).png' alt=''/></td><td><code>SineEaseOut</code></td></tr></tbody></table>

## Fill Modes
## 填充模式(Fill Modes

The fill mode attribute of an animation defines how the set property persists after running an animation, and on delays in between runs.
动画的填充模式属性定义了动画运行后设置属性在延迟运行之间的持续方式。

The following table describes the possible behaviors:
以下表格描述了可能的行为:

| Value | Description |
| ---------- | --------------------------------------------------------------------------------------------------------- |
| `None` | Value will not persist after animation nor the first value will be applied when the animation is delayed. |
| `Forward` | The last interpolated value will be persisted to the target property. |
| `Backward` | The first interpolated value will be displayed on animation delay. |
| `Both` | Both `Forward` and `Backward` behaviors will be applied. |
| | 描述 |
|------------|---------------------------------|
| `None` | 在动画后值不会持续,也不会在延迟时应用第一个值。 |
| `Forward` | 最后一个插值值将持续到目标属性。 |
| `Backward` | 第一个插值值将在动画延迟时显示。 |
| `Both` | 同时应用 `Forward` `Backward` 行为。 |



## Playback Direction
## 播放方向(Playback Direction

Playback direction defines how the animation will be played, including any repeats. The following table describes the possible settings:
播放方向定义了动画的播放方式,包括任何重复。以下表格描述了可能的设置:

<table><thead><tr><th width="229">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>Normal</code></td><td>The animation is played normally.</td></tr><tr><td><code>Reverse</code></td><td>The animation is played in reverse direction.</td></tr><tr><td><code>Alternate</code></td><td>The animation is played forwards first, then backwards.</td></tr><tr><td><code>AlternateReverse</code></td><td>The animation is played backwards first, then forwards.</td></tr></tbody></table>
<table><thead><tr><th width="229"></th><th>描述</th></tr></thead><tbody><tr><td><code>Normal</code></td><td>动画以正常方式播放。</td></tr><tr><td><code>Reverse</code></td><td>动画以反向方向播放。</td></tr><tr><td><code>Alternate</code></td><td>动画先正向播放,然后反向播放。</td></tr><tr><td><code>AlternateReverse</code></td><td>动画先反向播放,然后正向播放。</td></tr></tbody></table>

## Repeat
## 重复(Repeat

The repeat attribute on an animation element sets how many times it is to be replayed. There are two formats for this setting:
动画元素上的重复属性设置了动画的重复次数。有两种格式的设置方式:

| Value | Description |
| ---------- | ------------------------------------------------ |
| `N` | (N is an integer) - play N times. N can be zero. |
| `INFINITE` | Repeat Indefinitely |
| | 描述 |
|------------|-----------------------|
| `N` | N 是整数——重复 N 次。N 可以是零。 |
| `INFINITE` | 无限重复。 |
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
description: REFERENCE
---

# Built-in Data Binding Converters
# 内置数据绑定转换器

_Avalonia UI_ includes a number of built-in data binding converters for common scenarios:
_Avalonia UI_ 包含许多用于常见场景的内置数据绑定转换器:

| Converter | Description |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Negation Operator | The ! operator can be placed in front of the data binding path to return the inversion of a Boolean value. See also the note below. |
| `StringConverters.IsNullOrEmpty` | Returns `true` if the input string is null or empty |
| `StringConverters.IsNotNullOrEmpty` | Returns `false` if the input string is null or empty |
| `ObjectConverters.IsNull` | Returns `true` if the input is null |
| `ObjectConverters.IsNotNull` | Returns `false` if the input is null |
| `BoolConverters.And` | A multi-value converter that returns `true` if all inputs are true. |
| `BoolConverters.Or` | A multi-value converter that returns `true` if any input is true. |
| 转换器 | 描述 |
|-------------------------------------|-----------------------------------------|
| 否定运算符 | 可以将 `!` 运算符放在数据绑定路径前面,返回布尔值的反转。参见下面的备注。 |
| `StringConverters.IsNullOrEmpty` | 如果输入字符串为 null 或空字符串,则返回 `true` |
| `StringConverters.IsNotNullOrEmpty` | 如果输入字符串不为 null 且不为空字符串,则返回 `false` |
| `ObjectConverters.IsNull` | 如果输入对象为 null,则返回 `true` |
| `ObjectConverters.IsNotNull` | 如果输入对象不为 null,则返回 `false` |
| `BoolConverters.And` | 这是一个多值转换器,如果所有输入值都为 `true`,则返回 true |
| `BoolConverters.Or` | 这是一个多值转换器,如果任何输入值为 `true`,则返回 true |

## Negation Operator Examples
## 否定运算符示例

This example shows the text block when the bound value is false:
这个例子展示了当绑定的值为false时,文本块的情况:

```markup
<StackPanel>
Expand All @@ -27,9 +27,9 @@ This example shows the text block when the bound value is false:
</StackPanel>
```

Negation also works when you bind to a non-Boolean value. This works because the bound value is first converted to a Boolean (using the function `Convert.ToBoolean` ) and then the result is negated.&#x20;
否定运算符在绑定到非布尔值时也可以工作。这是因为绑定的值首先会被转换为布尔值(使用函数`Convert.ToBoolean`),然后结果会被取反。

For example, as the integer zero is converted to false (by the the function `Convert.ToBoolean`) and all other integer values are converted to true, you can use the negation operator to show a message when a collection is empty, like this:
例如,整数零会被转换为false(通过函数`Convert.ToBoolean`),而其他所有整数值都会被转换为true,因此你可以使用否定运算符来在集合为空时显示一条消息,像这样:

```markup
<Panel>
Expand All @@ -38,37 +38,37 @@ For example, as the integer zero is converted to false (by the the function `Con
</Panel>
```

You can also use the negation operator twice. For example, where you want to perform the conversion from integer to Boolean, and then negate that value.&#x20;
你也可以连续使用否定运算符两次。例如,在你想要将整数转换为布尔值,然后对该值取反时,可以这样写:

You can use this to hide a control when a collection is empty (count is zero), like this:
你可以使用这种方式来在集合为空时隐藏一个控件(计数为零),像这样:

```markup
<Panel>
<ListBox Items="{Binding Items}" IsVisible="{Binding !!Items.Count}"/>
</Panel>
```

## Other Conversion Examples
## 其他转换示例

This example binding will hide the text block if its bound text is null or empty:
这个绑定示例将在绑定的文本为null或空字符串时隐藏文本块:

```markup
<TextBlock Text="{Binding MyText}"
IsVisible="{Binding MyText,
Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
```

And this example will hide the content control if the bound object is null or empty:
而这个示例将在绑定的对象为null或为空时隐藏内容控件:

```markup
<ContentControl Content="{Binding MyContent}"
IsVisible="{Binding MyContent,
Converter={x:Static ObjectConverters.IsNotNull}}"/>
```

## More Information
## 更多信息


:::info
You can follow the Avalonia UI value converter sample, [here](https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/MVVM/ValueConversionSample).
你可以查看 Avalonia UI [值转换器示例](https://github.com/AvaloniaUI/Avalonia.Samples/tree/main/src/Avalonia.Samples/MVVM/ValueConversionSample)
:::
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
description: REFERENCE
---

# Gestures
# 手势

_Avalonia UI_ provides following gesture recognizers:
_Avalonia UI_ 提供以下手势识别器:

* [PinchGestureRecognizer](./pinchgesturerecognizer)
* [PullGestureRecognizer](./pullgesturerecognizer)
* [ScrollGestureRecognizer](./scrollgesturerecognizer)
* [PinchGestureRecognizer](./pinchgesturerecognizer)(捏合手势识别器)
* [PullGestureRecognizer](./pullgesturerecognizer)(拉动手势识别器)
* [ScrollGestureRecognizer](./scrollgesturerecognizer)(滚动手势识别器)

##

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: REFERENCE - Gestures

# PinchGestureRecognizer

A gesture recognizer that tracks a pinch gesture. A pinch gesture occurs when two pointer contacts are brought towards each other, or away from each other. This is useful in controls that implements a pinch to zoom interaction.
一个用于追踪捏合手势的手势识别器。捏合手势发生在两个触控点向彼此靠近或远离的情况下。这在实现捏合缩放交互的控件中非常有用。

## Using a PinchGestureRecognizer
A PinchGestureRecognizer can be attached to a control using the control's `GestureRecognizers` property.
可以通过将 `PinchGestureRecognizer` 添加到控件的 `GestureRecognizers` 属性来将其附加到控件上。
```xml
<Image Stretch="UniformToFill"
Margin="5"
Expand All @@ -23,13 +23,13 @@ A PinchGestureRecognizer can be attached to a control using the control's `Gestu
image.GestureRecognizers.Add(new PinchGestureRecognizer());
```

The PinchGestureRegonizer raises a `Gestures.PinchEvent` when it detects the start of a pull gesture. When the pull ends, from the pointer being released or another gesture start, it raises a `Gestures.PinchEndedEvent`.
The `Scale` property in the args passed to the `Gestures.PinchEvent` event handler contains the relative size of the pinch since it started.
`PinchGestureRegonizer` 检测到拉动手势的开始时,会触发 `Gestures.PinchEvent` 事件。当拉动结束(指针被释放或开始另一个手势)时,它会触发 `Gestures.PinchEndedEvent` 事件。
传递给 `Gestures.PinchEvent` 事件处理程序的参数中的 `Scale` 属性包含自从捏合手势开始以来的相对大小。

## More Information
## 更多信息

:::info
View the source code on _GitHub_
_GitHub_ 上查看源代码

[`PinchGestureRecognizer.cs`](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Input/GestureRecognizers/PinchGestureRecognizer.cs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: REFERENCE - Gestures

# PullGestureRecognizer

A gesture recognizer that tracks a pull gesture. A pull gesture occurs when a pointer is dragged from the edge of a control. The direction of the pull is defined by the `PullDirection` property.
一个用于追踪拉动手势的手势识别器。拉动手势发生在指针从控件的边缘拖动时。拉动的方向由 `PullDirection` 属性定义。

## Using a PullGestureRecognizer
A PullGestureRecognizer can be attached to a control using the control's `GestureRecognizers` property.
可以通过将 `PullGestureRecognizer` 添加到控件的`GestureRecognizers`属性来将其附加到控件上。
```xml
<Border Width="500"
Height="500"
Expand All @@ -26,39 +26,39 @@ border.GestureRecognizers.Add(new PullGestureRecognizer()
});
```

The PullGestureRegonizer raises a `Gestures.PullGestureEvent` when it detects the start of a pull gesture. When the pull ends, from the pointer being released or another gesture start, it raises a `Gestures.PullGestureEndedEvent`.
`PullGestureRegonizer` 检测到拉动手势的开始时,会引发`Gestures.PullGestureEvent`事件。当拉动结束,即指针被释放或另一个手势开始时,它会引发`Gestures.PullGestureEndedEvent`事件。

### PullDirection
This defines the direction of the pull. There are 4 available values;
* `PullDirection.TopToBottom` : Pull starts from the top edge and moves towards the buttom
* `PullDirection.BottomToTop` : Pull starts from the bottom edge and moves towards the top
* `PullDirection.LeftToRight` : Pull starts from the left edge and moves towards the right
* `PullDirection.RightToLeft` : Pull starts from the right edge and moves towards the top
这定义了拉动的方向。有4个可用的值:
* `PullDirection.TopToBottom` : 拉动从顶部边缘开始向下移动
* `PullDirection.BottomToTop` : 拉动从底部边缘开始向上移动
* `PullDirection.LeftToRight` : 拉动从左边缘开始向右移动
* `PullDirection.RightToLeft` : 拉动从右边缘开始向左移动

## Useful Properties&#x20;
## 有用的属性

You will probably use these properties most often:
您可能经常使用以下属性:

<table>
<thead>
<tr>
<th width="266">Property</th>
<th>Description</th>
<th width="266">属性</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>PullDirection</td>
<td>Defines the direction of the pull gesture. </td>
<td>定义拉动手势的方向。</td>
</tr>
</tbody>
</table>


## More Information
## 更多信息

:::info
View the source code on _GitHub_
_GitHub_ 上查看源代码:

[`PullGestureRecognizer.cs`](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Input/GestureRecognizers/PullGestureRecognizer.cs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: REFERENCE - Gestures

# ScrollGestureRecognizer

A gesture recognizer that tracks a scrolling gesture. This can be attached to a control to detect when a pointer moves in a specific direction inside the control's bounds. This is especially useful when a control pans its contents, either horizontally, vertically or both.
一个用于跟踪滚动手势的手势识别器。可以将其附加到控件上,以便在控件的边界内检测指针在特定方向上的移动。当控件水平、垂直或同时进行内容平移时,这将特别有用。

## Using a ScrollGestureRecognizer
A ScrollGestureRecognizer can be attached to a control using the control's `GestureRecognizers` property.
## 使用 ScrollGestureRecognizer
可以使用控件的 `GestureRecognizers` 属性将 `ScrollGestureRecognizer` 附加到控件上。
```xml
<Image Stretch="UniformToFill"
Margin="5"
Expand All @@ -28,38 +28,38 @@ image.GestureRecognizers.Add(new ScrollGestureRecognizer()
});
```

The ScrollGestureRegonizer raises a `Gestures.ScrollGestureEvent` when it detects the start of a scroll gesture. When the scroll ends, from the pointer being released or another gesture start, it raises a `Gestures.ScrollGestureEndedEvent`.
`ScrollGestureRecognizer` 检测到滚动手势的开始时,它会引发 `Gestures.ScrollGestureEvent` 事件。当滚动结束(指针释放或其他手势开始)时,它会引发 `Gestures.ScrollGestureEndedEvent` 事件。

## Useful Properties&#x20;
## 有用的属性

You will probably use these properties most often:

<table>
<thead>
<tr>
<th width="266">Property</th>
<th>Description</th>
<th width="266">属性</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>CanVerticallyScroll</td>
<td>Defines whether the content can be scrolled vertically. </td>
<td>定义内容是否可以垂直滚动。</td>
</tr>
<tr>
<td>CanHorizontallyScroll</td>
<td>Defines whether the content can be scrolled horizontally. </td>
<td>定义内容是否可以水平滚动。</td>
</tr>
</tbody>
</table>


## More Information
## 更多信息

:::info
For the complete API documentation about this gesture recognizer, see [here](https://reference.avaloniaui.net/api/Avalonia.Input.GestureRecognizers/ScrollGestureRecognizer/).
有关此手势识别器的完整 API 文档,请参阅 [此处](https://reference.avaloniaui.net/api/Avalonia.Input.GestureRecognizers/ScrollGestureRecognizer/).
:::

:::info
View the source code on _GitHub_ [`ScrollGestureRecognizer.cs`](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs)
_GitHub_ 上查看源代码 [`ScrollGestureRecognizer.cs`](https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Input/GestureRecognizers/ScrollGestureRecognizer.cs)
:::
Loading

0 comments on commit 35cc6a0

Please sign in to comment.