Article Posted: AutoCompleteComboBox for Silverlight

I have posted an article at CodeProject on customization of the Silverlight AutoCompleteBox to be used as a type-ahead ComboBox in LOB applications at CodeProject. The AutoCompleteComboBox can be used in typical Object-to-Object associations (one that we typically encounter when creating associations in Entity Framework) as well as Foreign Key associations (the new association type introduced with Entity Framework 4).

Here’s a sample usage of the control in a typical MVVM scenario:

  • Object to Object Association:

    Example data structure:

    public class SalesOrderDetail
    {
        Product product;
        public Product Product
        {
            get { return product; }
            set { product = value; }
        }
    }
    

    Example control usage:

     <custom:AutoCompleteComboBox
       SelectedItemBinding="{Binding Product, Mode=TwoWay}"
       ItemsSource="{Binding Path=Products, Source={StaticResource ViewModel}}"
     />
    
  • Foreign Key Association:

    Example data structure:

    public class SalesOrderDetail
    {
        int productID;
        public int ProductID
        {
            get { return productID; }
            set { productID = value; }
        }
    }
    

    Example control usage:

     <custom:AutoCompleteComboBox
       SelectedValue="{Binding ProductID, Mode=TwoWay}"
       SelectedValuePath="ProductID"
       ItemsSource="{Binding Path=Products, Source={StaticResource ViewModel}}"
     />
    

To view the implementation details, you can read the full article at :
http://www.codeproject.com/KB/silverlight/AutoComplete_ComboBox.aspx

The source code along with a demo project can be downloaded from the article as well as here (28 KB). Remember to rename the file as zip for extraction.

Advertisements

Silverlight article posted at CodeProject

At last, I was able to complete and post my article: “My First Data Application in Silverlight” at CodeProject here: http://www.codeproject.com/KB/silverlight/MySilverlightDataApp.aspx
This one is a detailed article intended for beginners starting Silverlight. It discusses how data from a database can be retrieved and displayed in a silverlight application. It discusses how LINQ objects are returned using a WCF service and consumed in a silverlight application. On the layout side, it looks at the ListBox and DataGrid and provides an introduction to the data templates too. I think that most of the silverlight programmers have past experience of ASP.NET so I also discussed the similarities between ASP.NET and Silverlight. I hope people will find this article beneficial.

Article Update: Maze Solver in C#

Check out http://www.codeproject.com/csharp/MazeSolver.asp for an updated version of my MazeSolver article. The article now describes the internal working of my class. I hope this version will help you to understand my logic.

New article: Analog clock control in C#

Visit http://www.codeproject.com/cs/miscctrl/AnalogClockControl.asp for my new article. It is a step-by-step guide on how to make a clock control in C#. The article contains much description and pictures. I hope you will like this.

MazeSolver

It was a difficult problem to find a shortest path in a 2D Maze. During my second year exams, I got a mail in which I was asked to write a program for this. I started to think but first no solution could come into my mind, but soon I thought that this could be done using graphs. The maze is similar to a graph, with every element of the maze (node) adjacent to its left, right, top and bottom nodes. After this I applied simple breadth first search to find the shortest path.

Matrix and Fraction classes

I always get confused when performing row operations in a Matrix. But matrices were a great portion of our Maths-III course, as well as our Economics’ Linear programming section. Hence I needed a program which could tell me at when I was doing mistakes. The solution was simple, just to download any matrix application. But the problem was that all matrix programs I got, worked on floating point numbers and in our class problems we have to consider the exact values using fractions. I therefore needed a matrix application which could show results in a fraction format, but I didn’t found any. At that time we learned how to represent real world objects in a programming language and we did the example of a fraction class in our OOP course. I further enhanced that idea and was able to develop a fraction class and later on, a matrix using the fraction class. I incorporated all my needs and it worked fine. Then I uploaded the classes on GotDotNet<www.gotdotnet.com> and other similar sites and yes, I was able to further improve my classes with the help of user responses. I finally posted two articles on CodeProject<www.codeproject.com> and user responses were wonderful. I finally thank all of those who were helpful starting from Sir Saqib Ilyas to Jeffrey, Marc and other fellows.