Dealing with page resize in Windows Store Applications using Caliburn.Micro

Sunday, March 1, 2015

Windows Store Applications allow the user to change the size of the application and change the the layout to e vertical or horizontal. in order to provide god user experience we want adapt our view to different modes. For instance, showing a grid like view when in Full Horizontal mode and change it a List when we are snapped to side (and look vertical). The examples and guidelines on how to change your view based on the page layout change are around those option: In your page XAML write the representation for both mode and change visibility...

Simple Behavior for Binding to ActualWidth\ActualHeight

Monday, December 22, 2014

There are times when you want two or more elements in your XAML to share the same dimensions, usually you dint want to deal with static sizes and prefer that after an element got its size from the layout, all the other elements will be set to the same size. you can find the real sizes of an element quite easily by looking at its ActualHeight and ActualWidth properties, however those properties doesn’t behave nice with binding and attempting to bind an element to another element ActualWidth\ActualHeight will result in an expected results. to mitigate the problem I created...
no comments

StringSplitterConverter–binding to a part of a string in XAML

Sunday, December 21, 2014

I’m involved in a Windows Store project that needs to deal with localization. I already write a about localization in Windows Store application in January 2013 so you are welcome to read about it. Our Xaml designers came to me the other day with an issue they found irritating. They needed to show some text on the screen that contain both regular text (some as bold, some italic etc.) and hyperlinks and if that’s not enough the text-resource was localized. One way to solve this is to separate the text-resource to multiple parts and store each one independently...
no comments

Getting the Free Storage Space in WinRT

Tuesday, December 16, 2014

I didnt find any documenation to this method other than the thread in StackOverflow: http://stackoverflow.com/questions/19510449/disk-space-in-winrt-using-c-sharp-in-windows-8 so im keeping it here so it wont get lost by the winds of time…. public static async Task<UInt64> GetFreeSpace(this IStorageItem sf) { var properties = await sf.GetBasicPropertiesAsync(); var filteredProperties = await properties.RetrievePropertiesAsync(new { "System.FreeSpace" }); var freeSpace = filteredProperties; return (UInt64)freeSpace; } Sample use: var freeSpace = await ApplicationData.Current.LocalFolder.GetFreeSpace(); Debug.WriteLine(freeSpace.GetSizeString()); Thank you  Filip Skakun
no comments

Creating a Dialog service for Windows Store apps using Caliburn.Micro

Friday, November 28, 2014

When you want to display a dislog screen in windows store apps, you can use Flyout, MessageDialog or Popup the first two should be used for the simple cases – message prompts, question, basic user interaction. But if you need to display a richer dialog then Popup is the right fit. The MVVM way to open those dialogs is by using some kind of DialogService that will be called from you ViewModels. in all the sample i've seen on using Popup it always has a strong coupling to the View itself, meaning the Popup was embedded inside the view...
no comments

InvalidOperationException When Working With IAsyncOperation<TResult>

Thursday, November 27, 2014

WinRT introduced the concept of IAsyncOperation for working with Asynchrounous code. the IAsyncOperation is merely a representation of an Async Operation (a future in the computer science lingo) and as the same meaning as hte .NET System.Threading.Tasks.Task class, so its not suprising to see that you can convert IAsyncOpertion<TResult> to Task<TResult> IAsyncOperation<int> asyncOperation=...; Task<int> task = operation.AsTask(); .NET Tasks has the Result property which gets the value of the async oprtation if it finished or wait till the value is available – this of course can cause the calling thread to freeze until the value is returned. IAsyncOperation has something...

Using extension SDKs in without installing it

Monday, September 29, 2014

In my Windows 8.1 project I wanted to use the SQLite PCL library. I Installed it from nuget and everything worked great so I committed the changes to the source control and moved on. When my colleague pulled the changes, it didn't compiled. The nuget package installed an extension SDK for me but apparently it doesn't install it when you restore the package (very bad for CI). So it seems that the only solution is putting the SDK inside our 3rdParty folder and putting it as part of our source control, but unfortunately this wasn't an easy task – so im writing about...
no comments