Friday, August 19, 2011

Simulating MaxLines property in Silverlight TextBox

You must have noticed that Silverlight TextBox control is missing the infamous MaxLines property which is a quite useful property in WPF TextBox and that's why you're reading this. 

I have had this requirement since last week about putting a limit on the number of lines you can write in a multiline (AcceptsReturn=true) TextBox in Silverlight 4 and was disappointed to know that there is currently no way you do it like in WPF. In WPF, the TextBox control has an integer property called MaxLines which you can set to limit the number of lines. In Silverlight, there seems to be no way because you wouldn't possibly know when or where in the string a word wrap split has occurred. It would be simple if you are using a fixed-width font like Courier/CourierNew because you can simply count the number of characters that would fit in one line, but in my case, its Comic Sans. The client insisted that they wanted this feature so I decided to write my own logic to simulate the word wrap algorithm used in Silverlight TextBoxes. So I had no choice but to take the challenge. 

Read More from: Original Source

Silverlight for Windows Phone Toolkit - August 2011 (7.1 SDK) Released

Microsoft released the new stable version of "Silverlight for Windows Phone Toolkit (SDK 7.1)" at Codeplex. This is the first stable build after the February 2011 release. This release features several new controls and fixes to the existing controls.   In this post find the new controls that has been added to this release. Also find the setup link and urls to the release notes.   What's New in August 2011 Release? In this release the Windows Phone 7 Toolkit team added the following new controls to the library: PhoneTextBox DateTimePickers LockablePivots MultiSelectList LongListSelector HubTitle ExpanderView HeaderedItemsControl They also updated several existing controls which improves performance and several bug fixes. Till now, the following controls are present in the Toolkit: AutoCompleteBox, ContextMenu, DatePicker, DateTimeConverters, DatePicker, ExpanderView, GestureService/

Creating New Website in local IIS using Visual Studio 2010

Before writing anything, I will say this is a very simple article for those who don't know how to create website in IIS and navigate that website without opening Visual Studio IDE always. Means just open the browser and navigate that local websites. Actually such system has very huge advantages if we are working on intranets (in simple, local internet called intranet). Means if we have dozen of computers under network and one of the PC has server configuration then such websites can be available on each PC on network. Many companies has adopted such service, BSL is one the example who is using such services since decade.

Look at below, I have opened a ASP.NET website without Visual Studio IDE. 

Read More....

Working with DateTime data type in C#



This DateTime data type represents an instance in time, typically expressed as a date and time of day.


So first let's learn about the default constructors of DateTime.

Read More....

Thursday, August 18, 2011

Some Best Practices for Silverlight Application Development (XAML)


I was working with WPF/Silverlight since March 2008 and learnt lots of things. I wrote lots of Articles on Silverlight and published in my Blog. Today I decided to share you some of the best practices you should follow while doing development in WPF/Silverlight. Hope, this will help you guys while writing XAML codes. Read and try to strict with the guidelines whenever you are modifying your XAML.


Feedbacks are always appreciated. Hence, don't forget to leave your comments at the end. If you have any more points, please share it here. I will review them and add those here.


Update [08-Aug-2010]: On popular demand, I updated this post with some explanation on "Why?".


