UI Atoms 1.5.8 Released

On January 11, 2011, in Programming, by Akash Kava

We are happy to announce new release of UI Atoms 1.5.8 with following new features.

UI Atoms for WPF 4.0

In this release of UI Atoms, we have a new library of dlls specially designed for WPF 4.0, which now includes support for Visual State Managers and renders everything in WPF 4.0 presentation. You can find Bin.Net4 folder inside WPF, that contains libraries only for WPF 4.0 version.

AtomForm Label Alignment for Silverlight and WPF


AtomForm now provides following two properties,

  • LabelHorizontalAlignment property that can align the label horizontally in the form item.
  • LabelVerticalAlignment property that can align the label vertically in the form item.

Label Can now contain string or UI Element object

Rich Label Format
  1. <ns:AtomTextBox HorizontalAlignment="Stretch"
  2.                 Text="{Binding Path=ProjectName, Mode=TwoWay}" Width="Auto" >
  3.     <ns:AtomForm.Label>
  4.         <StackPanel Orientation="Horizontal">
  5.             <TextBlock>Name:</TextBlock>
  6.             <Image Source="/PrismTest;component/Images/Logo.png" Width="16" Height="16" />
  7.         </StackPanel>
  8.     </ns:AtomForm.Label>
  9. </ns:AtomTextBox>



Advanced Quick Form Designer

Typing Tags with all Bindings could be quite time consuming, where it involves moving items up and down, deleting and adding new Form Items. Advanced Quick Form Designer resolves all this problems by giving you state of art designer, which provides one quick grid to enter all necessary information. However the form designer works well even for existing forms, and you can generate entire new form by selecting some Type as well.


As you see, type of control can be changed that will represent the form item and corresponding binding property can be changed as well. Just with simple one click, you can move items up and down or delete them. You can add a new control that is defaulted to AtomTextBox at the top, you can change default control to add multiple one after another very easily. Also you can click “Generate From Type” to select any Business Object Type and generate a brand new form.


Selecting type will automatically generate form with its bindings.

Tagged with:  

UI Atoms version 1.2.22 resolves Cascaded ComboBoxes issue in MVVM pattern. Advanced AtomForm is now capable of handling cascaded ComboBoxes with MVVM and it also integrates well with third party controls.

Recently we identified few issues with MVVM implementation in Silverlight regarding ComboBoxes. ComboBox looses its “SelectedValue” binding once the ItemsSource of ComboBox changes. This needed some workaround as well as Modifying DataForm is very painful as you may need very complex form designs in regular business applications.

1. Create Models

Lets assume we need to edit a Customer’s Country and City, as we change the Country the list of cities should change it. Problem with existing ComboBox and DataForm is, as soon as list of cities changes, ComboBox’s SelectedValue binding vanishes. So lets create Customer Model first.



Each of properties in CustomerViewModel raises PropertyChanged event for corresponding properties when modified.

When selected customer changes, SelectedCountry also changes and which changes Cities property, so in drop down we can display the list of cities of selected country.


Your SelectedCountry property, where you need Change of Selection event must not raise PropertyChanged event in “set” method as shown below…, however you may turn it off or on based on your UI behavior. WPF has no problem but Silverlight has issues and it works better if PropertyChanged event is not raised.

Selected Country Property
        public Country SelectedCountry
                return _SelectedCountry;
                _SelectedCountry = value;
                //if (PropertyChanged != null)
                //    PropertyChanged(this, new PropertyChangedEventArgs("SelectedCountry"));
                if (_SelectedCountry != null)
                    Cities = _SelectedCountry.Cities;

2. Create Master View

Master View control declares grid with two columns, left side displaying list of customers and on right side displaying details of the selected customer.

MainPage Master View Control
<UserControl x:Class="PrismTest.MainPage"
    d:DesignHeight="300" d:DesignWidth="400">
        <local:ViewModelLocator x:Key="locator"/>
    <Grid x:Name="LayoutRoot" Background="White">
            <RowDefinition Height="400" />
            <ColumnDefinition Width="200" />
            <ColumnDefinition />
            SelectedItem="{Binding ViewModel.SelectedCustomer,Source={StaticResource locator}, Mode=TwoWay}"
            ItemsSource="{Binding ViewModel.Customers,Source={StaticResource locator}}" />
            Grid.Column="1" />
            Grid.Row="1" Grid.ColumnSpan="2"/>

Lets analyze Bindings,

  1. ListBox’s ItemsSource is bound to ViewModel.Customers which returns list of available customers.
  2. ListBox’s SelectedItem is bound (two way) to ViewModel.SelectedCustomer.
