Thursday, 22 January 2015

What is Grid in Xaml? Learn How to use it

Grid works just like table in HTML which formulate the allocated area in rows and columns but it is more stretchy than the HTML table. It stores its child elements in cells which can span over one another. We can set its child position by using HorizontalAllignment and VerticalAllignment attributes.

After defining it, we can set its background, rows and column etc. attributes. The XAML code for creating a Grid is given below



The design will be as given in the pic below



For defining rows we use Grid.RowDefinitions and for column we use Grid.ColumnDefinitions. We can give height and width in two formats which is in pixels or in *. In giving width and height, I use * which means the xaml automatically divide my rows or columns in equally parts. For example

<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="2*" />

The Xaml divides the total area in rows of 2 equally height section and third row height will be equivalent to the sum of heights of above 2 rows.

I write textblock with text Enter your name which has attribute Grid.column="0" and Grid.Row="0" which means it will show on top left first cell which is first row and first column .
and write textbox which has attribute Grid.column="1" and Grid.Row="0" which means it will show on top right cell which is first row second column.
Columns start with 0 and rows also with 0.
I 've divided section in two columns i.e. 0 and 1
and in 3 rows i.e. 0, 1, 2.

Wednesday, 21 January 2015

Windows 10 upgrade to be 'free' for one year

Microsoft has announced that its next operating system will be offered as a free upgrade to owners of devices running Windows 8, Windows 7 and Windows Phone.
The announcement marks a change in strategy to its previous policy of charging for major updates.
The offer, which is limited to the OS's first year of release, may aid its adoption.
That could help avoid a repeat of the relatively slow uptake of Windows 8.
The event at the firm's Redmond headquarters spent much of its two-hour duration focused on new capabilities gained by introducing the firm's virtual assistant Cortana to PCs.
In addition it showed off a futuristic "holographic" computing prototype headset that makes it seem as if computer-generated graphics are superimposed over the real world, allowing them to be controlled with hand gestures and voice commands.
HoloSensMicrosoft says it is working on a headset that lets people see graphics superimposed over their view, doing away with need for a separate computer
One analyst suggested the firm had needed to renew interest in its ecosystem.
"Overall we know that about only about 10% of computers are running Windows 8 and the adoption rate among companies is similar or lower," said Frank Gillett, an analyst at the Forrester consultancy.
"Developers are not paying much attention to Windows for mass market consumer apps, and you could even argue that for enterprise software most of the energy is going into mobile apps for iPad and Android tablets.
"Windows 10 is in effect a huge invitation to software developers to write exciting, powerful applications that will draw consumers.
"My hunch is that they can succeed in getting a new generation of PC and tablet applications, the challenge is getting people interested in its phones."
Cortana on PCs
Windows 10 brings the same operating system to devices of all sizes, rather than having different ones for PCs/tablets, mobile phones and the firm's Xbox games console.
One of the features highlighted at the presentation was how Cortana - the voice-controlled tool previously limited to Windows Phone handsets - would now work on PCs.
MicrosoftJoe Belfiore demonstrated Cortana, which Microsoft announced it has added to the PC
Microsoft executive Joe Belfiore demonstrated how the software could be told to:
  • bring up Powerpoint presentation documents
  • locate photos taken during a specific month
  • dictate and send emails
  • tell the user whether or not the weather forecast indicated they should wear a coat later
  • show where their car was parked
