Friday, June 10, 2011

BCL : PDF converter and sdk for easy use.

Hi recently we developed a Silverlight component for one of our client and used some very interesting technologies. I thought those are worth sharing. If you are thinking about converting your PDF document to word or some other format I would suggest you use BCL component. You can download the sdk as well as the trial software from http://www.pdfonline.com/.

image

There could be lots of technologies for converting documents from one format to another but sad thing is noting is free. You have to pay to use this component so some financial bottleneck is involved. I would very much like to see some free component in future. In those cases open source software's would have had those rich conversion facilities.

image

Until we find free products for conversion, this is a good choice.

Friday, June 3, 2011

Double dependency property causing exception!

background

Hi , today I am going to share a small tips, its about dependency property, here is what I added in my presenter, looks like a innocent dependency property to me.

CenterX DependencyProperty

public double CenterX
{
get { return (double)GetValue(CenterXProperty); }
set { SetValue(CenterXProperty, value); }
}

public static readonly DependencyProperty CenterXProperty =
DependencyProperty.Register("CenterX", typeof(double),
typeof(MainWindowPresenter), new UIPropertyMetadata(0));



In first thought I found not problem in this code, but when I run the code end up with a the following exception,


image


In fact I didn’t now that it happen because of the dependency property, I was banging my head on the wall for few minutes when I saw this exception window. I commended lots of code that I wrote since the last commit and successful run. And when I start commenting one by one code segment, and finally found out that dependency property.


The want’s wrong with it?


It took a while to figure out what is wrong with it, I have rewritten the property with a minor change, can you see what is changed in the following code?


public double CenterX
{
get { return (double)GetValue(CenterXProperty); }
set { SetValue(CenterXProperty, value); }
}

public static readonly DependencyProperty CenterXProperty =
DependencyProperty.Register("CenterX", typeof(double),
typeof(MainWindowPresenter), new UIPropertyMetadata(0d));


Yes a simple change first time it was 0 how 0d on UIPropertyMetaData. Yes this is a simple change but took a while to figure it out.


Hope you wont loss you time with this kind of mistake, always use 0d or some (doublevalue)d when initializing a double dependency property.


Until next time bye bye.