Visual Studio Item Template
Visual Studio μμ μ½λλ₯Ό μμ±ν λ, νλ‘μ νΈμ μ νλͺ©μ μΆκ°νκ³ , ꡬνμ μμν©λλ€.
μ΄ λ, κΉ¨λνκ² λΉμμ Έ μλ μ½λ νμΌμ΄ μ’μ λλ μμ§λ§, λ°λ³΅μ μΌλ‘ μμ±νλ μ½λκ° ν¬ν¨λλ κ²½μ°λ μμ΅λλ€.
μλ₯Ό λ€μ΄, Xamarin Forms λ‘ λͺ¨λ°μΌ μμ©νλ‘κ·Έλ¨μ μμ±νλ νλ‘μ νΈλ₯Ό μμ μ€μΌ λ, Page μ ViewModel μ λ°λ³΅μ μΌλ‘ μΆκ°νκ³ , μμ±ν©λλ€.
Pageμ μ .xaml
<core:AppContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                        xmlns:d="http://xamarin.com/schemas/2014/forms/design"
                        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                        xmlns:local="clr-namespace:Kr.Bbon.Product"
                        xmlns:core="clr-namespace:Kr.Bbon.Core;assembly=Kr.Bbon.Core"
                        xmlns:behaviors="clr-namespace:Kr.Bbon.Core.Behaviors;assembly=Kr.Bbon.Core"
                        xmlns:converter="clr-namespace:Kr.Bbon.Core.Converters;assembly=Kr.Bbon.Core"
                        xmlns:viewmodel="clr-namespace:Kr.Bbon.Product.ViewModels"
                        xmlns:fa="clr-namespace:Kr.Bbon.Styles.FontAwesome;assembly=Kr.Bbon.Styles.FontAwesome"
                        xmlns:buttons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
                        xmlns:inputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
                        mc:Ignorable="d"
                        x:Class="Kr.Bbon.Product.Pages.SignUpPage"
                        x:TypeArguments="viewmodel:SignUpViewModel"
                        Title="{Binding Title}"
                        Shell.NavBarIsVisible="False"
                        NavigationPage.HasNavigationBar="False">
        <ContentPage.Resources>
        <converter:FirstValidationErrorConverter x:Key="firstValidationErrorCoverter" />
        <converter:ValidationResultHasErrorConverter x:Key="validationResultHasErrorConverter" />
    </ContentPage.Resources>
        <ContentPage.Content>
                <!-- νλ©΄μ μμ± -->
        </ContentPage.Content>
</core:AppContentPage> Page μ½λμ μ .xaml.cs
using Kr.Bbon;
using Kr.Bbon.Product.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Kr.Bbon.Product.Pages
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    [Route(RouteUri.SignUp)]
    public partial class SignUpPage : AppContentPage<SignUpViewModel>
    {
        public SignUpPage()
            : base()
        {
            InitializeComponent();
        }
    }
}ViewModel μ½λμ μ .cs
using Kr.Bbon.Core;
using Kr.Bbon.Core.Validations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace Kr.Bbon.Product.ViewModels
{
    public class SignUpViewModel : ViewModelBase
    {
                public SignUpViewModel() 
                        : base() 
                {
                }
    }
}μ νμ΄μ§ μμ μμ
- ν΄λμ€ νμΌμ μΆκ°ν©λλ€.
- ViewModel ν΄λμ€μ λ°λ³΅λλ μ½λλ₯Ό μμ±ν©λλ€.
- 컨ν νΈ νμ΄μ§ νμΌμ μΆκ°ν©λλ€.
- XML λ€μμ€νμ΄μ€λ₯Ό μΆκ°νκ³ , νμν λ΄μ©μ μΆκ°ν©λλ€.
- ViewModel ν΄λμ€λ₯Ό ꡬνν©λλ€.
- Page λ₯Ό ꡬνν©λλ€.
λ°λ³΅λλ λ΄μ©μ μμ±νκ³ μμΌλ©΄ λ§€μ° νΌκ³€ν©λλ€.
볡μ¬νκ³ λΆμ¬λ£κΈ°λ₯Ό λ°λ³΅νλ μμ
λ°λ³΅λλ μμ μ μ€μ΄κΈ° μν΄ μμ΄ν  ν νλ¦Ώμ λ§λ€μ΄μ μ¬μ©ν μ μμ΅λλ€.
Visual Studio μ νλ‘μ νΈ λ©λ΄μμ ν νλ¦Ώ λ΄λ³΄λ΄κΈ°κ° κ°λ₯ν©λλ€.
ν νλ¦Ώ λ΄λ³΄λ΄κΈ° λ©λ΄λ₯Ό μ¬μ©νλ©΄ λ§λ²μ¬ νμμΌλ‘ νλ‘μ νΈλ₯Ό ν νλ¦ΏμΌλ‘ λ§λ€ κ²μΈμ§, νλͺ©μ μμ΄ν  ν νλ¦Ώμ λ§λ€ κ²μΈμ§ μ νμ΄ κ°λ₯ν©λλ€.
μ΄λ κ² μμ΄ν
 ν