In addition, Mr Belfiore showed how the software could also be used to respond to requests that had been typed rather than spoken into a PC.
Windows 8 had been criticised by some for placing so much focus on touch-centric commands rather than the mouse and keyboard.
CortanaCortana will be able to make suggestions based on a user's past behaviour
But Mr Gillett said he thought the addition of Cortana's voice controls could prove more popular.
"Voice is a going to complement other ways of interacting with the computer not be a substitute," he said.
"If you had to say every command instead of touching or clicking, then that would be annoying.
"But if you can quickly say to Cortana, for example, schedule lunch with my mum next Tuesday, then that is powerful."
Browsing with Spartan
Mr Belfiore also highlighted one of the core benefits of Windows 10: a single app will run on multiple types of device, with the user interface reformatting itself to suit the machine it is running on, rather than having a different program for phones, tablets and PCs.
WATCH: Microsoft executive Joe Belfiore demonstrates the company's new web browser, code-named Spartan
He showed how this meant more advanced versions of the firm's popular Office programs Excel, Powerpoint and Word could be brought to handsets running Windows 10 than were possible under Windows Phone 8. He also demonstrated a new "universal" Photos app that collates and sorts pictures taken with different devices.
Mr Belfiore also confirmed reports that the firm's web browser, Internet Explorer, was being replaced by a new program codenamed Project Spartan.
This will have Cortana built-in to allow voice commands and provide extra personalised information - such as directions to a restaurant whose website is being looked at.
The software also includes a new "noting mode", which will let users scribble or type over a page and then share it with others.
"Project Spartan shows a new Microsoft that is not afraid to depart from legacy in order to deliver a better experience," remarked Carolina Milanesi from Kantar Worldpanel Comtech.
MicrosoftXbox chief Phil Spencer showed how Microsoft's Surface Pro tablet could be used to play Xbox One racing game Forza Horizon 2
The new system also introduces the ability to stream Xbox One video games from the console to any other Windows 10 PC or tablet on the same wi-fi network.
This means that users will be able to play any game in their Xbox library on another device in another room of their home if the property's main TV is being watched by someone else.
The facility is similar to the service Sony offers for its PlayStation 4 games machine that allows it to stream titles to Xperia phones and tablets and the PlayStation TV mini-console.
Windows HolographicMicrosoft described its HoloLens system as being a "moonshot" for the firm
Microsoft rounded off its presentation with a tease of a "holographic" computer it calls HoloLens. It suggests that at an unspecified point in the future, people will be able to use the headset to see computer-generated elements superimposed on the world around them.
The company said that it intended to release the "see-through" kit - which it said would not need to be linked to another device to work - within the "Windows 10" timeframe.
It revealed Nasa was already working with the kit, and said the US space agency hoped to start controlling its Mars rovers with a prototype version as soon as July.
HoloLensThe HoloLens system features a see-through lens, which the firm said would provide a more "personal" experience than other devices
Other demos involving the machine included:
  • playing Minecraft with the video game's graphics appearing over living room furniture
  • allowing a Skype video chat to appear as if it was taking place on a building wall
  • the wearer creating a model of a drone, which she saw in front of her face while shaping it by moving her hands and giving voice commands, before ordering a 3D printing of the design
MicrosoftMicrosoft showed off an augmented reality version of Minecraft as part of its HoloLens demo
"This will spark yet more excitement for the category but the true innovation it delivers will be determined by developer commitment in the months and years to come," commented Geoff Blaber from the CCS Insight consultancy.
"Windows 10 is a defining moment for Satya Nadella early in his tenure as CEO.
"The collaboration required to deliver HoloLens to market is an encouraging sign that he's breaking down the silos that slowed innovation and stalled execution in recent years."

Don't miss the latest briefing on Windows 10

Tuesday, 20 January 2015

What is XAML?

XAML is an Extensible Application Markup Language used for developing UI for .Net Framework Application. It is pronounced as "Zemmal". It is declarative markup language. It firstly comes with WPF(Windows Presentation Form). You can create visible elements using declarative statements in XAML. It is just another way to create visual presentation for the application instead of writing code in languages like C# etc. It usually comes with pair of tags i.e. every starting tag should have ending tag just like in writing HTML. You can also use Microsoft Expression blend to write XAML code. The XAML file creates the interface with all its elements and a code file behind it manages all events triggered by the elements.

Syntax of XAML


<Grid>
       <Textblock Margin="60">
              I 'm simple example of XAML.
       </Textblock>
</Grid>

Why Use XAML?


  1. It uses for separation of front end UI from back end coding i.e. Separation of design and logic.
  2. It's code is short as compared to C# code and easy to read.

Attributes Syntax

<Button Content="Click me" Background="Orange" Name="myButton" Click="myButton_click" />

Properties Syntax

<Button>
       <Button.Content>
              Click Me
       </Button.Content>

       <Button.Background>
              <SolidColorBrush color="Orange" />
       </Button.Background>
</Button>