| Rafael del Corr...'s profile..:: Blog de Rafael del ...BlogLists | Help |
WMC Common PropertiesAfter a long time of being absent due to study, I restart posting, and this time introducing WMC (Web Mobile Controls). In this case we will talk about their properties. In the previous post I made an introduction that can be interpreted as explanation about the difference between the WMC and the Standard ASP Controls (if you did not read it I recommend you to do it so that you don´t miss important concepts that must have been understood) So each control has their own properties and events, there are some that are common for all of them (the specific properties of the most important controls will be descript in the coming posts). Until now we have seen how to create a control, and what I want to show in this case are the common properties and their permitted values: <mobile:Control id="idControl" Runat="server" Alignment=[Center|Right|Left|NotSet] BackColor=[Color de Fondo] BreakAfter=[True|False] EnableViewState=[True|False] Font-Bold=[True|False|NotSet] Font-Italic=[True|False|NotSet] Font-Name=[Nombre de la fuente] Font-Size=[Large|Medium|Small|NotSet] ForeColor=[Color del Control] StyleReference=[Nombre del estilo que queremos asociar] Visible=[True|False] Wrapping=[Wrap|NoWrap|NotSet]> </mobile:Control>
Alignment Set the alignment of the control in relation with it container (may be a form or a panel). You can modify this property in design time or execution time.
BackColor Set the background color of the control.
BreakAfter Allows to define if after a control will be inserted a break (new line) or other control will be next to it. The property is seted as default as “True”.
EnableViewState This property gets o sets a value that indicates if the view state of the control must remain after a request from the client. For example if you are getting data from a control in a server and this control does not need to be shown, setting this property in false you will improve the performance of your web page. The state view of a control it is and array of it properties and it is send after a request to the server. The property is seted as default as “True”.
Click here to download an example
Font-Bold, Font-Italic, Font-Name, Font-Size This properties modifies the size, the style and the name of the font of certain control.
ForeColor Through this property we can set or get de fore color of a control.
StyleRereference This property associate a style with a control. The way of doing this is setting as value of this property the property Name of a Style.
Visible Set or gets the visibility of a control. If it is false the control will not be shown.
Wrapping The property can be set as “Wrap”, “NoWrap” or “NotSet. If you set it as “Wrap” the text will break automatically once it reachs the end of the page. In other way, if you set this property as “NoWrap” when the text reachs the end of the page, will appear an horizontal scroll bar. The default value is “NotSet”, and in this case the control´s size has not been seted.
Try copying the code below in a .NET mobile solution. It shows the difference between a wrapped text and a no wrapped text:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<html> <body> <mobile:Form id="Form1" runat="server"> <mobile:TextView ID="txtWrapped" Runat="server" Wrapping="Wrap"> WRAPPED TEXT. This is a loooong text, that do not can be displayed in a device that does not has a display big enough if you want to show it in one line due to the most of the devices´s displays sizes are 320 x 240 </mobile:TextView>
<mobile:TextView ID="txtNotWrapped" Runat="server" Wrapping="NoWrap"><BR />NO WRAPPED TEXT. This is a loooong text, that can not be displayed in a device that does not has a display big enough if you want to show it in one line due to the most of the devices´s displays sizes are 320 x 240 </mobile:TextView> </mobile:Form> </body> </html>
Try changing the browser´s window size and you will see how the text automatically wrap to the page.
Well, that´s it till now. In the next post we will talk about the common events of the WMC.
Good Luck. TrackbacksThe trackback URL for this entry is: http://mobiledevp.spaces.live.com/blog/cns!B1F45CF18768D48A!117.trak Weblogs that reference this entry
|
|
|