Skip to main content

Shadows in a Windows 8 App

This week I receive a question related to XAML and a Modern UI Windows 8 application (Metro Apps).  They need a method to draw shadows in a XAML application.
When the design team port an application from iPad to Windows 8, they try to reuse a lot of things that were used on iPad. Because of this elements like shadow can appear very easily in the design of a Windows 8 application. In theory, a Windows 8 application should not contains shadows. Because an app for Windows 8 should have a clean and simple design, shadow is saw like an element that will only load the UI.
Also, people that worked with UI effect already know that the shadow effect is one of the effects that use a lot of resources – especially video or processor resource. Having this kind of effects on a tablet could drain our battery very easily.  
This is why the XAML don’t contains any kind of support for shadow. You can make some hacks, using lines with different bluer levels and thing like this, but it will be only a hack. By default we don’t have support for this kind of effect.
The first thing that we should do when we receive a request like this is to send back the design and explain that a Modern UI Windows 8 App should not contains shadows.
If you really want the shadow effect you should try using DirectX in combination with C++. Using DirectX from C++ you can make any kind of effect you want. Yes, the implementation is not so trivial, but you will obtain the perfect shadow effect. Because you are using DirectX the performance will be pretty good.
If you don’t want to use C++ and DirectX directly, I recommend http://sharpdx.org/ . This is an open source project that offer support for DirectX from C#. They have a version of the frameworks that works pretty good on Win RT. The only thing that you should remember about Sharpdx is the performance. Because is only a wrapper over DirectX and C++, if you have any kind of problems you should fallback to C++ and write your own code.   

Comments

  1. So it seems that on iPads people are not concerned that a ... shadow might consume the battery? :)

    ReplyDelete
    Replies
    1. This was a big problem on SL also. In a perfect world we would have XAML integrated 100% with DirectX feature. We are on Windows now. :)

      Delete

Post a Comment

Popular posts from this blog

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

Run native .NET application in Docker (.NET Framework 4.6.2)

Scope
The main scope of this post is to see how we can run a legacy application written in .NET Framework in Docker.

Context
First of all, let’s define what is a legacy application in our context. By a legacy application we understand an application that runs .NET Framework 3.5 or higher in a production environment where we don’t have any more the people or documentation that would help us to understand what is happening behind the scene.
In this scenarios, you might want to migrate the current solution from a standard environment to Docker. There are many advantages for such a migration, like:

Continuous DeploymentTestingIsolationSecurity at container levelVersioning ControlEnvironment Standardization
Until now, we didn’t had the possibility to run a .NET application in Docker. With .NET Core, there was support for .NET Core in Docker, but migration from a full .NET framework to .NET Core can be costly and even impossible. Not only because of lack of features, but also because once you…