Some of the XAML coding best practices mentioned below:

  • Don't use unnecessary "xmlns" namespaces in the XAML file. This overburdens the load time of the Silverlight page (If you are using Resharper, you can do this very easily as it will change the color of the unnecessary items to Grey). 
  • Don't add same namespaces multiple times in a single XAML page. It screws up the XAML code at the time of maintenance and also loads the assembly namespace multiple times causing various memory issues at runtime. 
  • Use proper name for your "xmlns" namespace prefix. For example: xmlns:commonControls is more meaningful than xmlns:cctrl. This avoids multiple declarations of namespaces in future. 
  • Try avoiding "xmlns" namespace prefix name as "local". Instead use "localControls" or "localConverters" etc. as per your namespace name. Using "local" will not give you proper meaning. In the same assembly there may be two or more namespaces (e.g. Controls, Converters etc.). In such case, it will be helpful for you to use proper prefix name to distinguish between them in proper way. 
  • When adding a control that has no elements inside it, better to close it by self-closing tag "/>" instead of the hard closing tag (</TAG>). This gives more cleaner XAML code.  
  • Remove all unnecessary resource keys if they are not in use. These increases the memory uses and you may sometime encounter some animation issues due to this. If you need it at later point of time, you are always welcome to add it. 
  • Don't use extra panels (e.g. Grid, StackPanel, Canvas etc.) unless it is required. 
  • Always try to use Grid as your panel first and if you require other panels, use them. Grid has the flexible UI layout and thus resizing your application will have a great effect. 
  • Never try to give a name to all of your controls inside your Silverlight page as it takes unnecessary object creation at the time of load. Name only those elements which you want to use from your code behind and/or from your xaml. If you are using MVVM pattern, you can remove the naming of your controls in almost all the cases. 
  • Use the Visibility property of the controls instead of the Opacity property to hide the content. Opacity to zero makes the control to hide but takes space in both memory and the UI. Other side, the Visibility property collapses the control from the UI, thus making spaces for the other controls in the same place. 
  • Use proper formatting of your XAML code. This gives better look of code and also easy to maintain in future. 
  • Use comments in XAML whenever require. This is useful when you revisit the code after a long time or some other person comes to work with your XAML file. 
  • Try to use StaticResource instead of DynamicResource as it increases the performance and also it throws exceptions at development time. Hence, easier to identify the root cause. 
  • Remove unnecessary styles & storyboard animations if they are not require at all. 
  • Try to add your styles in a separate file if you want to share them across your application. If they are specific to a single page then add them in the page resource.

Wednesday, August 17, 2011

Working with Default FontSize in Windows Phone 7 Applications

Hope you already read my article series "Collection of Windows Phone 7 (Mango) Tutorials". During the tutorial series, we used the common styles "PhoneTextNormalStyle" and "PhoneTextTitle1Style" in the TextBlocks added to the TitlePanel. So what are those? These are all common styles defined by the style library of WP7 SDK.   In this post, we will learn about various font sizes defined in the default style library of Windows Phone 7. So, you don't have to define them again and can reuse those styles which will be standard sizes all over any Phone 7 Applications. Let's discuss them here. Read to know more about it.   Background In XAML pages of Windows Phone 7, you will find the default styles used in the XAML for titles inside the TitlePanel. They uses some default font sizes internally and if you want to use them in your application, you can follow this post to understand them easily.   The font sizes are already defined for...

A Custom Control in Silverlight 4

In Silverlight Projects I have seen using Custom Controls are vast. Now when I was studying about CustomControl I learned a lots of things on that . But in searching in internet there also various site regarding on that . MSDN is one of them good resources and others site are also available describing the CustomControl good enough. Whatever I have seen Custom Controls are like Textboxes, Text Blocks, Combo boxes, DatePickes etc . Now it is a little bit confusing that when Microsoft is providing So many controls & u can easily get it in ur ToolBox of ur VisualStudio2010 Silverlight Projects. So what is the meaning of CustomControls & I have also written the example of customcontrols like TextBoxes, DatePicker….. Well , we are going little deep of its basics.

Tuesday, August 16, 2011

RelativeSource Binding in Silverlight

Sometime we need to bind the same data in different properties of the same control. For example, in some cases we need to show text in a TextBlock and also want to show the same text as a Tooltip to that TextBlock control.   How to do it? It's very easy to bind the same value twice in the control. But is there any other way to implement the same? Let us discuss this today in this blog post. If you are not aware of it till date, you will definitely like.     Let us discuss the common way to implement this. As we discussed we can bind data in multiple properties of the same control like this:   <TextBlock Text="{Binding Information, ElementName=userControl}" ToolTipService.ToolTip="{Binding Information, ElementName=userControl}" HorizontalAlignment="Center" VerticalAlignment="Center"/>   If you want to do this in similar way, you have to define a...

Improving Your App Store Rating

