Windows Phone Developers

Wednesday, July 10, 2013

System.Windows.Markup.XamlParseException occurred 'xClassCanOnlyBeUsedOnLoadComponent'.

 
System.Windows.Markup.XamlParseException occurred ClassCanOnlyBeUsedOnLoadComponent'. I was blank when this error has shot. Finally caught hold of the problem - A Space . 

 


All I had to do was to remove the space. Replace

x:Class ="SabarimalaiAyyapa.Page2"

with

x:Class="SabarimalaiAyyapa.Page2" Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Tuesday, June 18, 2013

Windows Phone Development : How to Create HyperLinks to External Sites / Pages using Silverlight XAML

How to Link External Websites to Windows Phone Pages using C#/VB.NET

Once you create a  +Windows Phone application with content, you will have a necessity to link it to multiple websites (External etc).

You can use either HyperlinkControl or the Hyperlink XAML Tag to achieve that.

Let's take our Sample App (refer QR Code) which has a good list of Hotels and Restaurants.

The App tries to provide links to these websites.

Adding Hyperlink Tag to the Content/Grid should help.

Exceptions while Adding Hyperlink / Navigating Hyperlink in Windows Phone Application

{"Cannot navigate to locations relative to a page."}


{"Navigation is only supported to relative URIs that are fragments, or begin with '/', or which contain ';component/'.\r\nParameter name: uri"}

The above exceptions are caused when the TargetName is not set to _blank

(or)

The http:// prefix is omitted in NavigateUri

The correct representation is given below:

<Hyperlink TargetName="_blank" NavigateUri="http://www.hotelnalaresidency.com">www.hotelnalaresidency.com</Hyperlink>

The +Silverlight code worked perfectly bringing the Website as shown below 

See also:

Hyperlink Control in Windows Forms (VB.NET) Application

How to Download File from Website using C# (.NET)

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Windows Phone/Silverlight application The type or namespace name 'XmlTextReader' could not be found (are you missing a using directive or an assembly reference?)

Windows Phone/Silverlight application The type or namespace name 'XmlTextReader' could not be found (are you missing a using directive or an assembly reference?)

XmlTextReader or XmlDocument aren't supported in Silverlight. Hence use XMLReader for reading XMLDocuments

See also:
How to Add/Load XAML Dynamically to RichTextBox Control - Windows Phone Development C#/VB.NET

Create XML Files using .NET / Create XML Files using C#

Convert an XML file to HTML file using C#

How to Get All Elements of an XML using C# (.NET)

How to add XML Declaration to an XML document using C# (.NET)

Remove DOCTYPE declaration from XML Files using C#
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Monday, June 17, 2013

How to Add/Load XAML Dynamically to RichTextBox Control - Windows Phone Development C#/VB.NET

Windows Phone Development - Populate RichTextBox Content from External XAML File / How to Read Content from External Resource File


+Windows Phone Developers are under pressure to release many updates time to time. Please have a look at the sample application that we have been asked to develop. This particular application is about Tiruvannamalai which houses Ashrams of +yogi ram suratkumar , +Ramana Maharshi , +seshadri swamigal and famous for +Girivalam tiruvannamalai .


This place was known to western world, thanks to Paul Brunton. His book - A Search in Secret India: The Classic Work on Seeking a Guru  was a best seller

Okay, we have diverted a lot. This particular application requires lot of content. A look at the App should make you understand. Have tried the following method to separate the content from XAML file and link it when necessary



Here is how it works:

  • Create Content
  • Embed As Resource
  • Create Place Holder (RTB)
  • Retrieve Resource
  • Assign to Control
 
 
 
Creating content is not an easy task. But beyond the scope of our post. Once the content is created, it has to be embedded as a resource file

Create the XAML for the content and save it as a text file and add it to the project's Resource
 
 
 

 
 
 

 
 