Customer View Control
<UserControl x:Class="PrismTest.CustomerView"
    d:DesignHeight="300" d:DesignWidth="400">
        <local:ViewModelLocator x:Key="locator"/>
    <ns:AtomForm DataContext="{Binding ViewModel.SelectedCustomer,Source={StaticResource locator}}">
        <ns:AtomTextBox Text="{Binding Name, Mode=TwoWay}"
                        ns:AtomForm.Label="Name:" />
        <ns:AtomComboBox ns:AtomForm.Label="Country:"
                         ItemsSource="{Binding ViewModel.Countries,Source={StaticResource locator}}"
                         SelectedItem="{Binding ViewModel.SelectedCountry,Source={StaticResource locator}, Mode=TwoWay}"
                         SelectedValue="{Binding CountryID, Mode=TwoWay}"
        <ns:AtomComboBox ns:AtomForm.Label="City:"                          
                         ItemsSource="{Binding ViewModel.Cities,Source={StaticResource locator}}"
                         SelectedValue="{Binding CityID, Mode=TwoWay}"

Lets analyze the bindings,

  1. AtomForm’s DataContext is bound to SelectedCustomer of ViewModel, which comes from SelectedItem of Parent Control
  2. AtomTextBox’s  Text is bound to Name (of AtomForm’s DataContext’s binding) with Mode=TwoWay
  3. AtomComboBox
    1. ItemsSource is bound to ViewModel.Countries which returns list of countries.
    2. SelectedValue is bound to CountryID (of AtomForm’s DataContext’s binding) with Mode=TwoWay
    3. SelectedItem is bound to ViewModel.SelectedCountry, which triggers change of SelectedCountry property on ViewModel which changes list of cities.
  4. AtomComboBox (this is the one that’s tricky, normal ComboBox does not work here)
    1. ItemsSource is bound to ViewModel.Cities which returns list of cities of SelectedCountry.
    2. SelectedValue is bound to CityID (of AtomForm’s DataContext’s binding) with Mode=TwoWay


3. Cascaded ComboBox

You can see that the cascaded ComboBox work well with AtomForm and AtomComboBox and its easy to design AtomForm with MVVM with so much less code then that of DataForm and ComboBoxes.


Please download the latest version of UI Atoms 2010 suite to try MVVM + AtomForm + Cascaded ComboBoxes.

Tagged with:  

NeuroSpeech releases XamlGenerator 1.0

On September 28, 2010, in Programming, Technology, by Akash Kava

XamlGenerator is Code Behind source code Generator for Xaml.

Xaml Code Behind Generator makes it easier to generate Code Behind designer code from XAML, where code can be used at places where Xaml Services are not accessible.

  1. Using XAML 2009 in Silverlight and WPF
  2. Reusing Xaml Business Pages in Silverlight and WPF
  3. Support for User Controls derived from any Control
  4. Using Complied code instead of BAML
  5. Improving speed of XAML runtime
  6. Using XAML to generate code to be used in ASP.NET, Server Core etc, where XAML Services are not available
  7. Generated code is pure .NET 2.0 compliant, and you can target xaml objects to run in earlier .NET version too.
  8. You can also create Xaml for WinForms and use it for your .NET 2.0 projects, however please notice, the features of WPF will not be available, it can only create object hierarchies based on XAML, but it can not give you binding etc features.
  9. x:Name support for Resources, very useful for MVVM Pattern
  10. Support for Custom Extension with Custom Code Generator

Xaml Code Generator

.Net 4 introduces Xaml Services that can load Xaml Object Trees and it provides great deal in terms of intellisense and code behind facilities, however this can only be used where Xaml Services are installed. Also it is quite painful to debug and hide the generated baml resources, that actually is quite easy to disassemble and view the source.
Xaml Code Generator can easily solve these problems by creating source code equivalent to loading object via Xaml Services. Instead, once generated, the performance of source code is quite faster then baml and xaml. Since ASP.NET and WinForms, code behind files did serve great support to link the UI and Code. However in WPF and Silverlight does not support simple references to code behind objects except events. There are work arounds, but we decided to create Xaml Code Generator that will solve lot of problems.

Benefits to WPF and Silverlight

  1. Xaml pages can now use x:Reference markup extension
  2. Xaml pages can support generic type parameters
  3. Xaml page can now derive from any control/panel
  4. Xaml can easily reference any expression that involves code behind operation including "this" keyword
  5. By using custom Xaml markup extensions, you can reuse Xaml between WPF and Silverlight

