Wednesday May 9, 2012 at 09:30 PM | Posted by: danielj | Category: Microsoft | .NET

As a provider of .NET components, Syncfusion is in the exciting, but challenging, position of always being on the cutting edge. Whenever platforms or tools ship out of Microsoft, which seems to be about every other week these days, we have to educate ourselves quickly.

A lot of information on application development is available, but that information is becoming harder to digest. More and more books are being published, even on topics that are relatively new; one aspect that continues to frustrate us is the inability to find technology books that offer a concise overview. When trying to gather information, we are usually faced with two options: read several 500+ page books, or scour the Web for relevant blog posts and articles. As with everyone who has a job to do and customers to serve, we find this quite aggravating.

This frustration translated into a deep desire to produce a series of concise technical books that would target developers working on the Microsoft platform. We firmly believe that, given the background knowledge such developers have, most topics can be translated into books that are around 100 pages. This is exactly what we resolved to accomplish with the Succinctly series.

The best authors, the best content

Each author was carefully chosen from a pool of talented experts who shared our vision. You will find books that contain original content guaranteed to get you up and running in about the time it takes to drink a few cups of coffee.

Forever free

Syncfusion will produce books on several topics. They will always be free. Any updates we publish will also be free. We can hear you say, "What is the catch?" There is no catch here. Syncfusion has a vested interest in this effort. As a component vendor, our claim is that we offer deeper and broader frameworks than anyone else in the market. Developer education greatly helps us sell against competing vendors who promise to enable AJAX support with one click or turn the moon to blue cheese!

The first book in this series, jQuery Succinctly, will be on the popular jQuery library. It is currently available for download.

As always, please let us know what you think. If you have any topics of interest, thoughts, or feedback, please feel free to send them to us at succinctly@syncfusion.com. We sincerely hope you enjoy the series. Thank you for reading.

 

Wednesday May 2, 2012 at 06:52 PM | Posted by: danielj | Category: WPF | LINQPad

I love using LINQPad to create and test quick snippets. LINQPad brings some of the instant gratification associated with dynamic languages, such as Python and Ruby, to C#. Until recently, I had not used LINQPad to work with UI code.

A few days ago, I was looking to test a small WPF code snippet. I figured there must be a way to use LINQPad. Several searches later, I had a working snippet that I have been using since. The code is quite simple, and it turned out that LINQPad has great built-in support for WPF through the PanelManager.StackWpfElement and PanelManager.DisplayWpfElement API calls. These calls allow you to create UI elements inside a named panel displayed in the lower pane beside the results window. Additional details are available at http://www.linqpad.net/CustomVisualizers.aspx.

 

Displaying a list box

   1: var items = new ObservableCollection<Product>();
   2:         
   3:         // collection initialization
   4:     
   5:         var list = new ListBox();
   6:         
   7:         string template =     @"<StackPanel>
   8:                                     <TextBlock Text='{Binding Description}' Background='Orange'/>
   9:                                     <TextBlock Text='{Binding Name}'/>
  10:                                 </StackPanel>
  11:                             ";
  12:         
  13:         list.ItemTemplate = template.ToDataTemplate();
  14:         list.ItemsSource = items;
  15:         PanelManager.StackWpfElement(list, "WPF");
  16:         

 

Note

image

DataTemplate is instantiated using an extension method. The method takes a snippet of XAML, plugs it into a standard XAML snippet for data templates (containing standard namespaces), and then instantiates the XAML using XamlReader.Load. You can, of course, change the XAML format to include other custom assemblies.

 

Code that instantiates Data Template

   1: public static object InstantiateXAML(string xaml)
   2:     {
   3:         return XamlReader.Load
   4:         (
   5:             XmlReader.Create(new StringReader(xaml))
   6:         );    
   7:     }
   8:  
   9:     public static DataTemplate ToDataTemplate(this string template)
  10:     {
  11:         string templateFormat = @"<DataTemplate  
  12:                                 xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' 
  13:                                 xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
  14:                                 {0}
  15:                             </DataTemplate>";
  16:         
  17:         return (DataTemplate) InstantiateXAML(string.Format(templateFormat, template));
  18:     }

 

The snippet provided in the download link below also demonstrates setting content, attaching event handlers, and obtaining access to dynamically created elements.

 

Note

You will have to add the following assembly references and namespace imports in LINQPad. The F4 key will cause the dialog that allows these to be added and displayed. Once added, you can save the assemblies as default.

 

Assemblies

1. PresentationCore.dll

2. PresentationFramework.dll

3. System.Windows.Controls.Ribbon.dll

4. System.Windows.dll

5. System.Windows.Interactivity.dll

6. System.Windows.Presentation.dll

7. System.Xaml.dll

8. WindowsBase.dll


Namespaces

1. System.Net

2. System.Net.Mail

3. System

4. System.Collections.Generic

5. System.Linq

6. System.Text

7. System.Collections

8. System.Windows

9. System.Windows.Controls

10. System.Collections.ObjectModel

11. System.Windows.Markup

 

Give it a try. This is the download link: http://www.syncfusion.com/downloads/Support/DirectTrac/92196/wpf1270257153.zip

 

 

Wednesday Apr 25, 2012 at 09:58 PM | Posted by: danielj | Category: ASP.NET MVC | Mobile | Mobile MVC | Windows Phone

By Daniel Jebaraj

Now that mobile devices have taken us by storm, most enterprise developers will, sooner or later, have to develop a mobile application of some kind. Serious consideration must be given to find the best environment for mobile development. This is challenging given that the mobile marketplace is so fragmented.