Lets face it, 80% of the apps out there are garbage. They either don't solve a problem well, they were poorly built, or just don't work at all. These apps deserve bad public ratings and don't belong anywhere on the app store charts.

Then there's the other 20% that are backed by passionate designers and developers changing how we interact with technology. People like Mobile Orchard readers :) These apps deserve recognition.

Even great apps get negative feedback, and that's OK. Feedback is a great thing when we can learn and improve from it. What's broken is that when someone leaves a negative review in the app store, it scars your app for life, you can't respond to it, and you can't learn more about the problem in order to fix it quickly.

Read More....

C# Out Parameter Explored

To understand this behaviour I have written a small piece of code containing a caller function with an out argument and a callee function with an out parameter.

Looks like an October release for the iPhone 5, no iPad 3 until 2012

It is being reported that the iPhone 5 or 4S, whatever they are going to call it, is now going to be released on October 7th. Previously it was reported that the next generation iPhone would be out on September 7th.

Apple's next generation iPhone, be it an iterative "iPhone 4S" or a completely revamped "iPhone 5" could go on sale October 7 in the US. That's a Friday, which isn't uncommon for iPhone launches. Originally it sounded more like a second week of October launch, more like October 14, but now it sounds like the first week. We're still hearing that an "iPhone 4S"-style device, with improved processors and optics, is more likely than an all new design, but given the many and varied rumors, it's impossible to tell for sure. It could even be that the "iPhone 4S" is the budget iPhone Apple supposedly completed work on just before WWDC 2011 (the iPhone nano, so to speak), and the "iPhone 5″ is the new high-end model. That could explain the supposedly conflicting rumors.

Source: New iPhone on October 7, no new iPad until spring 2012

Monday, August 15, 2011

Fetching Picasa Images through RSS in WP7

Today in this article we will discuss how to fetch feed from Picasa and display images from that RSS feed to your Windows Phone 7. This will not only clear the image feed mechanism in WP7, but will also help you to understand how to read RSS feed in Windows Phone 7 or in a Silverlight application.   After reading this article, you will be able to fetch any feed and display specific content in your application. Hope, this will help you. Don't forget to share it to your followers and if you have any query, drop a line below.   Background In this article we will demonstrate the use of RSS in Windows Phone 7 application by a small demo application. To do this, we will use a public Picasa feed, which will return some public photos from the server.   This is how the feed "" constructs:   <channel> ...

Application Loader

Editor's Note:The Application Loader app is available on your development system if you have installed iPhone SDK 3.2 or later – you can locate the Application Loader in the Utilities folder:/Developer/Applications/Utilities/Application

If you've ever had to upload a binary to the App Store that has any size to it, say, over 20 MB, it's a little unnerving when you upload through a web-browser and the only status you get is whatever progress indicator your browser offers. Problem is, you can't rely on the indicator as a reliable source of information about whether your connection is still alive, or even more meaningful, how far along you are in uploading a large binary.

Apple recommends the loader for binaries that are over 200MB. I've used it for applications that are much smaller as I find the information it provides of great value. You can find the loader by following these steps from within iTunes Connect:

  • Choose Manage You Applications
  • Scroll to the bottom of the page
  • Click the Get Application Loader link
  • Click the Download Developer Guide link (good stuff in here, btw)

To use the loader, during the process of adding a new application to the App Store, when prompted in iTunes Connect (on the Upload tab), click the checkbox that says Check here to upload your binary later.

Complete the rest of the information required for uploading an application. To begin uploading with the loader, start the application and select New from the file menu. You'll be prompted for your login information to connect to iTunes. At this point, if all is well, you'll be shown a dialog box that has a drop-down list of all the applications iTunes Connect recognizes that are waiting for a binary. The rest of the steps for uploading are self explanatory as the loader walks you through the paces.

Important Note:
There is one gotcha that I ran into when rejecting a binary and attempting to re-upload a new binary with the loader. After rejecting the file, I created a new build and fired up the loader. Unfortunately, the loader did not recognize that there were binaries to be uploaded into my iTunes Connect account.

Here's what I had to do to fix the problem:

  • Login into iTunes Connect (with a web-browser)
  • Choose Manage You Applications

