5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Livetサンプル用、プロパティ定義コードスニペット

Last updated at Posted at 2015-02-22

#初めに
MVVMパターンのシンプルなサンプル(Livet + ReactiveProperty)を見て勉強したが、プロパティの定義が面倒。
このサンプルでは、「ReactiveProperty」を使えばもっと簡単にプロパティを定義できるのになぜかSampleを見るとSetのところが結構な行数を書かなければいけない。
Livet用のコードスニペットを作成した。
#サンプル

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
    xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Livet プロパティ作成</Title>
            <Shortcut>mylprop</Shortcut>
            <Description>NotificationObject のプロパティを作成</Description>
        </Header>
        <Snippet>
            <Declarations>
              <Object>
                <ID>Name</ID>
                <ToolTip>プロパティの名前で置き換える</ToolTip>
                <Default>PropName</Default>
              </Object>
              <Object>
                <ID>Type</ID>
                <ToolTip>プロパティの型を置き換える</ToolTip>
                <Default>int</Default>
              </Object>
            </Declarations>
            <Code Language="CSharp">
                <![CDATA[private $Type$ _$Name$; 
        public $Type$ $Name$
        { 
            get { return _$Name$; } 
            set 
            {  
                if (_$Name$ == value) 
                    return; 
                _$Name$ = value; 
                RaisePropertyChanged("$Name$"); 
            } 
        } ]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
5
6
2

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
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?