Known limitations with Xaml Code Generated files

  1. Control Templates and Styles must use respective WPF/Silverlight markup only
  2. No code behind files can be generated for Control Templates and Styles
  3. Xaml pages can not be used with Navigation Urls
  4. Instead code generated files are simply source code equivalent of Xaml, and they should be treated as .Net CLR Objects instead of Xaml Pages and there exists no equivalent baml resources

So how to use benefits of Code Generator as well as XAML

We recommend following pattern to make use of best of both the worlds

  1. Create Main Application Window/Page as regular Xaml
  2. Instead of User Controls, use Xaml derived from Equivalent controls, such as StackPanel, Grid etc, and use them in Main Window/Pages
  3. In this pattern, generated CLR objects of xaml will perform exactly same

Why Generate source code from XAML?

Xaml and Xaml Services are great, they give a huge benefit in terms of runtime model loading and behaviour. For larger systems, and for complex enterprise applications Xaml is perfect. But we still have lot of code in .NET 2.0 and applications that are still heavily dependent on the components that do not support Xaml Services.
Plus, shift of paradigm from code behind to view model is quite painful. Infact ability to use more code behind features is quite needed for current generation.
Debugging Xaml is quite painful still, we still have lot of logic that lies in functional code and there is little more time still before we reach to completely modelled code.
Here are few benefits outlined of generated code,

  1. View Model can be replaced by Code behind, as we can easily reference xc:This and xc:Ref extensions
  2. Debugging c# code can be easier which involves more complex UI designs
  3. Xaml Generated can generate anything, even non UI code
  4. You can even use Xaml Generator in your DSL tool

For more details, please visit, http://xamlgenerator.codeplex.com/

Tagged with:  

This tutorial outlines how to customize UI Atoms’ AtomForm appearance and layout simply by customizing its ItemContainerStyle.

AtomForm is derived from ItemsControl, and ItemsControl declares ItemContainerStyle which can customize the template of individual items that are being displayed. UI Atoms give you complete freedom of how to change your look and feel very easily by just adding a simple template in your resource dictionary.


Create New Item Container Style

To do this, open your xaml page in the Expression Blend and right click on the AtomForm. And choose Edit Additional Templates, and Select Edit Generated Item Container (ItemContainerStyle) and then click on “Edit a copy…”


Then choose a location to keep your style in,


Once the style editor is open, right click on “Style” and click on “Edit Template” and then click on “Edit Current”


Now you will see the Item Container Style’s current Form Item template. Where you can change the colors and layout, for example, we have modified the Vertical Layout of “PART_Label” field as Top in this figure below.


Tagged with:  

Why Practical Applications of Inception can fail?

On September 10, 2010, in Fun, by Akash Kava

To understand this post, you should have seen Inception. Then lets imagine the chaos that can be created with Inception.

By Husband

Husband can do inception to make his wife think that,

  • She is married to the most honest, most handsome, most perfect man
  • She came on this earth to fulfill all his desires
  • She should never complain and argue anything about time not spent at home

By Wife

Wife can do inception to make her husband think that,

  • He is married to the most lovely, most understanding, most perfect woman
  • His desires are of no value, and should be controlled
  • His only purpose in life is to pay the credit card bills.
  • His only purpose in life is to clean house in weekends.
  • Looking at other female is crime.

By Boss

Boss can do inception to make his employees think that

  • They are slaves
  • They must not ask for appraisals
  • They are not supposed to take leaves
  • They must work all the time
  • They must only and only work to make his boss the richest man on the earth.

By Employee

Employee can do inception to make their boss think

  • He is born to pay great for their time wasted in the office premises
  • He must give appraisals unconditionally and regularly
  • He is not supposed to ask reasons for leaves
  • He should not force strict timings
  • He should pay more and more even if he is loosing money

Please add your own imagination of practical implementation of Inception in the comments and I will update the blog.

Tagged with:  

Setup MySQL 5.1 Replication on Windows Servers

On June 25, 2010, in Programming, by Akash Kava

This article illustrates step by step procedure of how to setup MySQL Master to Slave Asynchronous Replication with MySQL 5.1 Server and with MySQL Workbench tools 5.2 on Windows Server.


You need to download MySQL from the corresponding download location and install “Windows Installer Package” and make sure you install the edition with Server configuration wizard and configure your server accordingly.

You have to setup 2 servers, one as Master and one as Slave, and both must be accessible via TCP/IP to each other.

