Skip to content

Commit

Permalink
Merge branch 'docs' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
enisn committed Dec 18, 2024
2 parents 5353ebf + bfb87fd commit 407f0b5
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
Binary file added docs/en/images/dropdownfield-dark-windows.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en/images/dropdownfield-light-android.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions docs/en/themes/material/components/DropdownField.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# DropdownField
The DropdownField component is a control that allows users to select a single option from a dropdown list.

## Usage
DropdownField is included in the `UraniumUI.Material.Controls` namespace. You should add it to your XAML like this:

```xml
xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
```

Then you can use it like this:

```xml
<material:DropdownField Title="Pick an option" ItemsSource="{Binding Items}" />
```

| Light (Android) | Dark (Windows) |
| --- | --- |
| ![MAUI Material DropdownField](../../../images/dropdownfield-light-android.gif) | ![MAUI Material DropdownField](../../../images/dropdownfield-dark-windows.gif) |


## Icon
DropdownFields support setting an icon on the left side of the control. You can set the icon by setting the `Icon` property. The icon can be any `ImageSource` object. FontImageSource is recommended as Icon since its color can be changed when focused.

```xml
<material:DropdownField
Title="Pick an option"
ItemsSource="{Binding Items}"
Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static m:MaterialRegular.Expand_circle_down}}"
/>
```


> [!TIP]
> You can use any `ImageSource` object as Icon. But `FontImageSource` is recommended as it can change its color when focused.
> Refer to the [Icons Documentation](../../../theming/Icons.md) for more details on using icons.

## AllowClear
DropdownFields support clearing the selected item by setting the `AllowClear` property to `true`. Default value is `true`. You can make it `false` to disable clearing.

```xml
<material:DropdownField
Title="Pick an option (Clearable)"
ItemsSource="{Binding Items}"
AllowClear="True" />

<material:DropdownField
Title="Pick an option (Unclearable)"
ItemsSource="{Binding Items}"
AllowClear="False" />
```

## Validation
DropdownFields support validation rules. **SelectedItem**_(object)_ will be used to validate the control. You can set the `Validations` proeprty to add validation rules. Default

```xml
<material:DropdownField
Title="Pick an option"
ItemsSource="{Binding Items}"
Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static m:MaterialRegular.Expand_circle_down}}">
<material:DropdownField.Validations>
<validation:RequiredValidation />
</material:DropdownField.Validations>
</material:DropdownField>
```
7 changes: 5 additions & 2 deletions docs/en/themes/material/components/PickerField.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ PickerFields support setting an icon on the left side of the control. You can se
| --- | --- |
| ![MAUI Material PickerField](../../../../images/pickerfield-icon-light-android.gif) | ![MAUI Material PickerField](../../../../images/pickerfield-icon-dark-ios.gif) |

> [!TIP]
> You can use any `ImageSource` object as Icon. But `FontImageSource` is recommended as it can change its color when focused.
> Refer to the [Icons Documentation](../../../theming/Icons.md) for more details on using icons.
## AllowClear
PickerFields support clearing the selected item by setting the `AllowClear` property to `true`. Default value is `true`. You can make it `false` to disable clearing.

Expand Down Expand Up @@ -63,8 +67,7 @@ PickerField supports validation rules since it uses `object` as its **SelectedIt
ItemsSource="{Binding Items}"
Icon="{FontImageSource FontFamily=MaterialRegular, Glyph={x:Static m:MaterialRegular.Expand_circle_down}}">
<validation:RequiredValidation />
</material:PickerField

</material:PickerField>
```

![MAUI Material Picker Validation](../../../../images/pickerfield-validation-light-android.gif)
2 changes: 2 additions & 0 deletions docs/en/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
href: themes/material/components/EditorField.md
- name: AutoCompleteTextField
href: themes/material/components/AutoCompleteTextField.md
- name: DropdownField
href: themes/material/components/DropdownField.md
- name: PickerField
href: themes/material/components/PickerField.md
- name: MultiplePickerField
Expand Down

0 comments on commit 407f0b5

Please sign in to comment.