Skip to content
Merged
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
Binary file added WinUI/.vs/WinUI_TreeGrid/v16/.suo
Binary file not shown.
9 changes: 9 additions & 0 deletions WinUI/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application
x:Class="WinUI_TreeGrid.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinUI_TreeGrid" RequestedTheme="Light">
<Application.Resources>

</Application.Resources>
</Application>
103 changes: 103 additions & 0 deletions WinUI/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;

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

namespace WinUI_TreeGrid
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <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();
this.Suspending += OnSuspending;
}

/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;

// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();

rootFrame.NavigationFailed += OnNavigationFailed;

if (e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}

// Place the frame in the current Window
Window.Current.Content = rootFrame;
}

if (e.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}

/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}

/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
Binary file added WinUI/Assets/Carter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Coolidge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Fillmore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Garfield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Grant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Hayes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Jackson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Johnson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Lincoln.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Monroe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Tyler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WinUI/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
212 changes: 212 additions & 0 deletions WinUI/EmployeeInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
using Microsoft.UI.Xaml.Data;
using Syncfusion.UI.Xaml.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WinUI_TreeGrid
{
public class Employee : NotificationObject
{
#region Private Fields

private static int _globalId = 0;
private int _id;
private string _firstName;
private string _lastName;
private double? _salary;
private string city;
private double _hike = 5;
private string _cityDescription;
private ObservableCollection<Employee> _children;


#endregion Private Fields

#region Public Properties

/// <summary>
/// Gets or sets the children.
/// </summary>
/// <value>The children.</value>
public ObservableCollection<Employee> Children
{
get
{
return _children;
}
set
{
_children = value;
}
}

/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public int Id
{
get
{
return _id;
}
set
{
_id = value;
}
}

/// <summary>
/// Gets or sets the first name.
/// </summary>
/// <value>The first name.</value>
public string FirstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
}
}

/// <summary>
/// Gets or sets the last name.
/// </summary>
/// <value>The last name.</value>
public string LastName
{
get
{
return _lastName;
}
set
{
_lastName = value;
}
}

/// <summary>
/// Gets or sets the Salary.
/// </summary>
/// <value>Salary</value>
public double? Salary
{
get { return _salary; }
set
{
_salary = value;
RaisePropertyChanged("Salary");
}
}
/// <summary>
/// Gets or sets the City.
/// </summary>
/// <value>City</value>

public string City
{
get { return city; }
set
{
city = value;
RaisePropertyChanged("City");
}
}

/// <summary>
/// Gets or sets the Country.
/// </summary>
/// <value>Country</value>
public string CityDescription
{
get
{
return _cityDescription;
}
set
{
_cityDescription = value;
RaisePropertyChanged("CityDescription");
}
}

private string contactNumber;

public string ContactNumber
{
get { return contactNumber; }
set
{
contactNumber = value;
RaisePropertyChanged("ContactNumber");
}
}
/// <summary>
/// Gets or sets the hike
/// </summary>
/// <value>The hike.</value>
public double Hike
{
get
{
return _hike;
}
set
{
_hike = value;
RaisePropertyChanged("Hike");
}
}

private bool isAvailable = false;

public bool IsAvailable
{
get { return isAvailable; }
set
{
isAvailable = value;
RaisePropertyChanged("IsAvailable");
}
}
#endregion

#region Constructors


/// <summary>
/// Initializes a new instance of the <see cref="EmployeeInfo"/> class.
/// </summary>
public Employee()
: this("Enter FirstName", "Enter LastName", false, 1, 78998, null)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="EmployeeInfo"/> class.
/// </summary>
/// <param name="firstName">The first name.</param>
/// <param name="lastName">The last name.</param>
/// <param name="eyecolor">The eyecolor.</param>
/// <param name="dob">The dob.</param>
/// <param name="maxGenerations">The max generations.</param>
public Employee(string firstName, string lastName, bool availablility, int id, double? sal, ObservableCollection<Employee> child)
{
FirstName = firstName;
LastName = lastName;
Salary = sal;
IsAvailable = availablility;
Id = id;
Children = child;
}

#endregion Constructors
}
}
49 changes: 49 additions & 0 deletions WinUI/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Page
x:Class="WinUI_TreeGrid.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinUI_TreeGrid"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="using:Syncfusion.UI.Xaml.TreeGrid"
xmlns:datagrid="using:Syncfusion.UI.Xaml.DataGrid"
xmlns:data="using:Syncfusion.UI.Xaml.Data"
xmlns:coreconverter="using:Syncfusion.UI.Xaml.Core.Converters"
xmlns:coreextension="using:Syncfusion.UI.Xaml.Core.Extensions"
mc:Ignorable="d" >
<Page.DataContext>
<local:EmployeeRepository/>
</Page.DataContext>

<Page.Resources>
<local:StringToImageConverter x:Key="ImageConverter" />
<DataTemplate x:Key="TemplateToolTip">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image Height="100" Width="100" Source="{Binding LastName,Converter={StaticResource ImageConverter}}" />
<TextBlock Grid.Row="1" Text="{Binding LastName}" HorizontalAlignment="Center"/>
</Grid>
</DataTemplate>
</Page.Resources>


<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<syncfusion:SfTreeGrid Name="treeGrid"
ColumnWidthMode="Star"
AutoExpandMode="RootNodesExpanded"
AutoGenerateColumns="False"
ChildPropertyName="Children"
ItemsSource="{Binding EmployeeDetails}" >
<syncfusion:SfTreeGrid.Columns>
<syncfusion:TreeGridTextColumn HeaderText="First Name" MappingName="FirstName" />
<syncfusion:TreeGridTextColumn HeaderText="Last Name" MappingName="LastName" ToolTipTemplate="{StaticResource TemplateToolTip}" ShowToolTip="True" />
<syncfusion:TreeGridTextColumn HeaderText="Person ID" MappingName="Id" ShowToolTip="True" />
<syncfusion:TreeGridHyperlinkColumn HeaderText="City Description" MappingName="CityDescription" />
<syncfusion:TreeGridCheckBoxColumn HeaderText="Availability" MappingName="IsAvailable" />
</syncfusion:SfTreeGrid.Columns>
</syncfusion:SfTreeGrid>
</Grid>
</Page>
Loading