Showing posts with label XAML. Show all posts
Showing posts with label XAML. Show all posts

Friday, January 18, 2008

Mouse Buttons - Why Silverlight web development is not traditional?

I have been active on Silverlight forums for a few months now and  most of the developers I see have problems with understanding that Silverlight is not like traditional web development environment. And the approach they have to take frightens them because it is not traditional.  They have fixed a  development mind frame with with HTML/Graphics and Server pages and sometimes it doesn't suit well with the Silverlight architecture. There are some areas of web development that with the introduction of Silverlight architecture get void, and I am set to make points of all of them and discuss the reason. Instead of doing all of them in one post I'll try to post multiple entry concentrating on a single method each time.

Mouse Buttons.

The most basic traditional method that developers gets wrong, Silverlight doesn't support Middle-Mouse button, Right-Mouse button or Double Click and developers have expressed this as crippled functionality or nonsense among other things, But the question they ask why only one mouse button is to an extend valid, and I'll try to shed some light on the reasons.

To answer why, we have to answer why Silverlight? Why not AJAX? What Silverlight brings to the application that AJAX doesn't besides easy of development? I say cross-platform compatibility, but they say AJAX is also cross platform compatible, I say with Right Mouse, or Middle Mouse button it isn't.

Let me explain in more detail, AJAX came into existence with writing clever JavaScript programs and pushing JavaScript to its limits, there are however different approaches for different browses, something that works in IE doesn't work on FireFox and something that works both in IE/FireFox doesn't work on Mac-Safari so the developer building AJAX application have to target particular browsers and write their application, one of the first reasons I was attracted to Silverlight was this cross platform compatibility. Write one application and run them on all.

Ok, but what does this have to do with Mouse buttons? The reason is Mac with its tradition doesn't have more than one mouse button, and this button in Windows terminology is interpreted as Left Mouse button, however in the last few years user have adopted the Mac-Might Mouse which have more than one mouse button, but the traditional Mac have only a single mouse button, so if you create a web application that is cross platform you have be use that all the users irrespective of their platform Mac/ Windows, or browser IE/FF/Safari/Opera.

You would ask what about double click? I say how would you double click on Mobile device? Not all mobile devices that access Internet are touch screen, and even on touch screen its hard to double click, when working on Silverlight you have to think the big picture, not traditional windows method. Microsoft have showed interest for Silverlight on Mobile devices but as yet, no particular announcements have been made. But expect to change that with Silverlight 2.0 RTM (by summer 2008). 

If say Microsoft have incorporated Silverlight with extended mouse functionality, and the developers who doesn't understand this functionality and/or its limits went on to implement such behaviour with some serious business logic, the end user accessing the application who can't access such behaviour due to hardware limitations can't access  such business logic, rendering the application useless.

To wrap it all up, Silverlight doesn't have extended mouse functionality for the same reasons as Adobe Flash doesn't.

Friday, December 21, 2007

Silverlight - World Map

I have promised in my previous post about XAML World Map, it  is finally here. Boy it took more time than I thought it would, and it was painstakingly boring, well it is finally here and I have a sample application in Silverlight 1.1 alpha (using VB.NET) how to use the world map.

Few Facts about this XAML World Map

  • Map not for Scale

  • More than 150 countries are included.

  • Each country is held by a canvas, and each child of the canvas is a path.

  • Non-populated or relatively small countries are not included.

  • I have tried my best to be accurate with country names, if there are any mistakes I would update it if brought to my notice.

  • Country canvas's are named by ISO 3166 Country Codes standards, but since ("is", "in", "do" are reserved words other codes are used). 

Countries Not Included. (87)

