Top Windows 10 UWP App Development Interview Questions (C# - Xaml) - Part One

Introduction:

In this first part, I am going to explain nearly fifty Windows 10 Universal Windows Platform(UWP) app development questions. And in the next part I will introduce more advanced UWP questions. Please correct me if any questions have any mistakes in their content and also please note that for accuracy purposes, I adapted some content from MSDN .

Image Source: MSDN 
 
1. What is Universal App Development?

From Windows Phone 8.1 OS, Microsoft introduces an important change in the Windows Phone developer ecosystem called universal app concept. In this release, Windows Phone converges with the Windows Store apps platform into a single developer platform that runs the same types of apps, i.e, Windows Runtime apps. Windows Phone and Windows Store app developer platforms truly have become one, single development platform.

Ina  single world, Universal app is a single development platform for windows phone and windows store apps.

2. What is Windows store App?

A Windows Store app (former "Metro-style app") is a new type of application that only runs on Windows Tablets. A Windows Store app resembles the apps that are run on smartphones. The user interface is very different compared to traditional desktop app user interfaces, and without a touchscreen they can sometimes be more difficult to use than a desktop app. The biggest advantage of a Windows Store app is when it's used on a tablet computer or on a laptop computer with touch sensitive screen - then it can use its full potential.

3. What is Windows App store?

Windows store is the place where you can Install/purchase apps for Windows and windows phone devices. In order to get any Windows/WindowsPhone apps, including free apps from windows store, you’ll be prompted to set up a Microsoft account, or use your existing Microsoft email to start using Windows store apps. Once you set up an account with an email and password, you can start using the Windows app store.

For more info following details are major mobility platform store places:

a. Windows Phone/Windows
: Windows Store
b. Android: Google Play
c. IOS/iPhone: Apple store

4. Silverlight windows phone vs WinRT windows phone?
  • Windows Phone 7, Windows Phone 8 & Windows Phone 8.1 (Targeting Silverlight) uses Silverlight API's. And how Windows Phone 8 & Windows Phone 8.1 relate to Silverlight, well they use the Silverlight API's that are available for mobile application framework.

  • Windows 8 & Windows 8.1 both target WinRT API's. And Windows Phone 8.1 also support WinRT API's. So, if you want to create Windows 8.1 & Windows Phone 8.1 applications you can do that by creating a Universal application targeting both the platforms (They have convergence of 90%).
5. What is UWP?


Image Source: blogs.windows.com
 
From windows 10 OS Microsoft introduces a major change in mobility platform called Universal Windows Platform (UWP) which is available across all Windows device families(Mobile,Desktop,Xbox,Surface Hub, Holographic, IOT..etc), you can reach all these devices and look great on them all using one store and one code base.

6. What is UAP & UWP, Is there any difference?

UAP is stands for Universal App Platform and UWP stands for Universal Windows Platform. Both are meant forthe same thing that will enable Windows 10 developers to write one app for 'All Windows Platform family devices.'

7. What are the major development differences between WinRT universal app & Windows 10 UWP?

There are so many improvements on Unviersal Windows app development for Windows 10 from the Windows 8.1 experience.
  • Previously in windows 8.1 universal app project, we needed to create two different app packages (.APPX) for windows phone & Windows, but now no more than one app package and we can use only one app package that can run across all Microsoft platforms (Mobile,Desktop,Xbox,Surface Hub, Holographic, IOT..etc).

  • Now there's no need to create two separate projects for windows phone and windows, with windows 10 sdk now build one Universal Windows app that runs on all Windows 10 devices.

  • We no longer need a developer license with Windows 10. But we must Enable Developer Mode to your device for development.
8. Can Windows 10 SDK work with below OS versions like Windows 8.1/Windows 8.0/Windows 7..etc?

Yes, but windows 10 SDK (Which is available with Visual Studio 2015 update 1 or later IDE) works best on the Windows 10 operating system and it is also supported on: Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2, but not all tools are supported on these operating systems.

9. LifeCycle Of windows store apps:

Life-Cycle means a specific sequence of the application from start to finish of the application. 



So there are four important states in the life cycle of a Windows Store app. They are as follows:

a. Not Running:


In this state an application is not running at all. An application might go into this state due to various reasons. For example, a user might have just installed the application but has never launched it. Another possibility is that a user might have ended the application using the Task Manager or might have just restarted the computer.This state is helpful in preparing the initial UI of your application.

b. Running:


When user launchesan app from app list, then it changes its state from Not Running to Running. Such an app is the one that the user is interacting with at a given point of time and the OS has allocated required resources for it.

c. Suspended:

The OS suspends your app whenever the user switches to another app or to the desktop or Start screen. In this state an app in the Running state can enter the Suspended state

d. Terminated:

If there are no adequate system resources, the OS may terminate a suspended app in which case it will enter the Terminate state.


10. What is Suspension Manager in Windows Phone 8.1?

It is a kind of helper class and provides the necessary properties and methods to load and store the state when the windows phone store app is terminated.

Note:

This class is automatically added to the solution if we use the Hub App, Grid App, and Split App project template or add to an existing project a BasicPage or any other Page item template other than BlankPage.


11. What are the Programming Languages for Windows App Development?

Preferred languages on priority based:
  • C# & Xaml (Native or Xamarin cross platform)
  • Visual Basic
  • Visual C++/CX(CX is the component extensions to the C++ language)
  • HTML5 , JavaScript and CSS (Using Cordova, phonegap..etc)
12. What is Package.appxmanifest file in WinRT windowsphone 8.1?

From WinRT windowsphone 8.1 sdk, old windowsphone 8.0 "WMAppManifest.xml" file is renamed to "Package.appxmanifest" which is very similar to the Windows Store apps . Package.appxmanifest is xml file that included all info of our application such as targeted app OS version, App display name, App icons, apability permissions to run app, Start page to be App launch..etc .

13. What are the differences between .Xap and .Appx Package file?

To sell or distribute your Windows Phone/ Windows Store app to other users, you need to create and build a package for them. So Silverlight Windows phone app can generate .xap packages which is part of the normal build process. And they don’t have a separate packaging step.
When we run the Windows Store app, during the compilation process the app package will be installed with file extension of app package(.appx) which will contain all the necessary packages to deploy to devices with each processor architecture.

Framework Visual Studio Project TypePackage TypePackage Built
SilverlightWindows Phone Silverlight 8.0XapWith project
Windows Phone Silverlight 8.1XapWith project
UniversalWindows 8.1AppxBy Store menu
Windows Phone 8.1AppxBy Store menu
SharedN/AN/A

14. What are the different architecture configurations for creating packages in Windows 10 UWP App?
  • x86(32 bit processors, emulator )
  • x64(64 bit processors, emulator)
  • ARM ( It is for RT device)
  • Neutral(all architectures.)
15. What is Sideload of app package?

With UWP app packages, you cannot simply install an app to your device like Desktop apps. Typically, you download these apps from the Store and that is how they are installed on your device. But you can sideload apps to your device without submitting them to the Store. This lets you install them and test them out using the app package (.appx) that you have created. If you have an app that you don’t want to sell in the Store, like a line-of-business (LOB) app, you can sideload that app so that other users in your company can use it.

16. what is maximum size of .Appx file?
  • .appxbundle: 25 GB maximum per bundle
  • .appx packages targeting Windows 8.1: 8 GB maximum per package
  • .appx packages targeting Windows 8: 2 GB maximum per package
  • .appx packages targeting Windows Phone 8.1: 4 GB maximum per package
  • .xap packages: 1 GB maximum per package (in silverlight windows phone).
17. What are prerequisites to deploy .AppX file?

Make sure to enable developer mode for windows 10 devices, before .appx deployment. Otherwise you will get below error
"Error : DEP0001 : Unexpected Error: To install this application you need either a Windows developer license or a sideloading-enabled system. (Exception from HRESULT: 0x80073CFF)"

Step to enable Developer Mode:

Go into the Settings of a Windows 10 phone device and search for Update & Security category and turn on Developer Mode.

18. How to get the device platform on Windows 10 UWP App?

From Windows 10, now no more than one app package and we can use only one binary package that can run across all Microsoft platforms (Mobile,Desktop,Xbox,Surface Hub, Holographic, IOT..etc). So you might want to get the device platform type from your app using C#. And you can use the DeviceFamily property defined in the Windows.System.Profile.AnalyticsInfo.VersionInfo class.
  1. public void GetPlatformType()  
  2. {  
  3.     var WindowsPlatformFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;  
  4.      }   
19. What are the different application running modes in Windows App Development?

When you compile an application, you usually choose between below two modes:

Debug:

Debug mode pads the executable file with extra information used for debugging purpose. After your application is bug-free and feature-complete, there's no longer any need to keep the debug information.

Release:

Compiling in Release mode gives you a more compact (and even slightly faster) executable that doesn't include unnecessary internal debugging symbols

Note:

Before submitting our windows app to the windows store, you need to set target platform as ARM while creating .APPX in release mode because mobile phone has ARM processors so they will need .APPX build on ARM configuration. x86, X64 is for emulators only.

20. What is App package manifest in UWP?

The package manifest is an XML document that contains the info the system needs to deploy, display, or update a Windows app. This info includes package identity, package dependencies, required capabilities, visual elements, and extensibility points. Every app package must include one package manifest.

21. What is the difference between GridView and ListView in Windows App Development?
  • The ListView and GridView controls are so similar, you can think of them as a single control. The major difference between the two is the manner in which they lay out their items, and it’s easy to change the layout so each control emulates the other.

  • The ListView control displays its data stacked vertically, much like a standard list box. Use this control to display an ordered list of data, like a list of email messages, a list of contacts, or search results.

  • The GridView control displays its data stacked horizontally in rows (although you can alter this behavior and have it displayed in columns first, as well). You use this control when you need more space for rich visualization of each item to be displayed.

  • The item container for a ListView is ListViewItem and the item container for a GridView is GridViewItem. But we can customize item container by setting the ItemContainerStyle property.
22. What is CollectionViewSource in Windows App?

CollectionViewsSource is XAML markup, it can group all data list objects and bind them to the corresponding controls all in XAML. It has a property called Source that defines the collection of objects or data to bind to the control which is usually set it in code(C#) behind.

23. What is VisualStateManager in Windows 10 UWP?

In Windows 10, the VisualStateManager class has two new mechanisms with the help of which you can implement a responsive design in your UWP applications. And it is used to define, manage, and transition between different states of controls on a page.

VisualStateGroup:


It is having group of Visual States, where each VisualState has a name that is representative of a UI state that can be changed by the user, or changed by control logic. A VisualState consists mainly of a Storyboard. 

GoToState:

GoToState method is very useful to manage/transition between Visual States. When we call GoToState to change the visual state of a control, VisualStateManager can determined whether a state that matches stateName exists.If exist,corresponding storyboard will begins and If not exist, nothing happens and the method returns false.

24. What does StateTriggers in Windows 10 UWP?

StateTriggers is property of VisualState, which can define a rule in Xaml that specifies when a particular VisualState is to be applied. And it allows the developer to check certain conditions like the window height or window width and then the VisualState.Setters property defines visual states in response to those certain conditions.

25. What does AdaptiveTrigger in Windows 10 UWP?

AdaptiveTrigger can help you create a dynamic responsive UI based on the height or width of the device or screen. It has two important properties: MinWindowWidth and MinWindowHeight.

XAML
  1. <Page>  
  2.     <Grid>  
  3.         <VisualStateManager.VisualStateGroups>  
  4.             <VisualStateGroup>  
  5.                 <VisualState>  
  6.                     <VisualState.StateTriggers>  
  7.                     <!--VisualState to be triggered when window width is >=750 and windows height is >=900 effective pixels.-->  
  8.                         <AdaptiveTrigger MinWindowWidth="750" MinWindowHeight="900" />  
  9.                     </VisualState.StateTriggers>  
  10.   
  11.                     <VisualState.Setters>  
  12.                         <Setter Target="myPanel.Orientation" Value="Horizontal" />  
  13.                     </VisualState.Setters>  
  14.                 </VisualState>  
  15.             </VisualStateGroup>  
  16.         </VisualStateManager.VisualStateGroups>  
  17.         <StackPanel x:Name="myPanel" Orientation="Vertical">  
  18.             <TextBlock Text="text block 1. "/>  
  19.             <TextBlock Text="text block 2. "/>  
  20.             <TextBlock Text="text block 3. " />  
  21.         </StackPanel>  
  22.     </Grid>  
  23. </Page>  
From above code, StateTriggers property with an AdaptiveTrigger to create a declarative rule in XAML markup based on window size. By default, the StackPanel orientation is Vertical. When the window width is >= 750 and the windows height is >=900 effective pixels, the VisualState change is triggered, and the StackPanel orientation is changed to Horizontal.

26. Can it possible to make Custom Triggers in UWP?

Yes we can create our own triggers by creating a custom class inheriting from StateTriggerBase. Custom triggers help the developers to change the state of the Visual state of the App based on certain conditions like App size changes and change the controls to fit in to the app’s layout and need to change the controls sizes when the user uses the app in either mouse mode or touch mode and so on.

27. What is RelativePanel in Windows 10 UWP?

The RelativePanel eases the process of rearranging elements by defining relationships between elements, which allows you to build more dynamic UI without using nested layouts.

28. What is SplitView control in Windows 10 UWP?

The new SplitView control gives you a way to easily show and hide transient content. It’s commonly used for top-level navigation scenarios like the "hamburger menu", where the navigation content is hidden, and slides in when needed as the result of a user action.
29. What does URI schemes?

You can use URI (Uniform Resource Identifier) schemes to refer to app files that come from the app's package, data folders, or resources.
general form of URI scheme in WinRT,
  1. <scheme>://<domain name>/<path>  
Some of examples:

a. App package: (ms-appx: & ms-appx-web:)

To access files from your application package, you can use either a direct or a logical file path to refer to the resource.

some of examples:
  • "ms-appx:///images/logo.png"
  • "ms-appx-web:///assets/text.html"
b. App data: (ms-appdata://)

To access files stored in the app data, use the ms-appdata: scheme. App data may be stored in a local folder, a roaming folder, or a temp folder.
some of examples:
  1.   //Local folder    
  2.   <Image Source="ms-appdata:///local/images/logo.png" />    
  3.       
  4.   //Roaming folder    
  5.   <Image Source="ms-appdata:///roaming/images/logo.png" />    
  6.       
  7.   //Temp folder    
  8.   <Image Source="ms-appdata:///temp/images/logo.png" />    
c. App Resource: (ms-resource:)

Assuming MyImage.png is content (not embedded resource) in your MyAssembly it would be like this:
>
30. How to load local html files using WebView control in Windows 10 UWP App

WebView control loads the html content from the application’s package using ms-appx-web:// using network http/https. We can load the html in three ways using Source property, using Navigate method and using
NavigateToString.
  1. //Load local file using 'Source' property  
  2. WebBrowserName.Source = new Uri("ms-appx-web:///HTMLPage.html");  
  3. //Load local file using 'Navigate' method  
  4. WebBrowserName.Navigate(new Uri("ms-appx-web:///HTMLPage.html"));  
  5. //Load html string using 'NavigateToString' method  
  6. WebBrowserName.NavigateToString("<Html><Body><h1>Load local html string in windows phone winrt app.<h1><Body></Html>");  
31. How to Copy Image from Assets folder to Local Storage in Windows 10 ?
  1. StorageFile ObjStorageFile = await StorageFile.GetFileFromApplicationUriAsync(  
  2.   
  3. new Uri("ms-appx:///Assets/MyImage.png"));  
  4.   
  5. await ObjStorageFile.CopyAsync(ApplicationData.Current.LocalFolder, "MyImage.png");  
In above code while referencing your application image from asset folder, you must prefix application path with "ms-appx".

32. What is the major difference between URI Association and App services in Windows 10 UWP?

Both URI Association and App services are useful for UWP app can interact with another UWP application. But  theonly difference is the URI Association used when both the applications are foreground. App services are used in background task and in that case client application must be in foreground and available to use App service.

33. What is the difference between {x:Bind} and {Binding} in UWP?

x:Bind and Binding can does nearly the exact same thing. But having some below few differences:
  • x:Bind lacks some of the features of {Binding}, but it runs in less time and less memory than {Binding} and supports better debugging.
  • x:Bind defaults to Mode=OneTime whereas Binding will default to Mode=OneWay
  • x:Bind does not use the DataContext as a default source, Binding assumes, by default, that you're binding to the DataContext of your markup page.
  • {x:Bind} executes special-purpose code, which it generates at compile-time, Where {Binding} used reflection at runtime to handle binding.
Note: x:Bind is a new features introduced in Windows 10

34. What is x:Phase in Windows 10 UWP?

x:Phase is a new features introduced in Windows 10, it provides the ability to prioritize the rendering of XAML controls within a data template. A common scenario for this is when using a long list that has images and text, it would most likely make more sense to load the text first and then the image second. Not only would this make the page look better while scrolling but if a user scrolls quickly enough it could save having to render the images at all and improve the overall speed of the app.

35. What does SemanticZoom control in Windows 10 UWP?

The SemanticZoom control enables the user to zoom between two different views of the same content so that they can quickly navigate through a large data set. The zoomed-in view is the main view of the content. You show the complete data set in this view. The zoomed-out view is a higher-level view of the same content. You typically show the group headers for a grouped data set in this view. For example, when viewing an address book, the user could zoom in on a letter and see the names associated with that letter.

36. Why we need to use Model-View-ViewModel pattern(MVVM) pattern?

The Model-View-ViewModel pattern can be used on all XAML platforms. Its intent is to provide a clean separation of concerns between the user interface controls and their logic.


Benefits:
  • During the development process, developers and designers can work more independently and concurrently on their components. The designers can concentrate on the view, and if they are using Expression Blend, they can easily generate sample data to work with, while the developers can work on the view model and model components.

  • The developers can create unit tests for the view model and the model without using the view. The unit tests for the view model can exercise exactly the same functionality as used by the view.

  • It is easy to redesign the UI of the application without touching the code because the view is implemented entirely in XAML. A new version of the view should work with the existing view model.

  • If there is an existing implementation of the model that encapsulates existing business logic, it may be difficult or risky to change. In this scenario, the view model acts as an adapter for the model classes and enables you to avoid making any major changes to the model code.
37. What are the MVVM toolkits and frameworks available in Windows 10 UWP?

As per my knowledge, below are the most popular MVVM Toolkits that can also support for Windows 10 UWP app:
  • Prism 6
  • MVVM Light
  • Caliburn Micro
38. What is Prism in Windows App Development?

It’s a very popular MVVM (Model-View-ViewModel) framework created by the Patterns & Practices division in Microsoft, with the goal to help developers to implement the MVVM pattern in their application and to support the most common scenarios.

Note:
Now prism can support for UWP app from Prism 6 version.

39. What is use of ICommand in UWP?

Typically, when you write an application without using the MVVM pattern, to manage the user’s interaction with the user interface (for example, he clicks on a button) you subscribe to a event handler: this way, a new method will be generated in code (C#) behind, which will contain the code that will be execute when the event is raised.

This approach is that it creates a strong connection between the View and the code: event handlers can be managed only in code behind, but you can’t simply move it to a ViewModel. The solution is to use commands, which are special objects (that implement the ICommand interface) that define the operation to perform when the command is executed.

Note:

The Windows Runtime offers only the basic interface to support commands, which is ICommand: a developer, typically, would have to create its own class to implement this interface. However, all the MVVM frameworks usually offer it and Prism makes no exception: in this case, the class is called DelegateCommand.


40. What are different type of UI elements in UWP?

In UWP, Each page has a user interface, made up of three types of UI elements: navigation, commanding, and content elements.
A. Navigation elements help users choose the content they want to display. Examples of navigation elements include tabs and pivots, hyperlinks, and nav panes.

B. Command elements initiate actions, such as manipulating, saving, or sharing content. Examples of command elements include button and the command bar. Command elements can also include keyboard shortcuts that aren't actually visible on the screen.

C. Content elements display the app's content. For a painting app, the content might be a drawing; for a news app, the content might be a news article.

Inthe next part, I will explain more UWP advanced interview questions. 

FeedBack Note

Please share your thoughts and what you think about this post. Is  this post really helpful for you? I always welcome it if you drop comments on this post and it would be impressive.

Read more articles on Universal Windows Platform:


Similar Articles