Microsoft Pakistan has arranged a technical training camp on Windows 7 Multi-Touch platform to develop application’s using WPF and Silverlight 4. Trainer: Introduction to Multi Touch 3-b Day – 2 2






Ali Khawaja
Principal Consultant at Microsoft![]()
Training Camp Outline
Day – 1Track # Description 1 2-a Introduction to WPF & Silverlight 4 2-b Introduction to WPF & Silverlight 4 Lab 3-a Multitouch (Basics of Windows 7 Multitouch and its APIs) Multitouch Lab 4-a Drag and Drop, Printing, and Multi-touch in Silverlight 4-b Drag and Drop, Printing, and Multi-touch in Silverlight Lab Track # Description 1-a WPF/Silverlight Validation, Binding, DataForm and DataGrid 1-b WPF/Silverlight Validation, Binding, DataForm and DataGrid Lab Implementing a Scenario using Multi Touch 3-a Ribbon (Different aspects of the Windows 7 Ribbon and how to incorporate the Windows 7 Ribbon into existing applications.) 3-b Ribbon Lab
Microsoft Also Arranged a contest on Multi-Touch Application Development and i won that and got dinar 100 and its Was such a great experience and Trainer was such help . I like to Thanks Microsoft Arranged this kinda event in Pakistan such a great effort by mic ,Noman Sohai,Jibran Jamsha,Talha Mahmood,Naveed bajwa and etl
and Special thank to Ali Khawaja visiting Pakistan
Three Days Multi-Touch Training Session At MIC
Friday, June 18, 2010
Posted by Usama Wahab Khan at 1:45 AM 1 comments
Labels: Silverlight, Usama wahab khana
SILVERLIGHT COM AUTOMATION iterative Excel
Tuesday, June 15, 2010
SilverLight Support COM AUTOMATION in out of the browser mode. its a wonderful capability by using COM AUTOMATION on web. by using COM AUTOMATION in silver light interact with other application as well like Microsoft Office (Excel,Word,other..) excel is great to generate Reports in Silver light. so there demo with source code i get help form windows application to create this excel interaction for write function in c#sharep because we have to use dynamic DataType which has been provided in . net-framework 4 dynamic datatype initialize on runtime thats why it do not provide intelligence.
Xaml Code
<UserControl x:Class="LoadExcelObjects.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
<Grid x:Name="LayoutRoot" Background="White">
<Image Height="215" HorizontalAlignment="Left" Margin="0,44,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="400" />
<Button Content="Create" Height="23" HorizontalAlignment="Left" Margin="28,15,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<Button Content="Load" Height="23" HorizontalAlignment="Left" Margin="313,49,0,0" Name="button2" VerticalAlignment="Top" Width="75" Click="button2_Click" />
<sdk:DataGrid AutoGenerateColumns="True" Height="196" HorizontalAlignment="Left" Margin="-8,262,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="408" />
<Button Height="28" HorizontalAlignment="Left" Margin="109,15,0,0" Name="button23" VerticalAlignment="Top" Width="279" Content="Kindly install this Applicaiton then Run" Click="label1_Click" />
Grid>
UserControl>
Csharep Code
public partial class MainPage : UserControl
{
dynamic excel;
dynamic sheetShapes;
dynamic chart;
dynamic sheet;
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
if (Application.Current.InstallState == InstallState.NotInstalled)
{
button1.IsEnabled = false;
button2.IsEnabled = false;
}
else
{
button1.IsEnabled = true;
button2.IsEnabled = true;
}
}
private void button1_Click(object sender, RoutedEventArgs e)
{
if (AutomationFactory.IsAvailable)
{
excel = AutomationFactory.CreateObject("Excel.Application");
excel.Visible = true;
excel.Workbooks.Add();
dynamic workbook = excel.workbooks;
sheet = excel.ActiveSheet; // get the active sheet
dynamic cell = null;
int i = 1;
List<UsamastudentDatatype> data = new List<UsamastudentDatatype>();
for (int j = 0; j <>
{
data.Add(new UsamastudentDatatype() { Subject = "ASP.NET", Marks = (10 + j).ToString(), Name = "Students" });
}
foreach (var item in data)
{
cell = sheet.Cells[i, 1]; // row, column
cell.Value = item.Name;
cell.ColumnWidth = 25;
cell = sheet.Cells[i, 2];
cell.Value = item.Subject;
cell = sheet.Cells[i, 3];
cell.Value = item.Marks;
i++;
}
// add a chart
sheetShapes = sheet.Shapes;
sheetShapes.AddChart(-4100, 200, 2, 400, 300);
chart = sheet.ChartObjects(1).Chart;
}
}
private void button2_Click(object sender, RoutedEventArgs e)
{
if (AutomationFactory.IsAvailable)
{
string path = string.Format("{0}\\picture.jpg",
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures));
chart.Export(path, "JPG");
try
{
using (FileStream stream = File.OpenRead(path))
{
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(stream);
image1.Source = bitmapImage;
stream.Close();
}
}
catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
loadgrid();
}
}
void loadgrid()
{
List<UsamastudentDatatype> obj = new List<UsamastudentDatatype>();
try
{
for (dynamic i = 1; i <>
{
UsamastudentDatatype rowobject = new UsamastudentDatatype();
rowobject.Marks = excel.ActiveSheet.Cells[i, 2].Value.ToString();
rowobject.Name = excel.ActiveSheet.Cells[i, 1].Value.ToString();
rowobject.Subject = excel.ActiveSheet.Cells[i, 2].Value.ToString();
obj.Add(rowobject);
}
}
catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
dataGrid1.ItemsSource = obj;
}
private void label1_Click(object sender, RoutedEventArgs e)
{
if (Application.Current.InstallState == InstallState.NotInstalled)
{
Application.Current.Install();
}
else
{
button23.IsEnabled = false;
}
}
}
public class UsamastudentDatatype
{
public string Name { get; set; }
public string Subject { get; set; }
public string Marks { get; set; }
}
By Usama Wahab khan
Posted by Usama Wahab Khan at 1:33 AM 0 comments
Labels: Silverlight


