Thursday, March 29, 2007

 

Selecting Editable Items in an .net WPF ListBox (or ComboBox)

What could be simpler than selecting items from a WPF ListBox. You can even make the items have fancy formating using a TextBlock. If you want to allow the user to edit the ListBox items then there is a problem. This occurs when your ListBox items are editable objects, such as a TextBox. Selecting around the TextBox selects the appropriate ListBox item, but selecting the TextBox only selects the TextBox.

The solution to this problem is when the TextBox is selected, to also select the ListBox item. To this you need to setup an event handler and write a few lines of C# code. You want use the "GotFocus" event since the TextBox may be selected by multiple methods such as tabbing with the keyboard or clicking with the mouse.

To make things simpler you can use Expression Blend to setup the event handler and create C# shell code. To do this select the TextBox properities using Expression Blend and then select the event handlers.

Here is a C# event handler for the TextBox, which is any item in ListBox for this example.
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
TextBox tb = sender as TextBox;
if (tb == null) return;
if (tb.DataContext == null) return;
this.listBoxDataItems.SelectedItem = tb.DataContext;
}

Where the ListBox is defined as

ItemsSource="{Binding Path=CodeCreatorData}"
x:Name="listBoxDataItems" />

with a template like this

GotFocus="TextBox_GotFocus"/>

Labels: ,


Friday, March 16, 2007

 

What is Workflow EcoSystem?

Workflows have recently gained a lot attention since Microsoft introduced a workflow engine as part of .Net release 3.0 and have workflows integrated with Office 2007 and SharePoint. Workflows as mechanism to automate applications have been around for while. We have had a Workflow engine for several years.
What is clear is that to use workflows as sucessful automation tool a complete ecosystem is required. Our view is that a complete workflow ecosystem consists of 5 key components.
5 Key Components of a Workflow Ecosystem
  1. Workflow Designer
  2. User Interface
  3. Data Persistence Layer
  4. Data Report Generator
  5. Workflow Engine

A white paper, Attributes of a Complete Workflow Eco-System, has been put together that describes what attributes are required of each of the key components.

Labels: ,


 

Using SilverLight (WPF/E) creates clear images

Remember migrating from .net 2.0 from 1.1 at your ISP? Our ISP created a separate server with .net 2.0 libraries and selected clients moved their applications to that server. Of course, if the application included Web Service, Web Pages and Windows Client, ALL code had to be converted to .net 2.0 before it was deployed.

Migrating to Microsoft .net 3.0 is MUCH simpler, because the ASPX server is still a ASP.net 2.0 Server. Of course, our ISP seems to be taking a 'measured' approach. But does that stop us from playing with .net 3.0 and wanting to show our endeavors? Of course not.

Do you get annoyed when images are not clear on web pages because of rescaling? The really cool facet of .net 3.0 is Managed Code directly accessing un-managed code, namely DirectX. Use XAML - a new, mark-up language to build user interfaces with.net 3.0 libraries. Images can be displayed with amazing clarity.

Using Microsoft Expression Design, we created a simple WPF/E image control that displays thumbnails and allows the user to select an image that scales. Look at the clarity of this image. So how did this code reach the web?
1. Post code to ISP. Problem - XAML file type not recognized and hence the control did not display at all.
2. Change XAML file type to XML file type - control now displays!
3. Login to ISP technical page and chat with support staff. Ask them to add the XAML file type to the web server (use same characteristics as XML file type).
4. WPF/E control now displays in a web page from our ISP.
5. Go to 'virgin' PC (one that hasn't used .net 3.0). Open web page with WPF/E control. Because this control is a WPF/E control, the page displays a note that the WPF/E plugin needs to be downloaded. Click to download.
6. View fantastic WPF/E image selector control with great image clarity.

Labels: ,


Thursday, March 15, 2007

 

SharePoint and ASP.Net Web Parts Suite

Our Web Parts Suite is now here. It is free and will remain free. The big news is that it works with both SharePoint and ASP.net 2.0. In fact our web site uses these web parts.

Download the suite and tells what you think. We plan on enhancing the suite both with more parts and features.

If you want the source code or would like custom web parts built, well that's not free. Somebody has to pay the bills.

Labels: , ,


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]