Skip to content

Commit

Permalink
docs: fix linting warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kazo0 committed Dec 4, 2023
1 parent a9fa834 commit 4663b51
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 30 deletions.
1 change: 1 addition & 0 deletions doc/helpers/FlipView-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ uid: Toolkit.Helpers.FlipViewExtensions
Provides additional features for `FlipView`.

## Attached Properties

Property|Type|Description
-|-|-
Next|FlipView| Sets the `FlipView` that should be moved to its next item
Expand Down
5 changes: 5 additions & 0 deletions doc/helpers/Input-extensions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
uid: Toolkit.Helpers.InputExtensions
---

# Input Extensions

Provides various attached properties for _input controls_, such as `TextBox` and `PasswordBox`.

## Attached Properties

Property|Type|Description
-|-|-
AutoDismiss|bool|Whether the soft-keyboard will be dismissed when the enter key is pressed.
Expand All @@ -14,11 +17,13 @@ AutoFocusNextElement|Control|Sets the next control to focus when the enter key i
AutoFocusNext and AutoFocusNextElement\*: Having either or both of the two properties set will enable the focus next behavior. AutoFocusNextElement will take precedences over AutoFocusNext when both are set.

### Remarks

- AutoFocusNext and AutoFocusNextElement have different focus target:
- AutoFocusNext is determined by `FocusManager.FindNextFocusableElement`
- AutoFocusNextElement is provided by the value.

## Usage

```xml
<!-- Include the following XAML namespace to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
Expand Down
3 changes: 3 additions & 0 deletions doc/helpers/Selector-extensions.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
uid: Toolkit.Helpers.SelectorExtensions
---

# Selector Extensions

Provides an easy integration between `PipsPager` and `Selector` controls.

## Attached Properties

Property|Type|Description
-|-|-
PipsPagerProperty|PipsPager| Backing property for the `PipsPager` that will interact with the `Selector` control.

When the `SelectorExtensions.PipsPager` is set, the control will take care of updating the `NumberOfPages` and the `SelectedIndex` properties automatically.

## Usage

```xml
<!-- Include the following XAML namespace to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
Expand Down
5 changes: 5 additions & 0 deletions doc/helpers/StatusBar-extensions.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
uid: Toolkit.Helpers.StatusBarExtensions
---

# StatusBar Extensions

Provides two attached properties on `Page` to controls the visual of the status bar on mobile platforms.

## Remarks

The attached properties do nothing on platforms other than iOS and Android.
For iOS, `UIViewControllerBasedStatusBarAppearance` should set to false in `info.plist`.

## Attached Properties

Property|Type|Description
-|-|-
Foreground|StatusBarForegroundTheme\*|Sets the foreground color for the text and icons on the status bar. Possible values are: `None, Light, Dark, Auto or AutoInverse`.
Expand All @@ -19,6 +23,7 @@ StatusBarForegroundTheme\*: `Auto` and `AutoInverse` will set the foreground in
- AutoInverse: dark/black in the dark mode, and light/white in the light mode

## Usage

```xml
<Page ...
xmlns:utu="using:Uno.Toolkit.UI"
Expand Down
4 changes: 4 additions & 0 deletions doc/helpers/TabBarItem-extensions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
uid: Toolkit.Helpers.TabBarItemExtensions
---

# TabBarItem Extensions

Provides additional features for `TabBarItem`.

## Attached Properties

Property|Type|Description
-|-|-
OnClickBehaviors|TBIOnClickBehavior\*|Backing property for the `TabBarItem` on-click behaviors when already selected.
Expand All @@ -18,6 +21,7 @@ TBIOnClickBehavior\*: Specifies the on-click behaviors of `TabBarItem`:
OnClickBehaviorsTarget\*: The content host which the on-click behavior is applied is either the target itself or one of its descendent (via deep first search) suitable for the behavior. When omitted, the parent of `TabBar` will serve as the target.

## Usage

```xml
<!-- Include the following XAML namespace to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
Expand Down
6 changes: 5 additions & 1 deletion doc/helpers/VisualStateManager-extensions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
uid: Toolkit.Helpers.VisualStateManagerExtensions
---

# VisualStateManager Extensions