νλ¦Ώμ λ΄λ³΄λ΄λ©΄ μμ΄ν
 ν
νλ¦Ώ λλ ν°λ¦¬μ .zip νμΌμ΄ μΆκ°λμ΄μ Έ μμ΅λλ€.
π μμ΄ν  ν νλ¦Ώ λλ ν°λ¦¬λ Visual Studio μ΅μ μμ νμΈν μ μμ΄μ.
.zip νμΌμ μλ νλͺ©μ ν¬ν¨νκ³  μμ΅λλ€.
- __PreviewImage.png
μμ΄ν  ν νλ¦Ώ λ§λ²μ¬μμ μ§μ ν 미리보기 μ΄λ―Έμ§ νμΌ
- __TemplateIocn.png
μμ΄ν  ν νλ¦Ώ λ§λ²μ¬μμ μ§μ ν μμ΄μ½ μ΄λ―Έμ§ νμΌ
- MyTemplate.vstemplate
- κ·Έλ¦¬κ³ , μμ΄ν  ν νλ¦ΏμΌλ‘ λ΄λ³΄λ΄κΈ°ν νμΌ
π .vstemplate νμΌμ μ λ³΄λ λ°©λ²: νλͺ© ν
νλ¦Ώ λ§λ€κΈ° νμ΄μ§μ λ§ν¬λ€μμ νμΈν  μ μμ΄μ.
MyTemplate.vstemplate νμΌ
νΈμ§κΈ°λ‘ MyTemplate.vstemplate νμΌμ μ΄μ΄λ³΄λ©΄ μμ μ΄λ¦μΌλ‘ μ΄λ€ λ΄μ©μΈμ§ μ μ μμ΅λλ€.
TemplateData μμμ TemplateContent μμλ‘ κ΅¬μ±λμ΄μ Έ μμ΅λλ€.
TemplateData
ν νλ¦Ώ μ 보μ λλ€.
TemplateContent
μ νλͺ©μ μΆκ°ν λ νλ‘μ νΈμ μΆκ°λ νμΌλ€μ λͺ©λ‘μ λλ€.
λλ§μ ν νλ¦ΏμΌλ‘ λ³κ²½
μ¬κΈ°μλ Page μ ViewModel μ λμμ ν¬ν¨νλ μμ΄ν  ν νλ¦Ώμ μμ±νλ κ²μ λͺ©μ μΌλ‘ ν©λλ€.
μ μ½μ¬ν:
- Page μ ViewModelμ νλ‘μ νΈμ ν¬ν¨μν€κΈ° μν΄ νλ‘μ νΈ λ£¨νΈμμ νλͺ©μ μΆκ°ν΄μΌ ν©λλ€.
ν
νλ¦Ώμμ μ¬μ©λλ ν
νλ¦Ώ λ§€κ°λ³μ $rootnamespace$ κ° νμ¬ νλͺ©μ μΆκ°νλ μμΉλ₯Ό μ°Έμ‘°ν©λλ€.
- νμΌμ μ΄λ¦μ Page, ViewModel μ λ―Έμ΄λ₯Ό μ μΈν μ΄λ¦λ§ μ λ ₯ν©λλ€.
- νμΌμ΄λ¦μ ν΄λμ€ μ΄λ¦μΌλ‘ μ¬μ©κ°λ₯ν μλ¬Έμ λλ _ λ‘ μμνκ³ λ¬Έμ, μ«μ, _ λ§μΌλ‘ μ λ ₯ν©λλ€.
κΆμ₯μ¬ν:
- μμ΄ν  ν νλ¦ΏμΌλ‘ νλͺ©μ μΆκ°ν ν Page νμΌμ Pages λλ ν°λ¦¬λ‘, ViewModel νμΌμ ViewModels λλ ν°λ¦¬λ‘ μ΄λν΄μΌ ν©λλ€.
MyTemplate.vstemplate νμΌμ λ΄μ©
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
    <TemplateData>
    <DefaultName>Only name of page without postfix.xaml</DefaultName>
    <Name>Kr.Bbon.Product Xamarin Page with ViewModel</Name>
    <Description>Page and ViewModels Template with SyncFusion: Create on PROJECT ROOT then move Pages and ViewModels directory.</Description>
    <ProjectType>CSharp</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.png</Icon>
    <PreviewImage>__PreviewImage.png</PreviewImage>
    </TemplateData>
    <TemplateContent>
    <References />
    <ProjectItem SubType="Designer" TargetFileName="$fileinputname$Page.xaml" ReplaceParameters="true">Page.xaml</ProjectItem>
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$Page.xaml.cs" ReplaceParameters="true">Page.xaml.cs</ProjectItem>
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$ViewModel.cs" ReplaceParameters="true">ViewModel.cs</ProjectItem>
    </TemplateContent>
