:::: MENU ::::

wpf chosen control or multi select combo box

Right now i am working on WPF  Desktop app where i needed a control like multi select combo box or a chosen control where user can select multiple items simultaneously instead of single one. WPF has built in control ListBox but that does not fulfill my requirement.So My solution is actually the extension of Santhosh Kumar‘s Solution.All i have done is that i have made it more user friendly by introducing chips (tags) and made these scrollable. I also made it developer friendly so it can be used with any Collection even by using MVVM pattern without modifying back end code of chosen control.So binding is as simple as other WPF controls for instance List Box. Below is the quick visual introduction of this User Control.

wpf-chosen

The above image can show you the basic features of this User Control.

  1. It allow you select multiple items
  2. It has two basic buttons to select or clear the selected Items
  3. it allow you to show default message
  4. it allow you to scroll the chips (Tags)
  5. it allow you to remove the chips by cross button

 

Here i will only discuss how this control can be used in MVVM. I hope you already aware of MVVM patter in WPF. You can fork the complete repository here

Pleas share your thoughts in comments.


What’s Next as Freelancer ?

I am .net software engineer with 7 years of experience.The projects i have been worked includes from simple desktoptop applications to Complex web applications.Most of my experience is earned from local software houses but at the same time i am 100% Top Rated Upwork Freelancer now and i worked there for 1100 hours plus some fixed price projects. I have developed there web,desktop,server side applications based on web-scrapping, amazon AWS and MWS . Although I am Top Rated Developer there but still i am not getting Long term projects that i should,  in order to grow up. Although as freelancer you can learn a lot of new things. But i am not interested to do simple task with a very low price.I want to do some challenging task in order to grow myself as Software architect, because I am very hardworking and dedicated Person.I love to do Tricky Task, the more challenging Task are more interested to me.So i joined a local community Tech Hub Connect of Freelancers Organised by Govt Of Pakistan, From there after researching i cam to know about a lot more freelancing platforms one of them is  TOPTAL.com. I love to join TOPTAL due to a number of reasons.

  1. There are Hundred of thousands people are going to apply on TopTal but only Top 3% People get Enroll there.Because they have developed very tough screen process to get best Engineers. I see that the engineers who are accepted at TopTal work for clients such as the AirBNB , KDDI
  2. In contrast with Other Freelancing Platforms  they have long term projects which is best to grow your self  as Freelancer,you do not have to work at very low rate with short term projects or minor fixes.
  3. One major problem with other platforms is that you have to look for a good job. And you should always bee there to bid in time. But there TopTal promise you if you accepted there they will give you an opportunity.

Anyway, I’ve just began the interview process at TopTal.com (to become a part of the Web engineers community), and I really like to get in and become one of the freelancers who work there.I would recommend you at least explore TopTal.com ,Find your opportunities there once you think you are a best.


Create Transparent animated start using winform

Sometime we want to create a irregular shape from winform which is rectangle or square by default.
So i am telling you here how can you convert a Form into animated Start. you can see the output at bottom.Every winform object holds TransparencyKey  property which is used to make any color transparent on the form.So if i set the transparency Key to white Color at same time set the back ground color of the form to white then whole form will disappear. Now if i draw star on the form using blue color then i will see only the blue start on the form.
lets try the below code to see it in action.

here is the output.

start a


convert html to pdf using c# asp.net and wkhtmlToPdf

wkhtmlToPdf is a console application which converts any given html or webpage url into PDF.
here i am going to convert a webpage or html code into PDF.in the below class i have overloaded function “Convert” which takes HtmlCode or Uri with wkhtmlToPdf executable path.

You can download a complete working solution here. Fyi, The repository contains WkhtmlPdf Console application as well.

 


Bunch of Useful extension methods

Introduction

Most favorite things about C# 3.0 compilers  is the extension methods. Extension methods allow us to extend an Existing Type without deriving ,modifying  or recompiling it.If you ever worked with LINQ  then I am sure you are  already  used the extension methods because LINQ holds bunch of extension methods.here is how visual studio indicate the extension methods with an existing type.

linqExt

an arrow with a method indicates an extension method

 

extension methods greatly simplify the methods call.Actually An extension method is static method  existing in a static class.Before diving into the detail let’s  create an extension methods which will reverse the order of words inside a given sentence.

here is how you will use it.
basically it is just a syntactic sugar,at compile time this methods call is turned into an ordinary static method call

Specification of an Extension Methods.

  1. Extension method must be a static method.
  2. It must be located inside a static class.
  3. Extension method’s first parameter specifies the type of the extended object, and it must preceded by the “this” keyword.
  4. Extension method should be in the same namespace if  namespace is different then we need to include the namespace
  5. An extension method couldn’t override the existing instance methods.

Now i would share some helpful extension methods

SmExtensionMethods

This is common practice when we want to convert a string into integer and if there is exception then assign a default value in order to deal with this situation i have written some extension methods which beautifully converts a given string into primitive types like int , long short and gracefully handle above exception see an example here.

in this above extension method we try to convert a string into int?  if there is an exception we will return simply nullable Int so let the caller to handle the NULL Exception and here is how you can use it.

in this above example we are using ?? operator called null-coalescing operator It returns the left-hand operand if the operand is not null; otherwise it returns the right hand operand.
See below even more examples

You can fork the complete library on  github


Pages:123