CommunityToolkit / CommunityToolkit/MVVM-Samples

How to Implement Interface when using ObservableProperty & RelayCommand attributes?

Open
#100 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.4k
Forks
265
PR merge metrics
No merged PRs in 30d

Description

Hello,

Is there a sample showing how to implement an interface when using ObservableProperty & RelayCommand attributes? How would one implement the ISampleViewModel interface for SampleViewModel?

public partial class SampleViewModel : ObservableObject
{
[ObservableProperty]
ObservableCollection items;

[RelayCommand]
void IncrementCounter()
{
}
}

public interface ISampleViewModel
{
ObservableCollection Items { get; set; }

void IncrementCounterCommand();
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.