Country Name
ISO
ÅLAND ISLANDS AX
AMERICAN SAMOA AS
ANDORRA AD
ANGUILLA AI
ANTARCTICA AQ
ANTIGUA AND BARBUDA AG
ARUBA AW
BAHAMAS BS
BAHRAIN BH
BARBADOS BB
BERMUDA BM
BOSNIA AND HERZEGOVINA BA
BOUVET ISLAND BV
BRITISH INDIAN OCEAN TERRITORY IO
CAPE VERDE CV
CHRISTMAS ISLAND CX
COCOS (KEELING) ISLANDS CC
COMOROS KM
COOK ISLANDS CK
CROATIA HR
DJIBOUTI DJ
FALKLAND ISLANDS (MALVINAS) FK
FAROE ISLANDS FO
FIJI FJ
FRENCH POLYNESIA PF
FRENCH SOUTHERN TERRITORIES TF
GIBRALTAR GI
GRENADA GD
GUADELOUPE GP
GUAM GU
GUERNSEY GG
HEARD ISLAND AND MCDONALD ISLANDS HM
HOLY SEE (VATICAN CITY STATE) VA
HONG KONG HK
ISLE OF MAN IM
JERSEY JE
KIRIBATI KI
LIECHTENSTEIN LI
MACAO MO
MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF MK
MALDIVES MV
MALTA MT
MARSHALL ISLANDS MH
MARTINIQUE MQ
MAURITIUS MU
MAYOTTE YT
MICRONESIA, FEDERATED STATES OF FM
MONACO MC
MONTENEGRO ME
MONTSERRAT MS
NAURU NR
NETHERLANDS ANTILLES AN
NEW CALEDONIA NC
NIUE NU
NORFOLK ISLAND NF
NORTHERN MARIANA ISLANDS MP
PALAU PW
PALESTINIAN TERRITORY, OCCUPIED PS
PITCAIRN PN
PUERTO RICO PR
RÉUNION RE
SAINT BARTHÉLEMY BL
SAINT HELENA SH
SAINT KITTS AND NEVIS KN
SAINT LUCIA LC
SAINT MARTIN MF
SAINT PIERRE AND MIQUELON PM
SAINT VINCENT AND THE GRENADINES VC
SAMOA WS
SAN MARINO SM
SAO TOME AND PRINCIPE ST
SEYCHELLES SC
SLOVENIA SI
SOLOMON ISLANDS SB
SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS GS
SVALBARD AND JAN MAYEN SJ
TIMOR-LESTE TL
TOKELAU TK
TONGA TO
TRINIDAD AND TOBAGO TT
TURKS AND CAICOS ISLANDS TC
TUVALU TV
UNITED STATES MINOR OUTLYING ISLANDS UM
VANUATU VU
VIRGIN ISLANDS, BRITISH VG
VIRGIN ISLANDS, U.S. VI
WALLIS AND FUTUNA WF

Countries Included (158)

