Saturday, December 12, 2009

WPF an Introduction


ShareThis
WPF is Microsoft's unified presentation subsystem for Windows and is
exposed through .NET Framework v3.0, Windows Vista's managed-code
programming model.

Windows Presentation Foundation (WPF) consists of a display engine that
takes full advantage of modern graphics hardware and an extensible set of
managed classes that development teams can use to create rich, visually
stunning applications. WPF also introduces Extensible Application Markup
Language (XAML), which enables developers and designers to use an XML-based
model to declaratively specify the desired user interface (UI) behavior.

Windows Presentation Foundation provides a unified approach to user
interface, 2D and 3D graphics, animation, documents and media. It allows
designers to be an integral part of the application development process.

Since the initial release of the .NET Framework, many applications have
been created using Windows Forms. Even with the arrival of WPF, some
applications will continue to use Windows Forms. For example, anything that
must run on systems where WPF isn't available, such as older versions of
Windows, will most likely choose Windows Forms for its user interface. New
applications might also choose Windows Forms over WPF for other reasons,
such as the broad set of controls available for Windows Forms.

Letting WPF applications use these existing controls can make sense in some
cases. Conversely, WPF offers many things that Windows Forms does not, such
as 3D graphics and animations. Allowing an existing Windows Forms
application to incorporate parts of WPF's functionality also makes sense.

Both of these things are possible. A WPF application can host Windows Forms
controls, and a Windows Forms application can host WPF controls. A user can
interact with WPF dialogs and Windows Forms dialogs in the same
application, typically without being aware that there's any difference.

To host Windows Forms controls, a WPF application relies on WPF's
WindowsFormsHost control. Similarly, a Windows Forms application uses
ElementHost, a Windows Forms control that's capable of hosting WPF
controls, panels, and other elements.

The tools for each technology can also work with software written for the
other. WPF's Visual Designer can be used to position Windows Forms
controls, while the Windows Forms designer can be used to position WPF
controls.

Using WPF and Windows Forms together does have some restrictions. Layering
a WPF control on top of a Windows Forms control won't work, for example;
the Windows Forms control will always be on top. WPF's transparency effects
also won't work well with Windows Forms controls, nor will WPF
transformations. And because the WindowsFormsHost and ElementHost controls
require full trust, a WPF application that uses them can't run as an XBAP.
Still, a large percentage of Windows applications can use both WPF and
Windows Forms to create their user interface.

This Text is an extract from this post written by Linda Liu.

Thursday, December 10, 2009

WPF, Webservices and Cross-Domain Issue


ShareThis
Today I faced an issue in a Silverlight web app.
While accessing a Web-service from Silverlight that was within the same Solution in the VS.

The error i got says like :

‘http://localhost:4522/MyService’. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.

By placing a Cross-Domain policy file at the root of the web app solved my problem.
I found a suitable solution that describes about the problem in details and a complete solution.


The crossdomain.xml looks like this:

Silverlight is interesting


ShareThis
During last couple of days I have started to work on Silverlight. From last year onwards many times I tried to start on Silverlight but could not due to time constraint. But I am enjoying it now.

Silverlight is interesting. Though Visual Studio has not up till now full support for designing Silverlight apps and you have to go back and forth to Expression Studio and VS but I liked it.

Today almost all of the work that Silverliht can do can also be done using Java Script and Ajax but there are few advantages of Silverlight, like its platform independent, cross-browser full support, consumes less resources on the browser side. That means it loads fast.

I have seen few web application completely built on Silverlight. No other things no AJAX . only html and Silverlight.


For developing Silverlight apps you only need to know WPF, its basic Class libraries and any of the dot net Compatible language - like C# or VB.net.

In the coming days I will share my learning curve and exploration in Silvetlight.

Enjoy programing !!!