Provides a way of manipulating the visual states of `Control` with attached property.

## Remarks

`VisualStateManager.GoToState` is typically used with `Control` where you would set `<VisualStateManager.VisualStateGroups>` on the root element of the ControlTemplate. Because this class is implemented using the same method, it means that if you are setting `StatesProperty` on an element, the `VisualStateManager.VisualStateGroups` should not be set on the very same element, but its first child:
```xml
<Page utu:VisualStateManagerExtensions.States="{Binding OnboardingState, Mode=OneWay}">
Expand All @@ -15,9 +18,11 @@ Provides a way of manipulating the visual states of `Control` with attached prop
<Grid>
<VisualStateManager.VisualStateGroups>...
```

This "first child" is more common known as the template root within the context of a `ControlTemplate` where you typically have a top-level `Grid`/`Border`/Panel with the x:Name that contains "Root".

## Attached Properties

Property|Type|Description
-|-|-
States|string|Sets the visual states of the control.\*
Expand Down Expand Up @@ -110,4 +115,3 @@ public class ViewModel : ViewModelBase
}
}
```

9 changes: 9 additions & 0 deletions doc/helpers/ancestor-itemscontrol-binding.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
---
uid: Toolkit.Helpers.Bindings
---

# AncestorBinding & ItemsControlBinding

These markup extensions provides relative binding based on ancestor type. If you are familiar with WPF, they are very similar to `{RelativeSource Mode=FindAncestor}`.

## Remarks

Both of the markup extensions are available for all **non-Windows** UWP platforms as well as all WinUI 3 platforms.

## AncestorBinding

This markup extension provides a mean to bind to an ancestor of a specific type.

### Properties

Property|Type|Description
-|-|-
AncestorType|Type|Type of ancestor to bind from.
Path|string|Binding path from the ancestor.

### Usage

```xml
<!-- Include the following XAML namespace to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
Expand All @@ -34,14 +40,17 @@ xmlns:utu="using:Uno.Toolkit.UI"
```

## ItemsControlBinding

This markup extension provides a binding to the closest parent ItemsControl. This markup can be used to access the parent ItemsControl from inside of the ItemTemplate.

### Properties

Property|Type|Description
-|-|-
Path|string|Binding path from the ancestor.

### Usage

```xml
xmlns:utu="using:Uno.Toolkit.UI"
...
Expand Down
19 changes: 12 additions & 7 deletions doc/helpers/command-extensions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
uid: Toolkit.Helpers.CommandExtensions
---

# Command Extensions

Provides Command/CommandParameter attached properties for common scenarios.

## Attached Properties

Property|Type|Description
-|-|-
Command|ICommand|Sets the command to execute when `TextBox`/`PasswordBox` enter key is pressed, `ListViewBase.ItemClick`, `NavigationView.ItemInvoked`, and `ItemsRepeater` item tapped.
Expand All @@ -14,6 +17,7 @@ Command on `TextBox`/`PasswordBox`\*: Having this set will also cause the keyboa
Command on `ListView`\*: [`IsItemClickEnabled`](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.listviewbase.isitemclickenabled) must also be set to true for this to work.

### Remarks