Currently, iOS, Android, and Windows Phone are the dominant operating systems in the market. Most developers want to deploy their apps on all these devices; nothing is gained by choosing only one. However, this fragmentation presents many obstacles to development: (1) Several possible platforms that can be used for development; (2) at least three IDEs for three operating systems; (3) multiple versions of Android; (4) varying access to native hardware, depending on which development environment you choose.

Doesn’t it make you long for the days when enterprise development just meant targeting Windows? This is new ground for developers, especially those of us working on the .NET platform.

Right now, as a developer, you basically have three options in front of you: Mobile Web sites, native applications, or “hybrid” applications. The pros and cons of each have to be weighed. Making the wrong choice today could mean a lot of backpedaling tomorrow.

Mobile websites powered by HTML 5 are probably the most popular option for mobile development right now. HTML 5 itself has gotten a great deal of press due to the fact that the current versions of JavaScript, HTML, and CSS have created richer Web-based applications than was achievable in the past without a plugin. Choosing this route makes sense because the Web browsers on all mobile devices are good, and relatively standards-adherent, you can be very confident that your Web-based app will render the same across multiple devices.

With mobile websites, you also work in a single, simplified structure often backed by great server-side tooling such as the ASP.NET MVC platform. What you miss, however, is extended access to native hardware. To get that, you have to choose native development.

Native development is the best way to create an app that can access and utilize native hardware. It also offers a seamless user experience. What you lose by choosing the native route is time. Deploying to each device requires your team be skilled in Objective C, Java, and C# or VB.NET. Each device requires a separate code base. That’s a great deal of development time and training spent to ensure your app reaches all devices.

Outside of mobile Web development and native development, an alternate option that has recently gained a lot of ground is the so-called “hybrid” option. Hybrid applications host a native Web browser control inside a native shell. They then display either local or remotely served Web pages.

For most developers, this solution provides the best of all worlds. It’s a good balance between the standardization of HTML 5 on the client side, the access to hardware of a native app, and the control, power, and code reuse provided by a server platform. I recently conducted a webinar on how to develop a hybrid app from scratch using an ASP.NET MVC template. Please check it out. And keep an eye on our website for updates on the bridging wrapper we’re developing for our ASP.NET MVC controls.

Thursday Apr 19, 2012 at 07:28 PM | Posted by: danielj | Category: Windows 8 | WinRT

By Daniel Jebaraj

For several months, we’ve been working with the preview version of Visual Studio 11 and initiating development of Windows 8-WinRT components. The Visual Studio 11 beta, made available at the end of February 2012, has enabled us to bring these components closer to completion over the last few weeks. Our product teams are working to complete these components for release with the 2012 Volume 3 version of Essential Studio.

Our ASP.NET MVC, Mobile MVC, ASP.NET, WPF, and Silverlight product teams have also been working to ensure compatibility with Visual Studio 11 and to leverage advances in .NET 4.5.

Syncfusion will simultaneously ship Essential Studio for Visual Studio 11 when Visual Studio 11 is released.

Wednesday Mar 14, 2012 at 08:47 PM | Posted by: danielj | Category: ASP.NET MVC | Mobile | Mobile MVC | Web

By Davis Jebaraj

For some time now, we’ve been telling you that ASP.NET MVC is an ideal platform for mobile development. We don’t say this just because we’ve always been heavily involved with MVC—we started to work with MVC when it was first released in 2009, and since then we’ve developed the most comprehensive suite of ASP.NET MVC controls on the market, not mention the widest range for MVC controls targeted toward mobile devices.

Our proclamation that you should use MVC for mobile development is rooted in certain facts surrounding the inherent nature of MVC that makes it a prime solution for mobile development. In this post, I’ll go over the advantages of MVC, the easiest way to get started with MVC, and the type of app you can expect in the end.

Regarding its advantages, first, MVC is a cross-platform development model that is a secure, server-based solution. Deploying mobile Web sites and applications from an ASP.NET MVC-based server-cloud environment is a natural fit for enterprises moving to mobile application development.

Also, the model-view-controller scheme is better for mobile development because the model and controller can be kept common for all views. You can have the same model for an iPhone as you do for a desktop. The fact that you can keep your basic business logic the same while having multiple views is key to why ASP.NET MVC is best suited for mobile applications.

With multiple views, you can create and control different layouts for a variety of devices. For example, you could have one layout for tablets and a different layout for phones. MVC gives you that degree of control.

With multiple views, the server will actually detect the type of device making a request and then provide the correct view for that device. This is something ASP.NET MVC inherently does, making life for the developer that much easier.

Where to start

If you want to get started with MVC, you can use a tool that many are already familiar with: Visual Studio. MVC support is offered in VS 2010, and that support will continue in the upcoming release of VS 11.

Also, as I mentioned, Syncfusion has developed many MVC controls targeted to take advantage of mobile environments, and we have many more coming out in April. MVC support in Visual Studio, when combined with the emerging landscape of prebuilt MVC controls, is the fastest and easiest way to get started in mobile development.

The end result

By using the paradigm of MVC, in the end you’ll have an app that is not just an enhanced Web site that is also suitable for mobile—only treating mobile as a second thought—but you will instead have an app that can fully utilize all that the mobile device offers. As a result, by using MVC, your web-based app will provide an experience as seamless as a native app.

I'll even go as far as to say that most end-users will not be able to tell the difference.


Davis Jebaraj explains why ASP.NET MVC is best for mobile development.

Tag cloud