Also configure Workbench to open localhost connection for administration.

Configure Bin Log on Master

Open configuration on Master and setup following options in Log Files to configure bin log.


Configure Master Server ID


Configure Replication User ID on Master

In order for Slave to access your server, you must setup a user “replication_user” (you can choose your own name) and give replication access as shown in picture.MySQL-Replication-Master-User

Configure Replication Slave Server ID

Now go to your Slave server and set its Server ID as shown below.


Configure Replication Settings on Slave

This is the last step to configure your Slave server, please make sure you enter correct address of your Master server and username and password as shown below. Just tick the Master info file name and give a path of file on any folder, even if file does not exist, dont worry, it will be created automatically by slave server.


Start Slave

The final step is to open query browser and run the query “START SLAVE”.

Tagged with:  

Enabling Tracing in Silverlight with UI Atoms

On June 19, 2010, in C#, by Akash Kava

UI Atoms 2010 v1.9 update now includes Trace API for developers to log information on screen just like normal .NET application.

Diagnostics Trace API

Microsoft .NET provided Trace API to help in troubleshoot problems which is of great help at time of development. But Silverlight developers are disappointed for not being able to trace in Silverlight apps. However running apps on multiple platform isn’t quite easy, and different user experiences on different platforms raise unexpected issues. Such issues are difficult to resolve as deployed client computer may not have development tools available to troubleshoot and see application logs.

Trace.WriteLine(“ Hello World “);

We sure miss Trace in Silverlight, so we decided to add similar diagnostics API in Silverlight.

Trace Viewer

In Silverlight, as it runs inside a browser, there is no way to see any trace information not only this, on different platforms like Mac, it may be too difficult for no technical user to install and enable remote debugging.

So we decided to include a visual component that can be put anywhere on screen, just like “Output” pane in visual studio. Its developer’s choice to fit the Trace Viewer. Its pretty simple Text View control, where in you can see lines of log automatically scrolling down as log grows.


UI Atoms’s AtomTraceView control works well with Silverlight as well as WPF, in WPF it uses inbuilt Trace functionality and displays trace information to user, and in Silverlight we have added custom API, that is used to display Trace information. Syntax is pretty simple.

       <RowDefinition Height="200"/>


   <AtomTraceView Grid.Row="1"/>


This way you can include AtomTraceView at the bottom of your page and it will display all traces programmed by the developer.

Limited API

However, .NET Trace API is very huge, and it is extensible, but Trace API offered by UI Atoms as of now is very limited, not by the design but by implications, Silverlight itself is very limited platform, this is just an Add-on for users to troubleshoot their apps.

Trace Statements in Silverlight

In order to write Trace statements, you have to import following namespace,

using NeuroSpeech.UIAtoms.Core;

Then you can write following statements and they will appear in AtomTraceView Control.

AtomTrace.WriteLine(" Hello World ");

AtomTrace.WriteLine( exception.ToString() );

AtomTrace.WriteLine( string.Format("{0},{1} Coordinates", x, y) );


The AtomTrace class exists for both Silverlight and WPF, so it becomes easier to write your logs with AtomTrace instead of Trace, so your code can be shared on both Silverlight as well as WPF.

Trace and Multithreading

Trace statements can be accessed by thread in Silverlight app, however the sequence in which it will appear can not be guaranteed because it depends upon the processor and scheduling algorithm used in thread pool of Silverlight application.

Custom Trace Listener

Just similar to .NET, we have included  AtomTraceListener class, which you can derive and customize trace information according to your need as well as it has Traced event, which you can implement and get trace notifications anywhere..


Future of Trace API in Silverlight

When Trace API will be included by Microsoft in future edition of Silverlight, we may plan to remove Trace API, to be consistent with the Silverlight development workflow, this API has been enabled only to write shared code between WPF and Silverlight environment. However otherwise, we plan to make tracing more rich with UI Atoms. But for now, it is very helpful for everyone.

Live Demo

Click Here to see live demo of Tracing in Silverlight.

Click Here to download demo version of UI Atoms 2010.

Tagged with:  

Scientific calculations often require measurement unit conversion and demand high accuracy. Although it may be very easy to google around the web and get some formula, however when we looked into SI units and its Unit Guide, then we realized that even units with same name have little different value in different countries and continents.

So we decided to bring them all into User Interface control for WPF and Silverlight.

  1. Which allows Developer to adhere to one standard unit.
  2. Which allows users to choose unit of their own choice.
  3. See the conversion while editing the value.



The following sample code displays how to use these unit converters in Silverlight and WPF.


