Skip to content

Commit e01ff76

Browse files
Updated the sample and README file.
1 parent 085e17a commit e01ff76

28 files changed

+447
-1508
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
<Application
2-
x:Class="WinUIDemoApp.App"
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Application
3+
x:Class="SfDataGrid_Demo.App"
34
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
45
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:WinUIDemoApp">
6+
xmlns:local="using:SfDataGrid_Demo">
67
<Application.Resources>
8+
79
<ResourceDictionary>
810
<ResourceDictionary.MergedDictionaries>
911
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
10-
<!-- Other merged dictionaries here -->
12+
<!--Other merged dictionaries here-->
1113
</ResourceDictionary.MergedDictionaries>
12-
<!-- Other app resources here -->
14+
<!--Other app resources here-->
1315
</ResourceDictionary>
16+
1417
</Application.Resources>
1518
</Application>

DataGrid_PrintSpecificPages/App.xaml.cs

Lines changed: 15 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@
33
using System.IO;
44
using System.Linq;
55
using System.Runtime.InteropServices.WindowsRuntime;
6-
using Windows.ApplicationModel;
7-
using Windows.ApplicationModel.Activation;
8-
using Windows.Foundation;
9-
using Windows.Foundation.Collections;
106
using Microsoft.UI.Xaml;
117
using Microsoft.UI.Xaml.Controls;
128
using Microsoft.UI.Xaml.Controls.Primitives;
139
using Microsoft.UI.Xaml.Data;
1410
using Microsoft.UI.Xaml.Input;
1511
using Microsoft.UI.Xaml.Media;
1612
using Microsoft.UI.Xaml.Navigation;
13+
using Microsoft.UI.Xaml.Shapes;
14+
using Windows.ApplicationModel;
15+
using Windows.ApplicationModel.Activation;
16+
using Windows.Foundation;
17+
using Windows.Foundation.Collections;
1718

1819
// To learn more about WinUI, the WinUI project structure,
1920
// and more about our project templates, see: http://aka.ms/winui-project-info.
2021

21-
namespace WinUIDemoApp
22+
namespace SfDataGrid_Demo
2223
{
2324
/// <summary>
2425
/// Provides application-specific behavior to supplement the default Application class.
2526
/// </summary>
26-
sealed partial class App : Application
27+
public partial class App : Application
2728
{
2829
/// <summary>
2930
/// Initializes the singleton application object. This is the first line of authored code
@@ -32,72 +33,21 @@ sealed partial class App : Application
3233
public App()
3334
{
3435
this.InitializeComponent();
35-
this.Suspending += OnSuspending;
3636
}
3737

3838
/// <summary>
39-
/// Invoked when the application is launched normally by the end user. Other entry points
40-
/// will be used such as when the application is launched to open a specific file.
39+
/// Invoked when the application is launched.
4140
/// </summary>
42-
/// <param name="e">Details about the launch request and process.</param>
43-
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e)
41+
/// <param name="args">Details about the launch request and process.</param>
42+
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
4443
{
45-
Frame rootFrame = Window.Current.Content as Frame;
46-
47-
// Do not repeat app initialization when the Window already has content,
48-
// just ensure that the window is active
49-
if (rootFrame == null)
50-
{
51-
// Create a Frame to act as the navigation context and navigate to the first page
52-
rootFrame = new Frame();
53-
54-
rootFrame.NavigationFailed += OnNavigationFailed;
55-
56-
if (e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
57-
{
58-
//TODO: Load state from previously suspended application
59-
}
60-
61-
// Place the frame in the current Window
62-
Window.Current.Content = rootFrame;
63-
}
64-
65-
if (e.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
66-
{
67-
if (rootFrame.Content == null)
68-
{
69-
// When the navigation stack isn't restored navigate to the first page,
70-
// configuring the new page by passing required information as a navigation
71-
// parameter
72-
rootFrame.Navigate(typeof(MainPage), e.Arguments);
73-
}
74-
// Ensure the current window is active
75-
Window.Current.Activate();
76-
}
44+
m_window = new MainWindow();
45+
page = new Page();
46+
m_window.Activate();
7747
}
7848

79-
/// <summary>
80-
/// Invoked when Navigation to a certain page fails
81-
/// </summary>
82-
/// <param name="sender">The Frame which failed navigation</param>
83-
/// <param name="e">Details about the navigation failure</param>
84-
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
85-
{
86-
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
87-
}
49+
public static Window? m_window;
50+
public static Page? page;
8851

89-
/// <summary>
90-
/// Invoked when application execution is being suspended. Application state is saved
91-
/// without knowing whether the application will be terminated or resumed with the contents
92-
/// of memory still intact.
93-
/// </summary>
94-
/// <param name="sender">The source of the suspend request.</param>
95-
/// <param name="e">Details about the suspend request.</param>
96-
private void OnSuspending(object sender, SuspendingEventArgs e)
97-
{
98-
var deferral = e.SuspendingOperation.GetDeferral();
99-
//TODO: Save application state and stop any background activity
100-
deferral.Complete();
101-
}
10252
}
10353
}
-998 Bytes
Loading
-2.27 KB
Loading
-1.15 KB
Loading
-1010 Bytes
Loading
-972 Bytes
Loading
-995 Bytes
Loading
-1.08 KB
Loading

DataGrid_PrintSpecificPages/DataGrid_PrintSpecificPageDemo.csproj

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)