ChildWindow Positioning

Silverlight ChildWindow is centered over the parent control. I have extended ChildWindow to open it at a specific position.

Positioned ChildWindow

Positioned ChildWindow

Here is a live demo : childwindow-positioning-demo

And here is the code :

public partial class ChildWindowEx : ChildWindow
{
	
    Point _pt = new Point(0,0);
	
    public ChildWindowEx()
    {
        InitializeComponent();
    }
	
    public ChildWindowEx(Point pt) : this()
    {
        _pt = pt;
    }
	
    protected override Size ArrangeOverride(Size finalSize)
    {
        Grid grid = Utils.FindChild(this, \"ContentRoot\");
	
        if (grid != null)
        {
            grid.Arrange(new Rect(_pt.X, _pt.Y, grid.DesiredSize.Width, grid.DesiredSize.Height));
            return finalSize;
        }
	
        return base.ArrangeOverride(finalSize);
    }
}

Visual Studio 2010 Solution : download

Posted in Silverlight, code | Tagged , | Leave a comment

Remove ListBoxItem Highlighting

A Silverlight/Wpf ListBoxItem is highlighted when selected or when the mouse hovers over it.

I need to display a list of items that are not highlighted when selected. This is a common scenario when displaying an inactive list for simply listing out some information.

ListBoxItem’s default template can be easily inspected and modified using Expression Blend – Select a ListBoxItem in Objects and Timeline pane, Right click and select Edit template > Edit a Copy. Name you template and save it at the scope of your choice.

This will create a copy of the template and allow you to modify it. Switch to the xaml view. Locate the VisualStates of MouseOver, Selected and Focused, and blank them out -

de-highlighted-xaml

The style is applied to the ListBoxItems using ItemContainerStyle -

applying-style-to-listboxitems

Here is the xaml style for the ListBoxItem -

After the style is applied, the ListBoxItems are not highlighted when selected or focused. Here is a live demo of a ListBox that does not highlight when items are selected : remove-listboxitem-hlighting-demo

Posted in Silverlight, WPF, xaml | Tagged , , , , , | Leave a comment

Sideload Windows Phone

1. Create your AppHub account here - http://create.msdn.com. Registration walk through is here.

2. Unlock your phone – using PhoneReg.exe (usually) located here – “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Tools\Phone Registration\PhoneReg.exe”

wp-Start-WPDevTools

wp-dev-phone-registration

3. Sideload xap into your phone. Use XapDeploy.exe (usually) located here – “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Tools\XAP Deployment\XapDeploy.exe”

wp-app-deployment

You can also deploy straight from Visual Studio to Windows Phone Device. Connect your phone to your computer.
Make sure Visual Studio deployment target is “Windows Phone 7 Device” :

wp-device-target

From Toolbar, select Build, Deploy Solution.

Posted in tips | Tagged , , , , | Leave a comment

Getting Started with MVVM

I just finished presenting here at RDU Code Camp. It was a great crowd ! Here are the slides -

Posted in code | Tagged , , , , | Leave a comment
  • Twitter Updates

  • Notes

    Using DbUpdater with MySql
    DbUpdater can be used with mysql. Here are the files you need to jumpstart the integration – DbUpdater-MySql.zip 1. You might need to change the path to mysql.exe in mysql-exec.bat. 2. Modify values in mysql-sample-command-line.bat. Make sure mysql.data.dll is placed in GAC or in the same directory as DbUpdater.exe. Connector binaries can be downloaded from here - http://dev.mysql.com/downloads/connector/net/6.1.html (0)

    Online Backup Solution
    Finalized online backup solution : JungleDisk. I can run it on all of my machines without paying extra. I get to keep the ownership of my data – by using my own Amazon S3 storage. Backed up all family photos – all 30 GBs. Feeling good (0)

    Switched to Thematic
    I have switched to Thematic theme on this blog over the weekend. I created a child theme after playing around with the customization hooks. I added a widgetized area below main asides, did some css modifications and created a three column, flexible layout just the way I wanted. I am so glad I switched to Thematic. ThemeShaper forums are very helpful. These articles were just what I needed to get started : How to make a child theme for WordPress and How I used a WordPress Child Theme To Redesign My Blog. (0)

  • BookShelf

    Planned books:

    • ASP.NET MVC in Action

      ASP.NET MVC in Action by Jeffrey Palermo, Ben Scheirman, Jimmy Bogard

    Current books:

    • Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers)

      Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers) by Andy Hunt

    • Working Effectively with Legacy Code

      Working Effectively with Legacy Code by Michael Feathers

    Recent books:

    • How We Decide

      How We Decide by Jonah Lehrer

    • How I Got Published: Famous Authors Tell You in Their Own Words

      How I Got Published: Famous Authors Tell You in Their Own Words by Ray White

    • Programming Windows Presentation Foundation

      Programming Windows Presentation Foundation by Chris Sells, Ian Griffiths

    • Advanced MVVM

      Advanced MVVM by Josh Smith

    View full Library

Close
E-mail It