</VSTemplate>Page.xaml νμΌμ λ΄μ©
<?xml version="1.0" encoding="utf-8" ?>
<core:AppContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                        xmlns:d="http://xamarin.com/schemas/2014/forms/design"
                        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                        xmlns:local="clr-namespace:$rootnamespace$"
                        xmlns:core="clr-namespace:Kr.Bbon.Core;assembly=Kr.Bbon.Core"
                        xmlns:behaviors="clr-namespace:Kr.Bbon.Core.Behaviors;assembly=Kr.Bbon.Core"
                        xmlns:converter="clr-namespace:Kr.Bbon.Core.Converters;assembly=Kr.Bbon.Core"
                        xmlns:viewmodel="clr-namespace:$rootnamespace$.ViewModels"
                        xmlns:fa="clr-namespace:Kr.Bbon.Styles.FontAwesome;assembly=Kr.Bbon.Styles.FontAwesome"
                        xmlns:buttons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
                        xmlns:inputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
                        mc:Ignorable="d"
                        x:Class="$rootnamespace$.Pages.$fileinputname$Page"
                        x:TypeArguments="viewmodel:$fileinputname$ViewModel"
                        Title="{Binding Title}"
                        Shell.NavBarIsVisible="False"
                        NavigationPage.HasNavigationBar="False">
    <ContentPage.Resources>
        <converter:FirstValidationErrorConverter x:Key="firstValidationErrorCoverter" />
        <converter:ValidationResultHasErrorConverter x:Key="validationResultHasErrorConverter" />
    </ContentPage.Resources>
    <ContentPage.Content>
        <AbsoluteLayout HorizontalOptions="FillAndExpand"
                        VerticalOptions="FillAndExpand"
                        Padding="0">
            <ScrollView Orientation="Vertical"
                        AbsoluteLayout.LayoutBounds="1.0, 1.0, 1.0, 1.0"
                        AbsoluteLayout.LayoutFlags="All"
                        HorizontalOptions="FillAndExpand"
                        Padding="0, 0, 0, 0">
                <StackLayout Orientation="Vertical">
                <!-- Content here!! -->
                <Label Text="Hello Xamarin" />
                </StackLayout>
            </ScrollView>
            <StackLayout IsVisible="{Binding IsBusy}"
                            AbsoluteLayout.LayoutBounds="1.0, 1.0, 1.0, 1.0"
                            AbsoluteLayout.LayoutFlags="All"
                            HorizontalOptions="FillAndExpand"
                            VerticalOptions="FillAndExpand"
                            Orientation="Vertical"
                            BackgroundColor="#50000000">
                <ActivityIndicator HorizontalOptions="Fill"
                                    VerticalOptions="CenterAndExpand"
                                    IsRunning="True" />
            </StackLayout>
        </AbsoluteLayout>
    </ContentPage.Content>
