Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
mc:Ignorable="d"
Title="$itemname$">

<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>

<Grid>

</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $rootnamespace$
namespace $rootnamespace$;

/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class $safeitemname$ : Window
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class $safeitemname$ : Window
public $safeitemname$()
{
public $safeitemname$()
{
this.InitializeComponent();
}
this.InitializeComponent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ using namespace Microsoft::UI::Xaml;

namespace winrt::$rootnamespace$::implementation
{
int32_t $safeitemname$::MyProperty()
$safeitemname$::$safeitemname$()
{
throw hresult_not_implemented();
}

void $safeitemname$::MyProperty(int32_t /* value */)
int32_t $safeitemname$::MyProperty()
{
throw hresult_not_implemented();
}

void $safeitemname$::myButton_Click(IInspectable const&, RoutedEventArgs const&)
void $safeitemname$::MyProperty(int32_t /* value */)
{
myButton().Content(box_value(L"Clicked"));
throw hresult_not_implemented();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ namespace winrt::$rootnamespace$::implementation
{
struct $safeitemname$ : $safeitemname$T<$safeitemname$>
{
$safeitemname$()
{
// Xaml objects should not call InitializeComponent during construction.
// See https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent
}
$safeitemname$();

int32_t MyProperty();
void MyProperty(int32_t value);

void myButton_Click(IInspectable const& sender, Microsoft::UI::Xaml::RoutedEventArgs const& args);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
mc:Ignorable="d"
Title="$itemname$">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>

<Grid>

</Grid>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $rootnamespace$
namespace $rootnamespace$;

/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class $safeitemname$ : Page
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class $safeitemname$ : Page
public $safeitemname$()
{
public $safeitemname$()
{
this.InitializeComponent();
}
this.InitializeComponent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $rootnamespace$
namespace $rootnamespace$;

public sealed class $safeitemname$ : Control
{
public sealed class $safeitemname$ : Control
public $safeitemname$()
{
public $safeitemname$()
{
this.DefaultStyleKey = typeof($safeitemname$);
}
this.DefaultStyleKey = typeof($safeitemname$);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $rootnamespace$
namespace $rootnamespace$;

public sealed partial class $safeitemname$ : UserControl
{
public sealed partial class $safeitemname$ : UserControl
public $safeitemname$()
{
public $safeitemname$()
{
this.InitializeComponent();
}
this.InitializeComponent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,4 @@ namespace winrt::$rootnamespace$::implementation
{
throw hresult_not_implemented();
}

void $safeitemname$::myButton_Click(IInspectable const&, RoutedEventArgs const&)
{
myButton().Content(box_value(L"Clicked"));
}
}
2 changes: 0 additions & 2 deletions dev/VSIX/ItemTemplates/Neutral/CppWinRT/BlankPage/BlankPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace winrt::$rootnamespace$::implementation

int32_t MyProperty();
void MyProperty(int32_t value);

void myButton_Click(IInspectable const& sender, Microsoft::UI::Xaml::RoutedEventArgs const& args);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
<Grid>

</Grid>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,4 @@ namespace winrt::$rootnamespace$::implementation
{
throw hresult_not_implemented();
}

void $safeitemname$::myButton_Click(IInspectable const&, RoutedEventArgs const&)
{
myButton().Content(box_value(L"Clicked"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ namespace winrt::$rootnamespace$::implementation

int32_t MyProperty();
void MyProperty(int32_t value);

void myButton_Click(IInspectable const& sender, Microsoft::UI::Xaml::RoutedEventArgs const& args);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
<Grid>

</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $safeprojectname$
namespace $safeprojectname$;

public class Class1
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,31 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $safeprojectname$
namespace $safeprojectname$;

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public partial class App : Application
public App()
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}

/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}
this.InitializeComponent();
}

private Window? m_window;
/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}

private Window? m_window;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
mc:Ignorable="d"
Title="$projectname$">

<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $safeprojectname$
namespace $safeprojectname$;

/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
public MainWindow()
{
public MainWindow()
{
this.InitializeComponent();
}
this.InitializeComponent();
}

private void myButton_Click(object sender, RoutedEventArgs e)
{
myButton.Content = "Clicked";
}
private void myButton_Click(object sender, RoutedEventArgs e)
{
myButton.Content = "Clicked";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,31 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace $safeprojectname$
namespace $safeprojectname$;

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public partial class App : Application
public App()
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}

/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}
this.InitializeComponent();
}

private Window? m_window;
/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}

private Window? m_window;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
mc:Ignorable="d"
Title="$projectname$">

<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
Expand Down
Loading