Friday, November 25, 2011

Drawing tool story: Drawing a simple line.

Hi I am going to write a drawing tool for one of my client in phases, I thought I can share some of the learning with the community as this is a far different project that I always did. All my projects and expertise some how related to data centric and data visualization.

However, now I have chance to explorer some of the WPF animation, drawing and other interesting things like 2d, and 3d objects. In this short post I would share few line of code from my actual project where I have done a demo on drawing a line on a  canvas.

image

In above example I have created a window to draw line upon the button clicks. Fairly simple and easy. Bellow the xaml definition is given.

image

Just a simple drawing surface named “DrawingPanel” which is a canvas. Bellow the c# code is given.

using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Tool_Panel_Example
{
public partial class MainWindow
{
private double x1 = 10;
private double x2 = 200;
private double y1 = 10;
private double y2 = 200;
public MainWindow()
{
InitializeComponent();
}

private void ButtonClick(object sender, RoutedEventArgs e)
{
x1 = x1 + 10;
x2 = x2 - 10;

var element = new Line { Stroke = new SolidColorBrush(Colors.White),
X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, StrokeThickness = 2 };

DrawingPanel.Children.Add(element);
}
}
}


Here I have first created a line element and then set its properties, here stroke and position and border thickness property is been set. Finally added in the drawing panel. Note that the position is been changed each time as we don’t want to keep the same object in same location.


I would continue to add more feature in the project and hopefully learn many things, and would definitely share with the community.

Thursday, November 17, 2011

KAXAML, another xaml editor for free!

As the heading suggests Kaxaml is a open source free xmal editor, it has split xmal and WPF deginer view, but the designer is so far view only all the editing has to be done in the xmal editor part.

You can download this from http://kaxaml.com/

image

It’s a small 1.7 mb package and comes with some handily features, you can create xaml for both wpf and Silverlight in single window side by side, note that there is no project concept only xmal document can be created and saved. However, it has some fair amount of intellisence.

image

By the way as no drag and drop feature is still here I would still prefer expression blend over this, and of course visual studio express editions and visual studio professional is far better as far as features are concern.

But for faster editing we can always use the Snippets tab for faster xmal writing. Lots of snippet is given there to help us do fast editing.

Never the less it’s a good tool to play with xaml.

Thursday, November 10, 2011

Export your illustrator object to XAML,”Making xmal icon is so easy now!”

Making XAML Icon and objects are not fairly easy!. Just found from the designer of our company that I can create a icon in illustrator and then directly export it to XAML and use it in our project. XAMLExport is a small plugin and worth trying, More over one very interesting thing is that its completely free!.

Here is where you can download the plugin.

http://www.mikeswanson.com/xamlexport/

image

Download and use it, you would love it. In future I would try to add a small tutorial to explain how we could be benefited from this plugin more, perhaps a guided tutorial to create a simple icon.

Tuesday, November 1, 2011

Sitefinity a full customizable CMS with good C# .net development.

Recently I worked in a project where we had to build a cms for a educational organization. There are couple of choices but end up with http://www.sitefinity.com/.

It’s a wonderful site, and has huge customization option. we can build custom control and easily integrate into the application. I would very much like to share more about Sitefinity in near future.

image

There is a huge set of tutorials is provided for the developers to work and get a good kick start. you guys can download this cms from [http://www.sitefinity.com] and play with it.

This have also a sdk so that we can develop our customized solutions. The sdk can be download from http://www.sitefinity.com/devnet/sdk.aspx.

In near future can would have a series of post to show the power of the tool.

Till then happy programming.