LoginSignup
8
8

More than 5 years have passed since last update.

Prism Template Packについてくるコードスニペット

Posted at

初めに

Visual Studioの拡張機能「Prism Template Pack」をインストールすると、Prism用のコードスニペットが付いてくるよという話。
コードスニペットというのは、例えばソースコードに「propp」を入力して、Tabキーを2回押下するとコードが自動挿入される機能なのです。

コードスニペット

propp

Property, with a backing field, that depends on BindableBase
更新通知が必要なプロパティを定義するときに使う。

private string fieldName;
public string PropertyName
{
    get { return fieldName; }
    set { SetProperty(ref fieldName, value); }
}

cmd

Creates a DelegateCommand property with private setter
DelegateCommandを定義するときに使う。

public DelegateCommand CommandNameCommand => new DelegateCommand(CommandName, CanCommandName);

ラムダ式の匿名メソッドで書きたい場合

public DelegateCommand CommandNameCommand => new DelegateCommand(() =>
{
    // ここにコマンド処理
});

とか。

cmdg

Creates a generic DelegateCommand property
パラメータ付きのDelegateCommandを定義するときに使う。

public DelegateCommand<string> CommandNameCommand => new DelegateCommand<string>(CommandName, CanCommandName);

ラムダ式の匿名メソッドで書きたい場合

public DelegateCommand<string> CommandNameCommand => new DelegateCommand<string>((p) =>
{
    // ここにコマンドの処理
});

とか。

ふむふむ。

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8