Ensure that the Resource is BuildAction is set to Embedded Resource. Once that is completed use +C# or +Visual Basic.NET code
the following code to get the XAML assigned to the RichTextBox using

How to Read the External ResourceFile using .NET (C#/VB.NET)

GetManifestResourceStream method is used to get the content from the embedded file as a string

private void GetXAML()



{
RichTextBox rtb = this.PageContent;

string result = "";

using (Stream stream = Assembly.GetExecutingAssembly()

.GetManifestResourceStream("Tiruvannamalai.Resources.PageContentXAML.txt"))

using (StreamReader reader = new StreamReader(stream,System.Text.Encoding.UTF8))



{

result = reader.ReadToEnd();



}
string xamlOP = @"
"
;

string xamlMid = result;

string xamlCL = "
";


rtb.Xaml = xamlOP + xamlMid + xamlCL ;

}

The Content is sandwiched between Section tags (here as separate variables) and populated dynamically to the Windows Phone. I tested this using +Nokia Lumia 710 and looks good.

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Tuesday, June 4, 2013

Xap packaging failed. Object reference not set to an instance of an object

Windows Phone Development - XAP packaging failed. Object reference not set to an instance of an object

Mostly this error occurs when there are some missing files/assemblies in the Project



 
 

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Wednesday, May 22, 2013

Microsoft Technology Stack (ESB / ETL / Big Data / Visualization / ECM)

What is the Microsoft Technology Stack for ETL / ESB and Big Data Visualization



 Some time back when I wrote a blog post on Hadoop on Azure (Microsoft Big Data Solutions - Hadoop / Hive and SQL Server) some readers wanted to list the Technology Stack from Microsoft for ETL etc. Here is what I compiled :

Analytics / BI
 SQL Server Analysis Services (SSAS)
Big Data
 HDInsight / Azure
BPMS / Workflow
 Windows Workflow Framework
Cloud
 Windows Azure
Database
 SQL Server
Enterprise Content Management
 SharePoint
ESB
 BizTalk
ETL
 SQL Server Integration Service (SSIS)
Portal
 SharePoint
Reporting
 Report Server
SOA
 Windows Communication Framework
Visualization
 Power Pivot

 
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Monday, May 13, 2013

How to Track Page (Pivot Item) Navigation in Windows Phone using .NET (C#) / Windows Phone Pivot Control Events (C#/.NET)

Pivot_Change /SelectionChange  / Page Change Event in Windows Phone using .NET

One of the commonly used Windows Phone Application Type is Pivot. A Pivot application has a Pivot control and many Pivot Items in it.
This gives a good look and feel for content rich App


How to track Pivot Item Change

Each Pivot item contains some unique information, which makes it a necessary for tracking the change of Windows Phone Pivot Items

The XAML of the Pivot Control is shown below

 <controls:Pivot Title="GNANA BHOOMI - TIRUVANNAMALAI" SelectionChanged="Pivot_SelectionChanged>;





The Pivot_SelectionChanged event can be used to track the flip / change of Pivot Item to a new one by the user


private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)



{
 
MessageBox.Show(((Pivot)sender).SelectedIndex.ToString());



}

SelectedIndex property provides the Index of the active Pivot Item
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Microsoft Big Data Solutions - Hadoop / Hive and SQL Server

How to create Big Data solutions in Microsoft Framework

For quite a while Microsoft developers were baited by Open source folks on the advancement of Big Data solutions in the open source world.

Hadoop + Hive + Pig + R gave a very good platform for Big Data solutions in Open Source platform. Slowly there are many licensed versions that are coming out of the same stack - Cloudera,  Revolutionary R etc.

Microsoft had started Big Data based solutions long back in the Labs have released different tools like PowerPivot etc. Now Microsoft has its own Big Data Technology Stack

Microsoft's Big Data Technology Stack


HDInsight is Microsoft’s Hadoop-based distribution that is available on Windows Azure

The platform can be used for storing large chunks of data (as Blobs, Tables, Columnar Database etc)


SQL Server 2012 is used for Analysis and Integration (ETL)
the SQL Server instance and the Hadoop/Hive data warehouse are
configurable to establish connectivity between them



Real-Time Example of Big Data Solution using Microsoft Technology Stack


(Big Data Solution Courtesy: Ayad Shammout's SQL & BI Blog)
Ayad Shammout's SQL & BI Blog explains how the components are used in various stages effectively for analysing the Audit Logs











 Microsoft's Statistical Component / Solution

Big Data is not data alone - it's more to do with Analyzing the Data. Microsoft has SQL Server 2012 Analysis services. However, certain analysis require custom coding / statistical analysis

Microsoft's Cloud Numerics (now in Azure labs) does exactly the same





Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Saturday, March 16, 2013

How to Bind Grid to a DataSource in Windows Phone using C#

How to Data Bind an Object to ListBox Control using C#.NET / Data Templates in C# Windows Phone Application

My director friend Kee Ran was pestering for an App that provides a list of Girivalam (a circumambulation) dates for his assistance. Attempted the same using Silverlight Data Template (Listbox) . The original grid as shown below:

 
 
 

It's been quite sometime since we had used a databinding (How to Bind an Object to TextBox)  First things first, let us create a class that will hold this data

public class GirivalamDates

{

public string GirivalamMonth { get; set; }

public string GirivalamStartDt { get; set; }

public string GirivalamStartTime { get; set; }

public string GirivalamStartDay { get; set; }

public string GirivalamEndDt { get; set; }

public string GirivalamEndTime { get; set; }

public string GirivalamEndDay { get; set; }



}

}


Once the class is created, create some objects of this type and it to a List.

    gDates = new List();
            gDates.Add(new GirivalamDates
            {
                GirivalamMonth = "Mon",
                GirivalamStartDt = "Start",
                GirivalamStartTime = "Date",
                GirivalamStartDay = "   ",
                GirivalamEndDt = "End  ",
                GirivalamEndTime = "Date",
                GirivalamEndDay = "   "
            }); 
Add more to the List and then, create the XAML for the same




 


<StackPanel x:Name="ContentPanel" Margin="12,0" Grid.Row="1">



<ScrollViewer HorizontalScrollBarVisibility="Visible">



<ListBox

Name

="myItemsControl" VerticalAlignment="Top">



<ItemsControl.ItemTemplate>



<DataTemplate>



<Grid>



<Grid.ColumnDefinitions>



<ColumnDefinition Width="100"/>



<ColumnDefinition Width="100"/>



<ColumnDefinition Width="100"/>



<ColumnDefinition Width="100"/>



<ColumnDefinition Width="100"/>



<ColumnDefinition Width="100"/>



<ColumnDefinition Width="100"/>



</Grid.ColumnDefinitions>









<TextBlock


Grid.Column="0" Text="{Binding GirivalamMonth}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



<TextBlock


Grid.Column="1" Text="{Binding GirivalamStartDt}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



<TextBlock


Grid.Column="2" Text="{Binding GirivalamStartTime}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



<TextBlock


Grid.Column="3" Text="{Binding GirivalamStartDay}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



<TextBlock


Grid.Column="4" Text="{Binding GirivalamEndDt}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



<TextBlock


Grid.Column="5" Text="{Binding GirivalamEndTime}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



<TextBlock


Grid.Column="6" Text="{Binding GirivalamEndDay}"


FontSize="{StaticResource PhoneFontSizeMedium}"


/>



</Grid>



</DataTemplate>



</ItemsControl.ItemTemplate>



</ListBox>

</

ScrollViewer>



</StackPanel>

The TextBlock's Text attribute is bound to the appropriate property of the GirivalamDates class.

Finally bind the ListBox control to the gDates object.

myItemsControl.ItemsSource = gDates;


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon