Friday, May 22, 2009

WPF Calendar Control

Hi All,

By default, the WPF doesn't have the calendar control. And the toolkit release, it seemeed a little way techy for me. I wanted a simple calendar control and I really couldn't work out how I can use only a single control in my project. I thought, it would be easier for me to create a control of my own. hehe, well said by some one :


"Less Knowledge, less confusion, and No knowledge, no confusion. "


Haha...So I designed something like following image:



I have used Listview to display the dates and the items, like "Sun", "Mon" and the days are nothing but listview items. As soon as user changes the year or month, the method to reload the dates is fired. Very simple approach and very very basic functionality I have tried to put into. So if you want to download the project, then please click Here

Thanks,
Vikas

Tuesday, May 19, 2009

Want to Apply a style to Listview/Combobox Groups? Here is the code:

Hi all,

Have you ever grouped Item in a Combobox? Suppose if I have a list of names, and I want to publish the names grouped with the Initial letters. For example, All names with starting letter as "A" will fall under Group "A" and so on. Like given in the following screenshot :





This is simple. Please download the code from Here

Or check the code which is given below(in images) :

Add the following code to Xaml Window





Friday, May 15, 2009

Using Linq for Filtering File Types etc

Hi,

If you have a List of Type IO.File and you want to filter this list to contain only valid images. Then follow the following approach:

Define your array of Valid extensions :

Private IMAGES() As String = {".JPG", ".PNG", ".GIF", ".JPEG"}

The following function returns a list with Valid Images extensions as mentioned in the above array :

Public Function GetValidImage(ByVal files As List(Of File)) As List(Of File)
Dim tmpList As List(Of File) = New List(Of File)
Dim result = From s In files Group Join p In IMAGES On s.Extension.ToUpper() Equals p.ToUpper() Into Group From p In Group Select s


For Each file As File In result
tmpList.Add(file)
Next file

Return tmpList

End Function

Let me know if you have any other questions.

HTH,
Vikas

Thursday, May 14, 2009

Office 2007 SP2 Release

Hi All,

Though the release has been done almost a month ago...I missed to include it here in my blog.

They(Microsoft) have fixed a bunch of bugs found in SP1...and I am sure, 2007 is going to be stable very very soon. This is the reason that most of big organisations, who work on Office rigorously, for example Investment banks like GS or Morgan stanley, they have been shifting their documents to 2007 versions. The office 2007 is certainly going to be much much more popular than it is right now. Lots of cool features. I love themes by the way.

So lets get back to SP2. Microsoft found so many bugs in the previous versions, which forced them to issue a very heavy service pack because the number of bugs they have fixed is huge. Around 600 they have posted here in the link :

Microsoft Office 2007 SP2 Bug Fixes.

For me, the best thing is the chart object for PowerPoint and Word is unlocked. Now you can format/edit the chart source data etc from PowerPoint only. Earlier, before SP2, for formatting a chart programmatically, one had to take the chart to excel and paste it back to PowerPoint. A big pain for me. Using OpenXML was also a big big Pain.

So now, if you have to delete a Series, you can just create the chart object and then add/delete a series. Bingo :)

I love SP2, and I am sure, it will definitely help the Office developers like me, who have to work hard with Charts in PP/Word.

HTH :)

Thanks,
Vikas