-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Docs #110
Merged
Merged
Update Docs #110
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
layout: control | ||
name: CheckBox | ||
group: controls | ||
--- | ||
[CheckBox]: https://avaloniaui.net/docs/controls/checkbox | ||
[CheckBox API]: https://avaloniaui.net/api/Avalonia.Controls/CheckBox/ | ||
[CheckBox.fs]: https://github.com/AvaloniaCommunity/Avalonia.FuncUI/blob/master/src/Avalonia.FuncUI.DSL/CheckBox.fs | ||
|
||
> *Note*: You can check the Avalonia docs for the [CheckBox] and [CheckBox API] if you need more information. | ||
> | ||
> For Avalonia.FuncUI's DSL properties you can check [CheckBox.fs] | ||
|
||
The checkbox is a control that allows a user to represent boolean values or the absense of a value | ||
|
||
## Usage | ||
|
||
**Set Label** | ||
```fsharp | ||
CheckBox.create [ | ||
Checkbox.content "I Accept the terms and conditions." | ||
] | ||
``` | ||
|
||
**Set Is Checked** | ||
|
||
```fsharp | ||
CheckBox.create [ | ||
// can be either true or false | ||
Checkbox.isChecked state.booleanValue | ||
] | ||
``` | ||
|
||
**Set Indeterminate** | ||
```fsharp | ||
CheckBox.create [ | ||
// can be either true or false | ||
CheckBox.isThreeState state.indeterminate | ||
// this value is required to be either a nullable boolean | ||
// or a boolean option | ||
Checkbox.isChecked None | ||
] | ||
``` | ||
> To be able to set the indeterminate state, the `isThreeState` value must be true and the `isChecked` value must be None or Nullable boolean set to null | ||
|
||
**Set Dynamic State Checkbox** | ||
|
||
You can mix and match the three states of a checkbox. In this example | ||
if the count value is greater than 0 the box will be checked, if the value is 0 then it will be indeterminate lastly if the value is less than 0 it will be unchecked | ||
```fsharp | ||
let isChecked = | ||
if state.count = 0 then | ||
None | ||
else if state.count > 0 then | ||
Some true | ||
else | ||
Some false | ||
|
||
CheckBox.create [ | ||
CheckBox.content "Dynamic CheckBox" | ||
// this is not required | ||
Checkbox.isEnabled false | ||
CheckBox.isThreeState (state.count = 0) | ||
CheckBox.isChecked isChecked | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
layout: control | ||
name: DatePicker | ||
group: controls | ||
--- | ||
[DatePicker API]: https://avaloniaui.net/api/Avalonia.Controls/DatePicker/ | ||
[DatePicker.fs]: https://github.com/AvaloniaCommunity/Avalonia.FuncUI/blob/master/src/Avalonia.FuncUI.DSL/Calendar/DatePicker.fs | ||
[Custom date and time format strings]: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings/ | ||
[DatePickerFormat]: http://avaloniaui.net/api/Avalonia.Controls/DatePickerFormat/ | ||
|
||
> *Note*: You can check the Avalonia docs for the [DatePicker API] if you need more information. | ||
> | ||
> For Avalonia.FuncUI's DSL properties you can check [DatePicker.fs] | ||
|
||
The DatePicker control is a single date picker that displays a calendar, it is also posible to enter a date via the TextBox the control has | ||
|
||
## Usage | ||
|
||
**Set Date** | ||
```fsharp | ||
DatePicker.create [ | ||
DatePicker.selectedDate DateTime.Today | ||
] | ||
``` | ||
|
||
**Set DateFormat** | ||
```fsharp | ||
DatePicker.create [ | ||
DatePicker.selectedDateFormat DatePickerFormat.Long | ||
] | ||
|
||
DatePicker.create [ | ||
DatePicker.selectedDateFormat DatePickerFormat.Short | ||
] | ||
|
||
DatePicker.create [ | ||
DatePicker.selectedDateFormat DatePickerFormat.Custom | ||
// It can be any valid DateFormat string | ||
DatePicker.customDateFormatString "MMMM dd, yyyy" | ||
] | ||
``` | ||
> For more information about the DatePickerFormat check [DatePickerFormat] | ||
|
||
>You can check [Custom date and time format strings] Microsoft docs for more information about the format string | ||
|
||
**Set Start Display Date** | ||
|
||
Sets the first date available to display | ||
```fsharp | ||
let startFromYesterday = | ||
DateTime.Today.Subtract(TimeSpan.FromDays(1.0)) | ||
DatePicker.create [ | ||
DatePicker.displayDateStart startFromYesterday | ||
] | ||
``` | ||
|
||
**Set End Display Date** | ||
|
||
Sets the last date available to display | ||
```fsharp | ||
let showUpToTomorrow = | ||
DateTime.Today.Add(TimeSpan.FromDays(1.0)) | ||
DatePicker.create [ | ||
DatePicker.displayDateStart showUpToTomorrow | ||
] | ||
``` | ||
|
||
**Set Watermark** | ||
|
||
Sets the watermark (placeholder) for the TextBox that is included in this control | ||
```fsharp | ||
DatePicker.create [ | ||
DatePicker.watermark "Select a date" | ||
] | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
/false
ornull
right ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played a little bit with this yesterday it seems you need to have both
isThreeState
in true andisChecked
in null (None or nullable bool set to null) for it to work or else it will show as unselected (isChecked
false) it's a bit weird actually