You'll see a dialog similar to the figure below for each application in which you rejected a binary:

  • Click on the Replace Binary
  • From the Upload Application screen, click the checkbox Check here to upload your binary later
  • Save your changes

Start up the Application Loader and you should now see the application you rejected earlier as an option for uploading a new binary.

Free Books from Microsoft Press

1 – Programming Windows Phone 7

Programming Windows Phone 7 by Charles PetzoldThis book is divided into three parts. The first part discusses basic concepts of Windows Phone 7 programming using example programs that target both Silverlight and the XNA framework. It is likely that many Windows Phone 7 developers will choose either one platform or the other, but I think it's important for all developers who have at least a little knowledge of the alternative to their chosen path.

The second part of this book focuses entirely on Silverlight, and the third part on XNA 2D. For your convenience, the chapters in each part build upon previous knowledge in a progressive tutorial narrative, and hence are intended to be read sequentially.

2 – Moving to Microsoft Visual Studio 2010

Moving to Microsoft Visual Studio 2010Moving to Microsoft Visual Studio 2010 was written with three audiences in mind: Part I is for developers moving from Visual Studio 2003 to Visual Studio 2010, Part II is for developers moving from Visual Studio 2005 and Part III is for developers moving from Visual Studio 2008.

Here's a little bit about the authors: Ken Haines is a software development engineer at Microsoft, working in the Consumer and Online Division. He has a passion for distributed applications in the cloud and strives to help customers and partners find the right solution for their needs.

3 – Introducing Microsoft SQL Server 2008 R2

Introducing Microsoft SQL Server 2008 R2This book is for anyone who has an interest in SQL Server 2008 R2 and wants to understand its capabilities. In a book of this size, we cannot cover every feature that distinguishes SQL Server from other databases, and consequently we assume that you have some familiarity with SQL Server already.

You might be a database administrator (DBA), an application developer, a power user, or a technical decision maker. Regardless of your role, we hope that you can use this book to discover the features in SQL Server 2008 R2 that are most beneficial to you.

4 – Understanding Microsoft Virtualization Solutions

Understanding Microsoft Virtualization SolutionsIf you want to learn more about latest Microsoft virtualisation technologies, so that you can differentiate your Hyper-V from your Remote Desktop Services, then this's the job.

It covers Microsoft Virtual Desktop Infrastructure, Application Virtualization 4.5, Enterprise Desktop Virtualization, Windows Virtual PC and Windows XP Mode, System Center Virtual Machine Manager 2008, and Microsoft's private and public cloud computing platforms including Windows Azure.

5 – Own Your Future: Update Your Skills with Resources and Career Ideas from Microsoft

Own Your Future Update Your Skills with Resources and Career Ideas from MicrosoftIn this book, students will find a wealth of Microsoft resources they can use to identify the technology skills they need, and gather knowledge and experience to help them take charge of their careers.

Here at Microsoft, we care about students' career success and hope these resources will open doors to learning that will lead them to better opportunities and a deeper understanding of the way technology continues to change and improve the ways people work—both here in the U.S. and around the world.

6 – Introducing Windows Server 2008 R2

Introducing Windows Server 2008 R2This book is targeted primarily at Windows server administrators who are responsible for hands-on deployment and day-to-day management of Windows-based servers for large organizations. Windows server administrators manage file and print servers, network infrastructure servers, Web servers, and IT application servers.

They use graphical administration tools as their primary interface but also use Windows PowerShell commandlets and occasionally write Windows PowerShell scripts for routine tasks and bulk operations. They conduct most server management tasks remotely by using Terminal Server or administration tools installed on their local workstation.

7 – First Look Microsoft Office 2010

First Look Microsoft Office 2010This book introduces you to the changes in Office 2010 and shows you how you can make the most of the new features to fit the way you work today. Chapter 1, "Welcome to Office 2010," gives you a play-by-play introduction to new features.

Chapter 2, "Express Yourself Effectively and Efficiently," details the great feature enhancements and visual effects throughout the applications; and Chapter 3, "Work Anywhere with Office 2010," explores the flexibility factor by presenting a set of scenarios that enable users to complete their work no matter where their path takes them and so on.

