Archives
-
Clean up after Visual Studio
As programmer’s we know that if we create a temporary file during the running of our application we need to make sure it is removed when the application or process is complete. We do this, but why can’t Microsoft do it? Visual Studio leaves tons of temporary files all over your hard drive. This is why, over time, your computer loses hard disk space. This blog post will show you some of the most common places where these files are left and which ones you can safely delete.
-
Call for Abstracts for Spring 2012 DevConnections Conference
Calling all Speakers!
-
Retrieving Data: From Synchronous to Asynchronous
As technology keeps moving on, we as developers are continually challenged to learn new ways of doing our jobs. Many years ago (starting as far back as Visual Basic 4.0) the movement was toward OOP and creating N-Tier applications. This meant wrapping up the data returned from DAO, RDO or ADO into classes and collections of classes. .NET came along and we started using ADO.NET to retrieve data. However, usage of classes and collection classes changed very little, at least conceptually. In .NET 2.0 Generics were introduced, but this just helped simplify our code. Again, our basic class structure changed very little.
-
An Alternate Approach to a GridView – Part 2
After my last blog post on how to layout a different UI design instead of a normal tabular format, I had quite a few comments on how you would add sorting, paging and filtering and so on. That is one of the best parts about using the GridView control, you can still use all the normal sorting, paging and filtering that you would with a normal tabular GridView. If you take a look at Figure 1 you can see that I sorted the data using the SqlDataSource object, then applied paging and added a Search/Filtering mechanism. I also added a drop down list of field names so you can sort the grid using any field from the table you want. All of this was done and you will only have to add 1 line of code to perform the sorting!
-
An Alternate Approach to a GridView
I have long had a problem with using grids to display data to the user. I have an even bigger problem with editing on a grid. A grid is easy to implement for a developer, and this is normally why developers use them. However, a grid is normally not the best interface for a user. Now, note that there are always exceptions, but these should be the exception and not the rule. There are many reasons why a grid is not suitable for user consumption.
-
From Normal Collections to Generic Collections
Prior to .NET Version 2.0 if you wanted to hold a collection of string, integers, or objects you had to work with some of the classes in the System.Collections namespace.
-
Understanding XAML Screen Layout
When you first start designing XAML screens in either WPF or Silverlight there are several approaches you can take. You can just draw controls on a Grid and let the controls figure out where they are in relation to one another and the Window via the Margin property. You can also a Grid and create a set of Row and Column definitions similar to an HTML table. Another method is to use absolute positioning with a Canvas control. Finally, you could use a series of StackPanel controls with styles. Which one you choose has ramifications to how well your application looks and feels across a wide variety of resolution sizes. This article will explore the impact of each of these.
-
Get List of Active Directory Domains
I recently had a client ask how to retrieve a list of Active Directory Domains as he wanted to give a list to his user. Turns out this is very easy to do in .NET. All you have to do is add a Reference to the System.DirectoryServices DLL and add a using statement:
-
Sort Data in Windows Phone using Collection View Source
When you write a Windows Phone application you will most likely consume data from a web service somewhere. If that service returns data to you in a sort order that you do not want, you have an easy alternative to sort the data without writing any C# or VB code. You use the built-in CollectionViewSource object in XAML to perform the sorting for you. This assumes that you can get the data into a collection that implements the IEnumerable or IList interfaces.
-
Synch a ComboBox in Silverlight with Foreign Keys
In most database applications you will have foreign keys to express a relationship between one table and another. Many times this takes the form of a lookup table where you want the user to pick from a selection of items such as an Employee Type for an Employee record. You don’t want to have the user remember a number such as 1, 2, or 3, but instead they will pick from a list of the description that corresponds to these numbers such as “Manager”, “Project Manager”, or Employee. While you want to display these descriptions in a ComboBox, like that shown in Figure 1, you want to store the Employee Type ID number into your Employee table to make the data smaller and make it more efficient to join between the two tables.
-
Synch a ComboBox in WPF with Foreign Keys
In most database applications you will have foreign keys to express a relationship between one table and another. Many times this takes the form of a lookup table where you want the user to pick from a selection of items such as an Employee Type for an Employee record. You don’t want to have the user remember a number such as 1, 2, or 3, but instead they will pick from a list of the description that corresponds to these numbers such as “Manager”, “Project Manager”, or Employee. While you want to display these descriptions in a ComboBox, like that shown in Figure 1, you want to store the Employee Type ID number into your Employee table to make the data smaller and make it more efficient to join between the two tables.
-
The Basics of MVVM in WPF
This is a follow-up to my previous blog post on the Basics of MVVM in which I used Silverlight to illustrate how to use a basic MVVM design. I had so many emails asking for a WPF version, I decided to post this sample using WPF.
-
The Basics of MVVM
While training and consulting with clients around the country, I find that many developers still have trouble grasping the concept of Model-View-View Model (MVVM) as used in Silverlight or WPF. In this blog post I thought I would show two examples side-by-side to help you learn how to move from the more traditional model of development to MVVM.
-
Windows Phone Choosers
Windows Phone does not yet support multi-tasking, however you can interact with some of the built-in applications on the phone from within your application. Depending on the application you call, you will either launch the application and pass in some data to the application, or you will launch the application and have some data returned. The former is called a launcher, while the later is called a chooser. In this blog post you will learn to call a chooser from your application and have that chooser return some data from the built-in application. The specific chooser for this blog post will be the PhoneNumberChooserTask as shown in Figure 1.
-
Windows Phone Launchers
The Windows Phone does not support multi-tasking (yet), however you can call many of the built-in applications on the phone from your application. Depending on the application you call, you will either launch the application and pass in some data to the application, or you will launch the application and have some data returned. The former is called a launcher, while the later is called a chooser. In this blog post you will learn to call a launcher from your application. The specific launcher will be the SavePhoneNumberTask as shown in Figure 1.
-
From Zero to Silverlight in 1 Day!
Hi All,
-
Using the Windows Phone Pivot Control
The Windows Phone Pivot control is similar to a Tab control on Windows Forms, WPF or Silverlight. Each “tab” or PivotItem you create is like a separate little page where you can have whatever other XAML you need. In this short blog post I will show you how to create a set of PivotItem controls where each control (tab) will display a list box of photos. You will be able to take a set of your photos, drop them into this project and try out this sample right away. In Figure 1 you can see the sample application that you will create. I named it “My Life in Categories” and it has a list of “tabs” across the top. Each tab is a different year and in each year is a list box with a list of pictures from your life.
-
Using the Windows Phone Panorama Control
The Windows Phone Panorama control makes creating a wrap-around list of items very quick and easy to accomplish. In this short blog post I will show you how to create a nice panorama of a collection of photos. You will be able to take a set of your photos, drop them into this project and try out this sample right away. In Figure 1 you can see the sample application that you will create. I named it “My Life in Panorama” and it simply shows a list of pictures from your life. In this picture I show me at the top of Kilimanjaro in 2004.
-
Use the Silverlight ListBox as an Expanding Menu
Silverlight leaves a lot of choices up to you as a developer. For example, creating a menu or navigational system for your Silverlight application is pretty much wide open. There is a template navigational application that Microsoft supplies with Visual Studio 2010 that uses HyperlinkButton controls as the menus. However, if you have more than just a few menus, you will fill up the screen pretty quickly. It would be nice if you had a way to have expanding a set of menus, so you could have your top set of menus such as “Maintenance” and “Security” that would show up to the user, and then when you click on either one of these, they would expand to reveal each menu item as shown in Figure 1.
-
Add Gradient Background to Mirror Image
In my last blog post I showed you how to create a mirror image as shown in Figure 1. This simple image with a reflection is a nice effect, but it does look a little flat and not very interesting just sitting directly on the user control. In this blog post you will learn how to add a background using a border, a linear gradient and a drop shadow to give this reflection a little more depth and interest to the user’s eye as shown in Figure 3.
-
Mirror Reflections with Silverlight Images
Adding images is very easy to do in Silverlight. All you do is add an <Image> element to your Silverlight user control with the Source property set to the path of where your image is located and that image will be displayed. So the following code will produce the image shown in Figure 1.
-
UserAppDataPath in WPF
In Windows Forms applications you were able to get to your user's roaming profile directory very easily using the Application.UserAppDataPath property. This folder allows you to store information for your program in a custom folder specifically for your program. The format of this directory looks like this:
-
DevConnections new "Fundamentals" Track!
Hi All,
-
WPF Login Verification Using Active Directory
Back in October of 2009 I created a WPF login screen (Figure 1) that just showed how to create the layout for a login screen. That one sample is probably the most downloaded sample we have. So in this blog post, I thought I would update that screen and also hook it up to show how to authenticate your user against Active Directory.
-
'Content' is NOT 'Text' in XAML
One of the key concepts in XAML is that the Content property of a XAML control like a Button or ComboBoxItem does not have to contain just textual data. In fact, Content can be almost any other XAML that you want. To illustrate here is a simple example of how to spruce up your Button controls in Silverlight.
-
Copy New Files Only in .NET
Recently I had a client that had a need to copy files from one folder to another. However, there was a process that was running that would dump new files into the original folder every minute or so. So, we needed to be able to copy over all the files one time, then also be able to go back a little later and grab just the new files.
-
.Net Rocks TV - Architecting Windows Phone Applications
I recently completed a .NET Rocks TV show with Carl Franklin. In this episode I discuss some design decisions that will help you create architecturally sound Windows Phone applications. Of course, many of the techniques will also apply to Silverlight and WPF application development as well. Check out the episode at
-
Tip on Reusing Classes in Different .NET Project Types
All of us have class libraries that we developed for use in our projects. When you create a .NET Class Library project with many classes, you can use that DLL in ASP.NET, Windows Forms and WPF applications. However, for Silverlight and Windows Phone, these .NET Class Libraries cannot be used. The reason is Silverlight and Windows Phone both use a scaled down version of .NET and thus do not have access to the full .NET framework class library. However, there are many classes and functionality that will work in the full .NET and in the scaled down versions that Silverlight and Windows Phone use.
Let’s take an example of a class that you might want to use in all of the above mentioned projects. The code listing shown below might be something that you have in a Windows Form or an ASP.NET application. -
Get XML from Server for Use on Windows Phone
When working with mobile devices you always need to take into account bandwidth usage and power consumption. If you are constantly connecting to a server to retrieve data for an input screen, then you might think about moving some of that data down to the phone and cache the data on the phone. An example would be a static list of US State Codes that you are asking the user to select from. Since this is data that does not change very often, this is one set of data that would be great to cache on the phone. Since the Windows Phone does not have an embedded database, you can just use an XML string stored in Isolated Storage. Of course, then you need to figure out how to get data down to the phone. You can either ship it with the application, or connect and retrieve the data from your server one time and thereafter cache it and retrieve it from the cache.
-
Get Application Title from Windows Phone
In a Windows Phone application that is currently in development, I needed to be able to retrieve the main Application Title of the phone application. You can set the value for Deployment Title in the properties sheet of your Windows Phone Application, however getting to this value programmatically can be a little tricky.
Past Blog Content
Blog Archive
-
2015
-
2014 (18)
-
2013 (11)
-
2012 (19)
-
2011 (29)
-
2010 (19)
-
2009 (28)
-
2008 (0)
-
2007 (14)
-
2006 (6)