- For Command, the relevant parameter is also provided for the `CanExecute` and `Execute` call:
> Unless CommandParameter is set, which replaces the following.
- `TextBox.Text`
Expand All @@ -23,6 +27,7 @@ Command on `ListView`\*: [`IsItemClickEnabled`](https://docs.microsoft.com/en-us
- `ItemsRepeater`'s item root's DataContext

## Usage

```xml
<!-- Include the following XAML namespace to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
Expand All @@ -33,16 +38,16 @@ xmlns:utu="using:Uno.Toolkit.UI"

<!-- ListView item click-->
<ListView ItemsSource="123"
IsItemClickEnabled="True"
utu:CommandExtensions.Command="{Binding UpdateSelection}" />
IsItemClickEnabled="True"
utu:CommandExtensions.Command="{Binding UpdateSelection}" />

<!-- NavigationView item invoke -->
<NavigationView utu:CommandExtensions.Command="{Binding Navigate}">
<NavigationView.MenuItems>
<NavigationViewItem Content="Apple" />
<NavigationViewItem Content="Banana" />
<NavigationViewItem Content="Cactus" />
</NavigationView.MenuItems>
<NavigationView.MenuItems>
<NavigationViewItem Content="Apple" />
<NavigationViewItem Content="Banana" />
<NavigationViewItem Content="Cactus" />
</NavigationView.MenuItems>
</NavigationView>

<muxc:ItemsRepeater ItemsSource="123" utu:CommandExtensions.Command="{Binding UpdateSelection}" />
Expand Down
6 changes: 6 additions & 0 deletions doc/helpers/itemsrepeater-extensions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
uid: Toolkit.Helpers.ItemRepeaterExtensions
---

# ItemsRepeater Extensions

Provides selection support for `ItemsRepeater`.

## Attached Properties

Property|Type|Description
-|-|-
SelectedItem|object|Two-ways bindable property for the current/first(in Multiple mode) selected item.\*
Expand All @@ -14,6 +17,7 @@ SelectedIndexes|IList\<int>|Two-ways bindable property for the current selected
SelectionMode|ItemsSelectionMode|Gets or sets the selection behavior: `None`, `SingleOrNone`, `Single`, `Multiple` <br/> note: Changing this value will cause the `Selected-`properties to be re-coerced.

### Remarks

- `Selected-`properties only takes effect when `SelectionMode` is set to a valid value that is not `None`.
- `ItemsSelectionMode`: Defines constants that specify the selection behavior.
> Different numbers of selected items are guaranteed: None=0, SingleOrNone=0 or 1, Single=1, Multiple=0 or many.
Expand All @@ -23,6 +27,7 @@ SelectionMode|ItemsSelectionMode|Gets or sets the selection behavior: `None`, `S
- `Multiple`: The current item cannot be deselected.

## Usage

```xml
<!-- Include the following XAML namespaces to use the samples below -->
xmlns:utu="using:Uno.Toolkit.UI"
Expand All @@ -45,5 +50,6 @@ xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
```

### Remarks

- The selection feature from this extensions support ItemTemplate whose the root element is a `SelectorItem` or `ToggleButton`(which includes `Chip`).
- `RadioButton`: Multiple mode is not supported due to control limitation.
46 changes: 24 additions & 22 deletions doc/helpers/resource-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,38 @@ uid: Toolkit.Helpers.ResourceExtensions
This extension facilitates assigning a specific ResourceDictionary directly to a control's style. It simplifies [lightweight styling](../lightweight-styling.md) by eliminating the necessity to declare each resource on the page explicitly, enabling the easy creation of diverse visual elements with shared styles but varied attributes. The extension also supports the reuse of resource dictionaries across different control styles, enhancing consistency and efficiency in the UI design process.

## Attached Properties

Property|Type|Description
-|-|-
Resources|ResourceDictionary|Gets or sets the ResourceDictionary to be applied to the control's style

## Usage

Here is an example of how lightweight styling could be applied on a Button's style:

```xml
<Style x:Key="OverridenFilledButtonStyle"
TargetType="Button"
BasedOn="{StaticResource MaterialFilledButtonStyle}">
<Setter Property="utu:ResourceExtensions.Resources">
<Setter.Value>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="FilledButtonForeground"
Color="DarkGreen" />
<StaticResource x:Key="FilledButtonBackground"
ResourceKey="SystemControlTransparentBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="FilledButtonForeground"
Color="DarkGreen" />
<StaticResource x:Key="FilledButtonBackground"
ResourceKey="SystemControlTransparentBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Setter.Value>
</Setter>
TargetType="Button"
BasedOn="{StaticResource MaterialFilledButtonStyle}">
<Setter Property="utu:ResourceExtensions.Resources">
<Setter.Value>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="FilledButtonForeground"
Color="DarkGreen" />
<StaticResource x:Key="FilledButtonBackground"
ResourceKey="SystemControlTransparentBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="FilledButtonForeground"
Color="DarkGreen" />
<StaticResource x:Key="FilledButtonBackground"
ResourceKey="SystemControlTransparentBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Setter.Value>
</Setter>
</Style>
```

0 comments on commit 4663b51

Please sign in to comment.