-
Notifications
You must be signed in to change notification settings - Fork 460
[Menu] Add CheckedChanged EventCallback (fix 3390) #3414
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
Merged
vnbaaij
merged 9 commits into
microsoft:dev
from
rpodevns:feature/3390-menuitem-checked-changed
Feb 25, 2025
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
06549e9
[Menu] Add CheckedChanged EventCallback (fix 3390)
rpodevns edc599c
Merge branch 'dev' into feature/3390-menuitem-checked-changed
vnbaaij 15aefa0
[Menu] Add 2-way binding (fix 3390)
rpodevns 01ef18c
[Menu] Add CheckedChanged EventCallback (fix 3390)
rpodevns c96b7b6
[Menu] Add 2-way binding (fix 3390)
rpodevns 5e87d65
[Menu] fixed typos and changed properties to fields in sample
rpodevns b73edde
Resolved merge conflicts
rpodevns 1d6d2e7
Merge branch 'dev' into feature/3390-menuitem-checked-changed
vnbaaij 3814831
Merge branch 'dev' into feature/3390-menuitem-checked-changed
vnbaaij 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 hidden or 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 contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1 @@ | ||
| ο»Ώ | ||
|
|
||
|
|
||
| ο»Ώ |
98 changes: 98 additions & 0 deletions
98
examples/Demo/Shared/Pages/Menu/Examples/MenuCheckChanged.razor
This file contains hidden or 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,98 @@ | ||
| ο»Ώ | ||
| <FluentStack Orientation="Orientation.Vertical" VerticalGap="40"> | ||
|
|
||
| <FluentStack Orientation="Orientation.Vertical" VerticalGap="10"> | ||
|
|
||
| <FluentLabel Typo="Typography.H5">Role=MenuItemCheckbox</FluentLabel> | ||
| <FluentMenu Open="true" OnCheckedChanged="HandleCheckedChanged"> | ||
|
|
||
| <FluentMenuItem Id="ck1" Role="MenuItemRole.MenuItemCheckbox" @bind-Checked=checkbox1> | ||
| Checkbox MenuItem 1 is @(checkbox1 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="ck2" Role="MenuItemRole.MenuItemCheckbox" @bind-Checked=checkbox2> | ||
| Checkbox MenuItem 2 is @(checkbox2 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| </FluentMenu> | ||
|
|
||
| <FluentButton Appearance="Appearance.Accent" OnClick="ToggleCheckboxItem2">Toggle checkbox item 2</FluentButton> | ||
|
|
||
| </FluentStack> | ||
|
|
||
| <FluentStack Orientation="Orientation.Vertical" VerticalGap="10"> | ||
|
|
||
| <FluentLabel Typo="Typography.H5">Role=MenuItemRadio</FluentLabel> | ||
| <FluentMenu Open="true" OnCheckedChanged="HandleCheckedChanged"> | ||
|
|
||
| <FluentMenuItem id="radio1" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio1> | ||
| Radio 1 is @(radio1? "Checked" : "Unchecked" ) | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="radio2" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio2> | ||
| Radio 2 is @(radio2 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="radio3" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio3> | ||
| Radio 3 is @(radio3 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentDivider/> | ||
|
|
||
| <FluentMenuItem id="radio4" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio4> | ||
| Radio 4 is @(radio4 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="radio5" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio5> | ||
| Radio 5 is @(radio5 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="radio6" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio6> | ||
| Radio 6 is @(radio6 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="radio7" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio7> | ||
| Radio 7 is @(radio7 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| <FluentMenuItem Id="radio8" Role="MenuItemRole.MenuItemRadio" @bind-Checked=radio8> | ||
| Radio 8 is @(radio8 ? "Checked" : "Unchecked") | ||
| </FluentMenuItem> | ||
|
|
||
| </FluentMenu> | ||
|
|
||
| <FluentButton Appearance="Appearance.Accent" OnClick="ToggleRadioItem6">Toggle radio item 6</FluentButton> | ||
|
|
||
| </FluentStack> | ||
|
|
||
| </FluentStack> | ||
|
|
||
| @code { | ||
|
|
||
| private bool checkbox1 = false; | ||
| private bool checkbox2 = false; | ||
|
|
||
| private bool radio1 { get; set; } = false; | ||
| private bool radio2 { get; set; } = false; | ||
| private bool radio3 { get; set; } = false; | ||
| private bool radio4 { get; set; } = false; | ||
| private bool radio5 { get; set; } = false; | ||
| private bool radio6 { get; set; } = false; | ||
| private bool radio7 { get; set; } = false; | ||
| private bool radio8 { get; set; } = false; | ||
|
|
||
| private void ToggleCheckboxItem2() | ||
| { | ||
| checkbox2 = !checkbox2; | ||
| } | ||
|
|
||
| private void ToggleRadioItem6() | ||
| { | ||
| radio6 = !radio6; | ||
| } | ||
|
|
||
| private void HandleCheckedChanged(FluentMenuItem item) | ||
| { | ||
| DemoLogger.WriteLine(@$"{item.Id} {(item.Checked ? "Checked" : "Unchecked")}"); | ||
| } | ||
| } |
This file contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.