Country Name 
ISO
AFGHANISTAN AF
ALBANIA AL
ALGERIA DZ
ANGOLA AO
ARGENTINA AR
ARMENIA AM
AUSTRALIA AU
AUSTRIA AT
AZERBAIJAN AZ
BANGLADESH BD
BELARUS BY
BELGIUM BE
BELIZE BZ
BENIN BJ
BHUTAN BT
BOLIVIA BO
BOTSWANA BW
BRAZIL BR
BRUNEI DARUSSALAM BN
BULGARIA BG
BURKINA FASO BF
BURUNDI BI
CAMBODIA KH
CAMEROON CM
CANADA CA
CAYMAN ISLANDS KY
CENTRAL AFRICAN REPUBLIC CF
CHAD TD
CHILE CL
CHINA CN
COLOMBIA CO
CONGO CG
CONGO, THE DEMOCRATIC REPUBLIC OF THE CD
COSTA RICA CR
CÔTE D'IVOIRE CI
CUBA CU
CYPRUS CY
CZECH REPUBLIC CZ
DENMARK DK
DOMINICAN REPUBLIC DO*DOM
ECUADOR EC
EGYPT EG
EL SALVADOR SV
EQUATORIAL GUINEA GQ
ERITREA ER
ESTONIA EE
ETHIOPIA ET
FINLAND FI
FRANCE FR
FRENCH GUIANA GF
GABON GA
GAMBIA GM
GEORGIA GE
GERMANY DE
GHANA GH
GREECE GR
GREENLAND GL
GUATEMALA GT
GUINEA GN
GUINEA-BISSAU GW
GUYANA GY
HAITI HT
HONDURAS HN
HUNGARY HU
ICELAND IS* ICE
INDIA IN* IND
INDONESIA ID
IRAN, ISLAMIC REPUBLIC OF IR
IRAQ IQ
IRELAND IE
ISRAEL IL
ITALY IT
JAMAICA JM
JAPAN JP
JORDAN JO
KAZAKHSTAN KZ
KENYA KE
KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF KP
KOREA, REPUBLIC OF KR
KUWAIT KW
KYRGYZSTAN KG
LAO PEOPLE'S DEMOCRATIC REPUBLIC LA
LATVIA LV
LEBANON LB
LESOTHO LS
LIBERIA LR
LIBYAN ARAB JAMAHIRIYA LY
LITHUANIA LT
LUXEMBOURG LU
MADAGASCAR MG
MALAWI MW
MALAYSIA MY
MALI ML
MAURITANIA MR
MEXICO MX
MOLDOVA, REPUBLIC OF MD
MONGOLIA MN
MOROCCO MA
MOZAMBIQUE MZ
MYANMAR MM
NAMIBIA NA
NEPAL NP
NETHERLANDS NL
NEW ZEALAND NZ
NICARAGUA NI
NIGER NE
NIGERIA NG
NORWAY NO
OMAN OM
PAKISTAN PK
PANAMA PA
PAPUA NEW GUINEA PG
PARAGUAY PY
PERU PE
PHILIPPINES PH
POLAND PL
PORTUGAL PT
QATAR QA
ROMANIA RO
RUSSIAN FEDERATION RU
RWANDA RW
SAUDI ARABIA SA
SENEGAL SN
SERBIA RS
SIERRA LEONE SL
SINGAPORE SG
SLOVAKIA SK
SOMALIA SO
SOUTH AFRICA ZA
SPAIN ES
SRI LANKA LK
SUDAN SD
SURINAME SR
SWAZILAND SZ
SWEDEN SE
SWITZERLAND CH
SYRIAN ARAB REPUBLIC SY
TAIWAN, PROVINCE OF CHINA TW
TAJIKISTAN TJ
TANZANIA, UNITED REPUBLIC OF TZ
THAILAND TH
TOGO TG
TUNISIA TN
TURKEY TR
TURKMENISTAN TM
UGANDA UG
UKRAINE UA
UNITED ARAB EMIRATES AE
UNITED KINGDOM GB
UNITED STATES US
URUGUAY UY
UZBEKISTAN UZ
VENEZUELA VE
VIET NAM VN
WESTERN SAHARA EH
YEMEN YE
ZAMBIA ZM
ZIMBABWE ZW

Usage in Silverlight

The supported countries are loaded in an Array to create dynamic events on MouseLeftButtonUp, this is to avoid the long Handles phrase.  You can build your own application using this canvas, I didn't include Zoom/Scroll options because I just wanted to provide XAML and to show how to use the XAML from Silverlight. 

I'll update this source code with more information (e.g., area, country, flag etc.) using LINQ/VB XML functions after Silverlight 2.0 Beta is released.

Download

Creative Commons License
This work is licensed under a Creative Commons Licence.

Source Code (Silverlight 1.1 Alpha) VB.NET - WorldMap.zip 

Not Satisfied?

Not satisfied with my work? Change the source code and please post a link in the comments.

Want to redesign yourself? There is the original Microsoft Expression Design file, use it to change it.

Creative Commons License
This work is licensed under a Creative Commons Licence.

WorldMap.Design

Hope you enjoy,  please leave your comments.

PS:  I would appreciate if anyone can host this for me, please provide me a link if you do. 

Sunday, December 16, 2007

XAML World Map

A friend of mine send me this world map in Adobe Illustrator format and I converted it to XAML using Microsoft Design and I have giving few finishing touches in Blend, the paths are there but I wanted to convert the paths into canvas and give country names so there is a little work to be done, but instead of just publishing the XAML I decided to make a sample application on Silverlight 1.1 alpha.

I'll post the source code of the world map application typically showing you how to use the world map, along with the XAML. There is some work to be done and I'll try to finish it as soon as possible.

So please stay tuned but here is a sneak preview of the world map for you. Hope you enjoy.