Each of the measurement unit converter controls has four properties as mentioned below.

DisplayValue Property:

This is the editable value displayed in the text box, and user can directly modify this value by either using up/down arrow buttons or by typing in the value. The display value works in conjunction with the type of unit that is selected in Display Unit ID property.

DisplayUnitID Property:

Every measurement unit has different ID assigned by our developers to uniquely identify alpha numeric ID within the set of units. For example, meter and centimeter are IDs of Length. However you do not have to remember these IDs, when you edit your UI in Visual Studio, you can configure these IDs in the property editor. End user can visually modify Display Unit in order to retrieve and enter value in the desired unit.

ValueUnitID Property:

The DisplayUnitID is attached to DisplayValue, similarly the underlying actual value is attached with ValueUnitID property. This Unit ID is usually set to a constant throughout the lifetime of the application and is already defaulted to SI unit. e.g. for Length, it is set to meter. We recommend you to change this only if your base unit requirement is something different then SI unit. This unit can not be changed by end user it can only be programmed in the code at design time.

Value Property:

The value property is something which you are interested saving in the database and use it as base value. This is the converted value of unit ValueUnitID specified from display value of display unit.


In the first control in the above picture, Display Value is 100, Display Unit is Fathom, Value Unit is meter, so converted value in meter is 182.8804.

Live Sample:

Click here to view live sample in Silverlight.

Download Demo:

Click here to download the demo version of UI Atoms.

Tagged with:  

Advanced Data Form with UI Atoms on WPF and Silverlight

On June 1, 2010, in C#, by Akash Kava

Building line of business applications for over years, we realized that the Silverlight DataForm offers very small subset of features that are needed in the long run. We figured out the problem with form based applications, that frustrates developers. That is “Change Management”.

Although WPF/Silverlight does offer very customizable UI designing platform but when we go on the field to develop ling of business applications, we realize that initial development hardly takes any time but maintenance is very difficult.

Lets review the designing problems of panels such as Grid, StackPanel, Canvas etc.


Standard Form Design

Lets review standard form design that is expected, this is the layout that can not be made except canvas panel because there is no way we can support variable columns per row. If you notice, first two rows have 3 columns equally placed and last 2 rows have two columns equally placed. Every field has description at the bottom and red required asterisk (*).


Initial Form Design

The first draft of UI in any application is very simple and we probably do it in minutes.


Changes Requested

But the bigger problem always comes later on when changes are requested.


Atom Flexible Grid

This is the reason we created “AtomFlexibleGrid” which supports variable columns per row as displayed in the picture above. You can see that form and the flexible grid have a property called “RowLayout” which accepts comma separated cell values to be displayed per row. As displayed in the example below.


This is very helpful in quick design, but this also way to easy to manage when changes are requested.

  • Intelligent Flow Layout with ability share multiple items in single row.
  • No attributes required on any child items.
  • Comma Separated “RowLayout” instantly renders variable column grid.
  • E.g. 3,2,1 = 3 cells in first row, 2 cells in 2nd row and 1 cell in 3rd row with automatic spanning.

Benefits of Atom Flexible Grid over Canvas, Grid and Stack Panel

  • Atom Form children are similar to Wrap Panel children, but Wrapping is completely customized via simple attributes.
  • Its easy to move items around without changing lots of attributes, Grid is very powerful but changing grid children can be huge pain.
  • Canvas is very easy to operate, but needs a powerful designer, once again changing layout can be very tedious job.

Form Field Layout


This is how individual components of Form Field are positioned within the Form Field. Collapsible panels are only visible if the content is provided. However in future more of such components will be available in Form Field to standardize the fields.
In next slide, you will see how the fields are positioned in the Form.

Change Management

Changing layout is extremely simple, as you can simply move your items up and down and change “RowLayout” text field to quickly review how it will look. No tedious drag and drop and no typing.

Live Form Demos

Click here to see live UI Atoms form demos for Silverlight.

Click here to download UI Atoms form demos for WPF.

Tagged with:  

Here at NeuroSpeech, we figured out the problem with forms based business applications that frustrates developers and change management is not only time consuming but its quite boring job to do.

Although WPF/Silverlight does offer very customizable UI designing platform but when we go on the field to develop ling of business applications, we realize that initial development hardly takes any time but maintenance is very difficult.

AtomForm has been designed to offer a standard rich business class user interface along with various advanced validation methods and the change management is very easy as “AtomFlexibleGrid” offers simple row layout concept that is offered nowhere today.

Tagged with: