Saturday 26 October 2013

Windows Phone - The name “LocalizedStrings” does not exist in the namespace

The name "LocalizedStrings" does not exist in the namespace

Today morning all of a sudden, my windows phone project that I had been working on for months started showing up this compile time error message at:
<Application.Resources>
    <local:LocalizedStrings xmlns:local="clr-namespace:Bins" x:Key="LocalizedStrings"/>
</Application.Resources>
It was not a show stopper as I was able to force VS2012 to ignore this error and continue with the build. But I some how wanted to take some time to fix the issue. The error message starting showing up after my machine had an unexpected crash. So the most probable reason for it is a corrupted file.
It was fixed by cleaning up some visual studio chach files.
Steps:

  1. Close Visual Studio.
  2. Go to the folder location : "%LOCALAPPDATA%\Microsoft\Phone Tools\CoreCon\".
  3. Delete the contents of the folders: 10.0 and 11.0.

Open up your project and compile. The error must have disappeared now.

Wednesday 23 October 2013

Windows 8 Essential Shortcuts

Agreed upon the fact that Windows 8 is a very Touch friendly OS, its not that partial to its keyboard fan boys either. Windows 8 has a very rich set of keyboard shortcuts to boost your productivity if your hands are resting upon keyboard most of the time. Below are a selected list of 15 shortcuts which I found useful.
Caution: All the shortcuts are Windows Key centric.

  1. Windows Key + C : Displays Charms menu.
  2. Windows Key + X : Brings up a menu of advanced system options, including Windows Control Panel, Command Prompt, Task Manager and File Explorer.
  3. Windows Key + I : Displays the Settings menu for the current app. For example, if you’re in Internet Explorer 10, this key shows Internet options. If you’re on the Start menu, it shows general OS settings.
  4. Windows Key + Q : Brings up the apps search menu that allows you to search your list of installed programs.
  5. Windows Key + D : Activates desktop mode.
  6. Windows Key + Tab : Brings up the Task Switcher and toggles between Windows 8-style apps.
  7. Windows Key + H : Brings up Share menu for the current app. For example, hitting Windows Key + H in Bing Maps, lets you email or share map information on social networks.
  8. Windows Key + M : Opens desktop mode and minimizes all windows.
  9. Windows Key + W : Opens universal search menu and sets it to search settings.
  10. Windows Key + F : Opens universal search menu and sets it to search files.
  11. Windows Key + R : Opens Run menu where you can launch programs by typing in their executable file names.
  12. Windows Key + E : Opens File Explorer to the “My Computer” view which shows all your drives.
  13. Windows Key + Number Key (1-9) : Switch to desktop mode and make the Nth application on the task bar active where N is the number key you hit and 1 is the furthest taskbar icon to the left.
  14. Windows Key + . (period key) : Docks the current Windows 8-style application to the right or left, depending on how many times you hit it.
  15. Windows Key + Z : Brings up app menu, which shows contextual options for the active app.
Happy keyboarding.

Monday 21 October 2013

Windows 8.1 - Blurry Text Fix

My first sight of desktop after upgrading to Windows 8.1 Pro was very disappointing.
All the icons and fonts appeared blurry and weird on my decent resolution (1600x900) Lenovo Yoga 13 monitor. For a moment I regretted for having upgraded the OS without going through enough reviews online.
But there is no going back, I want the lastest OS update on my machine.
I "Binged" and could find this issue was reported since the preview release of Windows 8. But there was no proper resolution mentioned even on Microsoft forums (of course they are not the best knowledge centers). Finally determined to play around with the settings, the solution to the issue was pretty straight forward. I will reproduce the steps I followed:

Step 1) Right Click Desktop and click "Screen Resolution" from the menu.
Step 2) On the Screen Resolution Window, click the "Make text and other items larger or smaller" link.
Step 3) Select the "Let me choose one scale level for all my displays".
Step 4) Select "Smaller - 100%" option and click Apply.
It will prompt you for a re login and proceed with it. Hopefully this should fix your blurry text issue.
On the Screen Resolution Window, click the "Make text and other items larger or smaller" link
Select "Let me choose one scale level for all my displays". Select "Smaller - 100%" option.


Saturday 12 October 2013

WPF - How to use Hyperlink

Requirement:
Add a Hyperlink to WPF window/page; clicking on which should open up a web browser with the url assigned to the hyperlink.

Solution:
Add a Hyperlink control to your page. It need to be in a container like a TextBlock because the control cannot exist independantly. Handle the RequestNavigate event and do our custom actions required, in our case spawn a new process to open up a web browser to navigate to the specified url.
XAML
<TextBlock>          
    <Hyperlink NavigateUri="http://www.google.com" RequestNavigate="Hyperlink_RequestNavigate">
        Click here
    </Hyperlink>
</TextBlock>
Codebehind
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
    Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
    e.Handled = true;
}