8 – Deploying Windows 7, Essential Guidance

Deploying Windows 7Deploying Windows 7 Essential Guidance from the Windows 7 Resource Kit and Microsoft TechNet Magazine. Looking for guidance specific to Windows 7 deployment?

Check out what the industry's leading experts have to say in this free Microsoft Press eBook with selected chapters from the Windows 7 Resource Kit on Deployment Platforms, Planning, Testing Application Compatability, and 8 Common Issues in Windows 7 Migrations

Sunday, August 14, 2011

Lion 101: How to know more about your Mac

New Mac owners don't often know things about their computers that might prove otherwise helpful, like exactly what model they have (is your iMac the early-, mid- or late-2009 version, for example) or how much RAM they have installed. Luckily, OS X Lion organizes that info in a slightly better way, and there are also web and app-based tools to help learn all the intimate details regarding their machines.

Lion's system information

Right in your computer's Apple menu (under ), the first item in fact, is the "About This Mac" utility. Clicking on it will bring up a small window that prominently says which version of Mac OS X you're running, which processor your system has, how much RAM, and the name of the startup disk (the drive the computer boots from). There are two clickable buttons in this window: one takes you to Software Update, and the other, which we'll be using, is labelled "More Info…" and takes you to the System Information app.


Example of Implemeting interface in structure and in class

Structure type is value type and class type & interface type is reference type. In this article explains how to verify that the interface is reference type even if it is used in structure( structure is value type)

Whenever we implement the interface in structure and assign the instance of that structure to an interface variable then it becomes reference type, however when we access the structure instance object directly then it is accessed as value type.

Below is an example of this scenario.

Hosting a Windows Forms control inside a WPF

Windows Forms can be hosted inside a WPF application using WindowsFormHost. In this post I will show how easily you can use WindowsFormHost to host a windows Form content inside a WPF application.

Step 1:

Create a Windows control library application. Lets put something really simple in it. I have put one Button and one Textbox.

Read More....

Friday, August 12, 2011

How can you detect Browser Information in Silverlight?

Sometime we need to detect the browser information of the user's computer where our Silverlight application is running. We can do this using the JavaScript but sometime it is useful to detect it from our Silverlight application. So, how to do it? Let us discuss this with a small simple example.   Read this post to know how to detect the browser information using the HtmlPage.BrowserInformation property.   Know about HtmlPage.BrowserInformation Detecting browser information is not much difficult. You can use the inbuilt HtmlPage class available in the namespace called System.Windows.Browser. The class has static property called BrowserInformation of type BrowserInformation. This returns the following properties:     public sealed class BrowserInformation { public string ProductName { get; } public string ProductVersion { get; } public string Name { get; } public Version BrowserVersion { get;...

Wednesday, August 10, 2011

25 Useful SQL Server Tutorials For .NET Developers

Here's the list for your reference:

SQL Server Tutorials on Date Time - One of the most frequently asked question by SQL developers, is on handing Date, Time and other related datetime values in SQL Server. Developers are always looking out for solutions which demand either converting Date Time Values or finding date time ranges and so on. Madhivanan and I have already written a couple of articles on handling DateTime in SQL Server. In this post I will share some of the links with you.

Troubleshoot Deadlocks using SQL Server Profiler 2005/2008 - In this article, we will see how to capture deadlocks while modifying data using SQL Server Profiler in SQL Server 2005/2008

SQL Queries – beyond TRUE and FALSE - Most of the SQL novices are more accustomed to thinking in terms of two-valued logic (TRUE, FALSE) in SQL. But SQL uses three-valued logic – TRUE, FALSE and UNKNOWN. It means that the value of an expression may be TRUE, FALSE or UNKNOWN. Confused?

SQL Server: Search Similar String in a Table - There are may ways to look for similar strings in a SQL Server column. The most common method is to make use of LIKE operator. Let us see the different ways to look for similar string in a table.

