System.Net.Http.HttpClient vs Windows.Web.Http.HttpClient – What are the main differences?

Windows.Web.Http is a WinRT API available in all the WinRT programming languages supported: C#, VB, C++/CX and JavaScript. This enables the option to write the same code in the language of your choice. System.Net.Http is a .NET API, and it is only available for C# and VB developers. Windows.Web.Http advantages WinRT APIs are written in … Read more

ListView ItemTemplate 100% width

I got it. Setting the ListView.ItemContainerStyle with a HorizontalContentAlignment setter makes the trick. I.e.: <ListView x:Name=”questionsView” Background=”{StaticResource ApplicationPageBackgroundThemeBrush}”> <ListView.ItemTemplate> <DataTemplate> <Border Background=”BlueViolet”> <Grid HorizontalAlignment=”Stretch” Margin=”0″> <TextBlock Text=”{Binding}” /> <TextBlock HorizontalAlignment=”Right”>16 minutes ago</TextBlock> </Grid> </Border> </DataTemplate> </ListView.ItemTemplate> <ListView.ItemContainerStyle> <Style TargetType=”ListViewItem”> <Setter Property=”HorizontalContentAlignment” Value=”Stretch” /> </Style> </ListView.ItemContainerStyle> </ListView>

Is the List.ForEach() method gone?

It’s indeed gone: List<T>.ForEach has been removed in Metro style apps. While the method seems simple it has a number of potential problems when the list gets mutated by the method passed to ForEach. Instead it is recommended that you simply use a foreach loop. Wes Haggard | .NET Framework Team (BCL) | http://blogs.msdn.com/b/bclteam/ Very … Read more

Retrieve the Current App version from Package

Here’s what you can do to retrieve the version in code: using Windows.ApplicationModel; public static string GetAppVersion() { Package package = Package.Current; PackageId packageId = package.Id; PackageVersion version = packageId.Version; return string.Format(“{0}.{1}.{2}.{3}”, version.Major, version.Minor, version.Build, version.Revision); } Reference: http://www.michielpost.nl/PostDetail_67.aspx

how to use MVVMLight SimpleIoc? [closed]

SimpleIoc crib sheet: You register all your interfaces and objects in the ViewModelLocator class ViewModelLocator { static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); if (ViewModelBase.IsInDesignModeStatic) { SimpleIoc.Default.Register<IDataService, Design.DesignDataService>(); } else { SimpleIoc.Default.Register<IDataService, DataService>(); } SimpleIoc.Default.Register<MainViewModel>(); SimpleIoc.Default.Register<SecondViewModel>(); } public MainViewModel Main { get { return ServiceLocator.Current.GetInstance<MainViewModel>(); } } } Every object is a singleton by default. To … Read more

Setting button text via JavaScript [duplicate]

Use textContent instead of value to set the button text. Typically the value attribute is used to associate a value with the button when it’s submitted as form data. Note that while it’s possible to set the button text with innerHTML, using textContext should be preferred because it’s more performant and it can prevent cross-site … Read more

How to uninstall an app that another user installed?

My process above still works, but it simply gets around a race condition issue, where Windows Update (yes, oddly enough) is in charge of wiping out “staged packages.” According to Microsoft, the “other fix” – and I still consider this issue to be a bug – is: Cause of the problem: Windows Update (WU) downloads … Read more