-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve bindings on tintcolor (#847)
* Added PropertyChanged sample * improved android * removed Tizen from attribute since it doesn't exist * improved iOS implementation * improved sample
- Loading branch information
Showing
5 changed files
with
81 additions
and
57 deletions.
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
18 changes: 16 additions & 2 deletions
18
samples/CommunityToolkit.Maui.Sample/ViewModels/Behaviors/IconTintColorBehaviorViewModel.cs
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 |
---|---|---|
@@ -1,5 +1,19 @@ | ||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
|
||
public class IconTintColorBehaviorViewModel : BaseViewModel | ||
namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors; | ||
|
||
public partial class IconTintColorBehaviorViewModel : BaseViewModel | ||
{ | ||
[RelayCommand] | ||
void Change() | ||
{ | ||
IsChanged = !IsChanged; | ||
} | ||
|
||
[ObservableProperty] | ||
[NotifyPropertyChangedFor(nameof(ChangedColor))] | ||
bool isChanged; | ||
|
||
public Color ChangedColor => IsChanged ? Colors.Red : Colors.Green; | ||
} |
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 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 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