SQL Server: Calculate Summary and Column Summary - This post shows how to show a summary of similar rows as well as column summary for SQL Server table data. Suppose you want to generate the total of a column and display it at the end of the result set.

SQL Server: Common mistake while Calculating Quarter Sales - When it comes to calculating quarter sales, I have always seen developers grouping only by quarter which is incorrect.

Load Comma Delimited file (csv) in SQL Server - We often need to import data that comes from different data sources, into a database like SQL Server. Usually data comes in the form of a comma delimited file aka CSV file. These are the two easy ways to import data from a CSV file into a table of a SQL Server Database – Using Bulk Insert and Using SQL Server Management Studio.

SQL Server: Export Table to CSV - Exporting data from SQL Server to a .csv file is often needed to use that data into a different system. There are two easy ways to do this – using BCP and using SQL Server Management Studio.

SQL Server: Insert Date and Time in Separate Columns - If there is a need to store date and times values in separate columns, you can store Date values in the Datetime column and Time values in either the char datatype or the time datatype (Sql Server 2008), as shown in this post

SQL Server: Distinct Count across Multiple Tables - One of my clients had a SQL Server database with an email column repeated across multiple tables. He wanted two queries – all email's that are not repeated across the table, i.e. distinct ones as well as a count of the email addresses across multiple tables in the database.

SQL Server: Highest and Lowest Values in a Row - Calculate both the highest and lowest values in a row without using an UNPIVOT operator.

Fastest Way to Update Rows in a Large Table in SQL Server - Many a times, you come across a requirement to update a large table in SQL Server that has millions of rows (say more than 5 millions) in it. In this article I will demonstrate a fast way to update rows in a large table

SQL Server–Error Handling using Try Catch Block - In this post, we will see how to handle errors in SQL Server 2005 and 2008. In SQL Server 2005, Microsoft has introduced a new construct to handle errors in SQL Server that is 'TRY – CATCH'. It is similar to .NET 'Try – Catch' block for handling the exceptions

SQL Server: DateTime vs DateTime2 - The datetime2 datatype was introduced in SQL Server 2008 along with the date and time datatypes. Unlike the datetime datatype in SQL Server, the datetime2 datatype can store time value down to microseconds and avoids the 3/1000 second rounding issue.

XML Basics in SQL Server 2005 and 2008 - In this article, we will see how to write basic queries to insert, query and generate XML data in SQL Server 2005/2008. For this demonstration, I am using the 'Northwind' database.

SQL Server: Combine Multiple Rows Into One Column with CSV output - In response to one of my posts on Combining Multiple Rows Into One Row, reader "Pramod Kasi" asked a question – How to Combine Multiple Rows Into One Column with CSV (Comma Separated) output. This post explains how to do so.

SQL Server: Count based on Condition - Many a times, you may want to do a count in SQL Server, based on a condition. The easiest way is to use a combination of SUM and CASE as shown in this article

SQL Server: Convert to DateTime from other Datatypes - In this post, we will see how to convert data of different datatypes to a DateTime datatype, in SQL Server.

Rollback Transaction in SQL Server - In this article, I have explained how to use a Try..Catch block to commit and rollback transaction

Rollback Nested Transactions in Stored Procedure - SQL Server - In this article, we will use an example to see how to rollback nested transactions in Stored Procedures

Concatenate Strings in SQL Server - Different ways - There are many ways to concatenate data in a single column. This post shows some of these ways.

SQL Server CLR User Defined Function using Visual Studio 2010 - In this post, we will see how to create a User Defined Function using Visual Studio 2010

Check if Database Exists In SQL Server – Different ways - A very frequently asked question is how to to check if a Database exists in SQL Server. Here are some different ways.

Find the Most Used Stored Procedures in SQL Server - Let us see how to use the sys.dm_exec_query_stats DMV to return the 3 most used stored procedures in your SQL Server database

Find the Nth Maximum and Minimum Value in a Column - Here's a simple query to find the Nth Maximum and Minimum values in a SQL Server table column using the Row_Number() function. We will find the 3rd highest and 3rd lowest values in the column.

Why Visual Studio Debugger is not working for my Silverlight Application?