</core:AppContentPage>Page.xaml.cs νμΌμ λ΄μ©
using Kr.Bbon.Core;
using $rootnamespace$.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace $rootnamespace$.Pages
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    [Route(RouteUri.$fileinputname$)]
    public partial class $fileinputname$Page : AppContentPage<$fileinputname$ViewModel>
    {
        public $fileinputname$Page()
            : base()
        {
            InitializeComponent();
        }
    }
}ViewModel.cs νμΌμ λ΄μ©
using Kr.Bbon.Core;
using Kr.Bbon.Core.Validations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace $rootnamespace$.ViewModels
{
    public class $fileinputname$ViewModel : ViewModelBase
    {
        #region CONSTANTS
        #endregion
        #region Constructors
        
        public $fileinputname$ViewModel()
            : base()
        {
            Title = "Title Here";
        }
        #endregion
        #region Commands
        #endregion
        #region Properties
        
        #endregion
        
        protected override void InitializeCommands()
        {
            // Initialize Commands
            base.InitializeCommands();
        }
        protected override void AddValidations()
        {
            base.AddValidations();
            // Add properties validation rule  
        }
        #region Methods
        #endregion
        #region Properties private fields 
        #endregion
        
        #region local variables
        #endregion
    }
}ν΄λΉ νμΌμ νλμ .zip νμΌλ‘ λ΄λ³΄λ΄κΈ° ν©λλ€.
.zip νμΌμ μλμ κ°μ΄ λͺ¨λ  νμΌμ ν¬ν¨νκ³  μμ΄μΌ ν©λλ€.
MyXamarin.PageWithViewMode.zip
- __PreviewImage.png
- __TemplateIcon.png
- MyTemplate.vstemplate
- Page.xaml
- Page.xaml.cs
- ViewModel.csμμ΄ν
 ν
νλ¦Ώ .zip νμΌμ μμ΄ν
 ν
νλ¦Ώ λλ ν°λ¦¬μ 볡μ¬ν©λλ€.
Visual Studio κ° μ€νμ€μ΄λ©΄ μ¬μμν΄μΌ μΆκ°λ μμ΄ν  ν νλ¦Ώμ μ½μ΄ λ€μ λλ€.
μλ£¨μ  νμκΈ° νΉμ νμΌ λ©λ΄μμ μ νλͺ© μΆκ° λ©λ΄λ₯Ό μμνλ©΄ μΆκ°ν μμ΄ν  ν νλ¦Ώμ μ νν μ μμ΅λλ€.
μ μ½μ‘°κ±΄μ λ§κ² μ¬λ°λ₯Έ μ΄λ¦μ μ λ ₯νκ³ μΆκ°νλ©΄ νλ‘μ νΈ λ£¨νΈ λλ ν°λ¦¬μ νμΌμ΄ μΆκ°λ©λλ€.
μ΄λ¦μ Hello λΌκ³ μ λ ₯νλ©΄, μλμ κ°μ΄ νμΌμ΄ λ§λ€μ΄ μ§λλ€.
- HelloPage.xaml
- HelloPage.xaml.cs
- HelloViewModel.csμ λ μ΄μ  Page λ Pages λλ ν°λ¦¬μ ViewModel μ ViewModels λλ ν°λ¦¬μμ κ΄λ¦¬νλ―λ‘ κ° λλ ν°λ¦¬λ‘ μ΄λ ν ꡬνμ μμνλ©΄ λ©λλ€.
 
         
         
        