diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.cpp b/vsix/ItemTemplates/BlankPage/BlankPage.cpp index 9af284cec..7f8ecb177 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.cpp +++ b/vsix/ItemTemplates/BlankPage/BlankPage.cpp @@ -13,19 +13,4 @@ namespace winrt::$rootnamespace$::implementation { InitializeComponent(); } - - int32_t $safeitemname$::MyProperty() - { - throw hresult_not_implemented(); - } - - void $safeitemname$::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } - - void $safeitemname$::ClickHandler(IInspectable const&, RoutedEventArgs const&) - { - Button().Content(box_value(L"Clicked")); - } } diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.h b/vsix/ItemTemplates/BlankPage/BlankPage.h index f1dc903e8..542539eab 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.h +++ b/vsix/ItemTemplates/BlankPage/BlankPage.h @@ -1,5 +1,4 @@ #pragma once - #include "$safeitemname$.g.h" namespace winrt::$rootnamespace$::implementation @@ -7,11 +6,6 @@ namespace winrt::$rootnamespace$::implementation struct $safeitemname$ : $safeitemname$T<$safeitemname$> { $safeitemname$(); - - int32_t MyProperty(); - void MyProperty(int32_t value); - - void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.idl b/vsix/ItemTemplates/BlankPage/BlankPage.idl index 7930cbf8c..e85bbf418 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.idl +++ b/vsix/ItemTemplates/BlankPage/BlankPage.idl @@ -4,6 +4,5 @@ namespace $rootnamespace$ runtimeclass $safeitemname$ : Windows.UI.Xaml.Controls.Page { $safeitemname$(); - Int32 MyProperty; } } diff --git a/vsix/ItemTemplates/BlankPage/BlankPage.xaml b/vsix/ItemTemplates/BlankPage/BlankPage.xaml index c84ae2cb7..b8709a33c 100644 --- a/vsix/ItemTemplates/BlankPage/BlankPage.xaml +++ b/vsix/ItemTemplates/BlankPage/BlankPage.xaml @@ -2,12 +2,10 @@ x:Class="$rootnamespace$.$safeitemname$" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:$rootnamespace$" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:$rootnamespace$" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - + diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp index 9af284cec..7f8ecb177 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.cpp @@ -13,19 +13,4 @@ namespace winrt::$rootnamespace$::implementation { InitializeComponent(); } - - int32_t $safeitemname$::MyProperty() - { - throw hresult_not_implemented(); - } - - void $safeitemname$::MyProperty(int32_t /* value */) - { - throw hresult_not_implemented(); - } - - void $safeitemname$::ClickHandler(IInspectable const&, RoutedEventArgs const&) - { - Button().Content(box_value(L"Clicked")); - } } diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h index 7b994b1df..7b0b5b8d7 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.h @@ -1,5 +1,4 @@ #pragma once - #include "winrt/Windows.UI.Xaml.h" #include "winrt/Windows.UI.Xaml.Markup.h" #include "winrt/Windows.UI.Xaml.Interop.h" @@ -11,11 +10,6 @@ namespace winrt::$rootnamespace$::implementation struct $safeitemname$ : $safeitemname$T<$safeitemname$> { $safeitemname$(); - - int32_t MyProperty(); - void MyProperty(int32_t value); - - void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl index 8aed6d3f0..7c9ce4f16 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.idl @@ -4,6 +4,5 @@ namespace $rootnamespace$ runtimeclass $safeitemname$ : Windows.UI.Xaml.Controls.UserControl { $safeitemname$(); - Int32 MyProperty; } } diff --git a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml index ef60e5cd5..a5e469a15 100644 --- a/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml +++ b/vsix/ItemTemplates/BlankUserControl/BlankUserControl.xaml @@ -2,12 +2,12 @@ x:Class="$rootnamespace$.$safeitemname$" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:$rootnamespace$" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:$rootnamespace$" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - + + + diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.cpp b/vsix/ItemTemplates/ViewModel/ViewModel.cpp index af07f03db..1a725de7b 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.cpp +++ b/vsix/ItemTemplates/ViewModel/ViewModel.cpp @@ -4,15 +4,18 @@ #include "$safeitemname$.g.cpp" #endif +using namespace winrt; +using namespace Windows::UI::Xaml::Data; + namespace winrt::$rootnamespace$::implementation { - int32_t $safeitemname$::MyProperty() + event_token $safeitemname$::PropertyChanged(PropertyChangedEventHandler const& handler) { - throw hresult_not_implemented(); + return m_PropertyChanged.add(handler); } - void $safeitemname$::MyProperty(int32_t /*value*/) + void $safeitemname$::PropertyChanged(event_token token) noexcept { - throw hresult_not_implemented(); + m_PropertyChanged.remove(token); } } diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.h b/vsix/ItemTemplates/ViewModel/ViewModel.h index a5b640773..538712fe1 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.h +++ b/vsix/ItemTemplates/ViewModel/ViewModel.h @@ -1,5 +1,5 @@ #pragma once - +#include "winrt/Windows.UI.Xaml.Data.h" #include "$safeitemname$.g.h" namespace winrt::$rootnamespace$::implementation @@ -8,8 +8,10 @@ namespace winrt::$rootnamespace$::implementation { $safeitemname$() = default; - int32_t MyProperty(); - void MyProperty(int32_t value); + event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler); + void PropertyChanged(event_token token) noexcept; + private: + event m_PropertyChanged; }; } diff --git a/vsix/ItemTemplates/ViewModel/ViewModel.idl b/vsix/ItemTemplates/ViewModel/ViewModel.idl index 90819e2f1..3b97d52d0 100644 --- a/vsix/ItemTemplates/ViewModel/ViewModel.idl +++ b/vsix/ItemTemplates/ViewModel/ViewModel.idl @@ -2,9 +2,8 @@ namespace $rootnamespace$ { [bindable] [default_interface] - runtimeclass $safeitemname$ + runtimeclass $safeitemname$ : Windows.UI.Xaml.Data.INotifyPropertyChanged { $safeitemname$(); - Int32 MyProperty; } } diff --git a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h index 710be80ea..ba0a38df9 100644 --- a/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h +++ b/vsix/ProjectTemplates/VC/Windows Desktop/WindowsApplication/pch.h @@ -1,5 +1,4 @@ #pragma once - #include #ifdef GetCurrentTime #undef GetCurrentTime diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp index 8806e25cb..e090d9ede 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/App.cpp @@ -1,5 +1,4 @@ #include "pch.h" - #include "App.h" #include "MainPage.h" diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp index 5caaa46e6..2c7d66a7d 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.cpp @@ -4,6 +4,7 @@ using namespace winrt; using namespace Windows::UI::Xaml; +using namespace Windows::Foundation; namespace winrt::$safeprojectname$::implementation { @@ -17,7 +18,7 @@ namespace winrt::$safeprojectname$::implementation throw hresult_not_implemented(); } - void MainPage::MyProperty(int32_t /* value */) + void MainPage::MyProperty([[maybe_unused]] int32_t value) { throw hresult_not_implemented(); } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h index 96c433917..3e7bd2292 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.h @@ -1,5 +1,4 @@ #pragma once - #include "MainPage.g.h" namespace winrt::$safeprojectname$::implementation @@ -10,7 +9,6 @@ namespace winrt::$safeprojectname$::implementation int32_t MyProperty(); void MyProperty(int32_t value); - void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); }; } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml index f58acc558..2d2171804 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml +++ b/vsix/ProjectTemplates/VC/Windows Universal/BlankApp/MainPage.xaml @@ -1,13 +1,13 @@ - - + diff --git a/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp b/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp index 486e52df5..45cdf851c 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/CoreApp/App.cpp @@ -1,7 +1,6 @@ #include "pch.h" using namespace winrt; - using namespace Windows; using namespace Windows::ApplicationModel::Core; using namespace Windows::Foundation::Numerics; diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp index cc0146bad..15ae1bbd7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.cpp @@ -9,7 +9,7 @@ namespace winrt::$safeprojectname$::implementation throw hresult_not_implemented(); } - void Class::MyProperty(int32_t /* value */) + void Class::MyProperty([[maybe_unused]] int32_t value) { throw hresult_not_implemented(); } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h index f2ea96a0c..d07e3d3b7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/StaticLibrary/Class.h @@ -1,5 +1,4 @@ #pragma once - #include "Class.g.h" namespace winrt::$safeprojectname$::implementation diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp index cc0146bad..15ae1bbd7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.cpp @@ -9,7 +9,7 @@ namespace winrt::$safeprojectname$::implementation throw hresult_not_implemented(); } - void Class::MyProperty(int32_t /* value */) + void Class::MyProperty([[maybe_unused]] int32_t value) { throw hresult_not_implemented(); } diff --git a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h index f2ea96a0c..d07e3d3b7 100644 --- a/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h +++ b/vsix/ProjectTemplates/VC/Windows Universal/WindowsRuntimeComponent/Class.h @@ -1,5 +1,4 @@ #pragma once - #include "Class.g.h" namespace winrt::$safeprojectname$::implementation