"Why my Visual Studio debugger is not working for my Silverlight application?" - it's not a new question. People ask this several time in different forums. If you search on net, you may probably find the solution. But, in this post I am just sharing the solution once again for my blog readers and anyone on the net who may face similar issue in future.   In this post, I will share you 4 small tips. Just follow the steps from top to bottom and let me know which one resolved your problem. This tip might not be a new thing for you but don't forget to share to others. This could be useful for them.     One of my blog reader "Raksha" was facing an issue with her Visual Studio debugger. She was not able to find out the way to enable the debugging feature and came to my blog to ask me this question for help:   While working with the Silverlight application, I found that it is not following the breakpoints while running the...

Tuesday, August 9, 2011

Create new folders in Windows 7 with hotkey.

Windows 7 includes the ability to add new folders with a keyboard shortcut key combination.
To create a new folder, we normally right-click, select New > Folder. But Windows 7 lets you do it with a keyboard shortcut too.

To do so, simply press Ctrl+Shift+N in an open explorer window & the folder will be automatically created instantly show up, ready to be renamed to something more useful.

For example, click on the desktop and then press Ctrl+Shift+N. You will see that a New folder is created instantaneously all ready to be re-named! You can open in this fashion in any Windows 7 explorer window.

Monday, August 8, 2011

How to Close Browser Window from Silverlight Application?

All most all secured sites like bank websites asks you to close your browser window after you signed out from the web application. This is due to high security which actually removes all session details from the browser cache.   If you want to develop the same behavior in your Silverlight application, how will you do this? This post covers the code to implement the functionality of the same. Read to know more.     If you are developing a secured site and want to close the browser window just after the user logout from the application, this small tip will help you. This is not a difficult job to implement. Just a single line of code will do the trick for you.   Use "System.Windows.Browser.HtmlPage.Window.Invoke()" method to call the Close() method of the browser window as shown in the below code snippet:   private void OnCloseClick(object sender, RoutedEventArgs e) { ...

Remove Default Empty Column From DataGrid

Need to remove extra default column from the datagrid when you bind datagrid with records. In the Image 1 you can see the extra default column when you bind the data grid control. Sometime it is required to remove that extra empty column.

Sunday, August 7, 2011

Converting XML data to CLR object using XmlSerializer

My last Post (Consuming Webservice from Silverlight) was all about accessing a web service/api from Silverlight , there i described how to consume an external api ,with a sample from GeoName web services .As i had concluded there ,this post is the continuation of previous .Here i am going to demonstrate How to convert the result output , which is in XML, to CLR object and of course using it as datasource in SL app.

Authentication against custom Table In Silverlight4 Using RIA Service

In my previous article we had discussed about Data Binding ,Validation,Exception Handling ,Handling Multiple table and many more.But the first step in a business application deals with Authentication.Surely nobody wants data to be meshed up by an anonymous user so in this article we are going to implement Authentication to SOI (States of India) application.This post is restricted to FormsAuthentication model only.Also i am going to skip Authorization and due for next article.

Well authentication in Silverlight 4 using RIA service in business application can be implemented by 2 ways

  • Using Default authentication provided by Silverlight Business Template (Using ASP.Net Role and Membership)
  • Using Custom Authentication (Using your own database and  model )

You can find number of post/articles available in blogs that's deals with default authentication with Asp.Net membership provider .If you want to find know more about  this MSDN article worth a look .

SO lets start with Authentication using your own custom table for application.

Could not load the assembly , assembly may have been downloaded from the Web.

When I downloaded State Of India app and tried to built it I got the exact error message as above.As it is mentioned to unblock the particular assembly.So open to the assembly folder and follow the following steps

Performance tips for RIA Service with Silverlight 4

Performance is a vital part for any application possibly more important for web based app.With wizard based approach of RIA service generally we tends to comprise all entities, exposing to the client and also allowing the DomainService to go for everything from the database. Not only this approach takes a toll on security, but also it loads the middle tier unreasonably.
So this post is about few tips using which we can improve the performance. Well mostly we will cover the Pagination, Limiting Query results and Output cache of the results