Entradas

Mostrando entradas de enero, 2016

Xamarin.Forms WebView

Imagen
Hello, in this post we will talk about WebView with Xamarin.Forms, a WebView is a view that show a WebPage, or more simply HTML content. We can define the instance of a webview on the next way: WebView webView= new WebView(); In the property Source we asign the source of our content for our WebView. Look a few piece of code: public   class   WebViewPage   :   ContentPage      {          WebView   webView {   get ;   set ; }   =   new  WebView  () ;          public   WebViewPage ()          {              Label   TitlePage   =   new   Label   {                 Text  =   " Use   of   WebView " ,                 FontSize  =   Device . GetNamedSize   ( NamedSize . Large ,   typeof ( Label )) ,                 HorizontalOptions  =   LayoutOptions . Center ,                 TextColor = Color . White              } ;                                       webView . Source   =   new   UrlWebViewSource {                   Url  =   " https : / / mx . linkedin

Xamarin.Forms Formatted text

Imagen
In this post I will write about Formatted text, this is very useful when you want to have different colors or styles in the same label. Actually Label have property FormattedText that allow to put text with different styles in the same. To do it, you need to add a List of Span, each Span has four properties, you can use all or only one, depends of you. Text  Font  ForegroundColor  BackgroundColor Now a small Example of it: Code: public   class   TestPage   :   ContentPage      {          public   TestPage   ()          {              FormattedString   fs   =   new   FormattedString   () ;              fs . Spans . Add   ( new   Span (){ Text = " Hello   " }) ;              fs . Spans . Add   ( new   Span (){ Text = " Xamarin   Forms   " ,  FontSize = 12 ,  FontAttributes = FontAttributes . Bold }) ;              fs . Spans . Add   ( new   Span (){ Text = " Is   awesome ! ! " , ForegroundColor = Color . Green }) ;