Wednesday, 9 September 2015

How to add and remove textbox items to listview in windows phone application

In this blog let us discuss about how to add and remove items to the list view in a Windows phone application. While we click on add button a popup with text box and two buttons (OK, CANCEL) should be displayed.  The text box items should be displayed in list view. When we click on remove button the selected item should be removed from the list.

  • Open Visual studio and start new windows phone app project.
  • Add controls like list view, buttons (Add, Remove), popup, text box to your design.



In the above image we can see the xaml code for the UI design of the particular controls. For a better UI the popup control is placed in a stack-panel and within a grid the controls like text box, buttons were placed.

So when we click on add button a popup should be raised with a textbox and two buttons(OK, Cancel). For this in the button click event of add we should write the below code

When we click on add button a popup with its controls will be displayed with the help of above code

After this when we write a particular text in textbox and click on OK the textbox item should be displayed in the list view. For this add the below code in Ok button click event in your popup control


So when we write something in textbox and click on OK the text will be displayed in the list view item.
The popup should be disappeared when we click on cancel button. For this, write the below code in the cancel button click event

To remove the selected item from the list view write the below code in the remove button click event.


The output is shown below. So while we click on OK the textbox item will be added in the listview. When we select particular item and click on remove then the item will be removed. When we click on cancel the popup disappears. 

                                              

Thursday, 27 August 2015

About some controls in Visual studio

In this blog let us discuss about some more controls in our windows store applications using Visual studio. As we already gone through with some of the controls like text block, text box, button, and image control. We also gone through with the events generated by using the control. You can refer these above controls in my previous blogs. Now we are going to get some knowledge about some of the controls like password box, date picker and timer picker in our windows store applications. 

Follow the below instructions in order to use these controls in your applications. 
  • Open Visual studio and start a new windows store blank application. 
  • We can drag and drop our required controls from the tool box directly to our UI design. 
  • Just drag and drop password box, date picker, timer picker in to the design. 
  • We can edit the names of these controls, layout and design properties of the control. 






The main use of password box is to hide the given input in the editor. This editor looks similar to the text box. This password box has the main feature of hiding the text and displaying the dots instead of text. You can also see these type of password inputs while we login in to some particular website. This is mainly to protect our secret key in order to maintain personal information. We can also say this password is used to authenticate our files. We can find Place holder text property in the property window of password box control. While we write some text in that particular text box the text is displayed in the password box. When we start editing our password box it disappears. So this place holder text is a hint to the user to instruct something required to the application. You can also see the example of this place holder text in the below image. 

So we are done with the password box. Now let us discuss about date picker and time picker. We mostly need these controls in our applications to represent the required date and time with respect to the application requirements. We can use this picker to choose the required date and time like birthdays. Now we try to display the selected date and time that should be displayed in the text block. So we should drag and drop our controls from our tool box when they are required. So after inserting two text blocks generate event for date and time. We should select date changed and time changed event to display the selected date and time. After generating events write the below code displayed in the image 




When you execute the above code you can see the below output. When you change the date and time in the control it reflects in the text block.

Wednesday, 26 August 2015

How to insert image

Today let us discuss about the usage of image control in our store application. We already know about text block, text box and about a button. We generated particular events in order to access this control. So now we need to insert an image in to our Visual studio. This is done with the help of this image control. We should drag and drop this image control in to our tool and with some steps we can add this image in to this image control. After adding images we use use them in our applications in our application.


                               

When we drag and drop our image control we can see the rectangle box. This is nothing but we can insert some elements in this control. We can see this type of empty rectangular box to other control. It refers to add some elements to that particular control. 

To add a image to our project just go through the below steps.                                 

                                  

  • Start your Visual studio tool from start menu.
  • Open a new project and it should be windows store application with a blank application
  • In order to insert a image we should drag and drop an image control in to our design.
  • Edit the properties of the image control in properties window. Give a name to the particular image control in order to access this control in code behind file.

                          

To insert an image first we should add this image to our Visual studio. For this open your solution explorer and right click on Assets folder. Then select Add option then click on Add existing item. You can browse your file from your local storage and then click on Add. You can also add multiple files in to your Assets folder and you can access them in code.

                             

After adding image go back to the properties of image control and you can find source in common tab. When you click on drop down list of source you can see the image file included in the Assets folder. Select the required image and press enter.
You can also change the stretch properties of the particular image. The changes directly effects in the design.
 
                        

Tuesday, 25 August 2015

Page navigation

Today let us discuss how to navigate from one page to the other page. To navigate from the page it is nothing but we should perform some specific action. We can do this by generating an event. We can generate an event with some particular control. So while we assign an event to the control the page should be navigated. For this we need a control in order to perform some action and we also need a new page. We can do this task with the help of a button. The default event of button is click. So while we click on the button the page should be navigated from one page to the other page. For this we need a button and a new page. 



  • Open visual studio and create a new blank application.
  • Drag and drop a button and edit the contents in property window.
  • To add a new page to your application just click on solution explorer window and right click on your project name. 
  • Select add option and click on add new item After clicking on add new item a page with list of templates can be seen. 
  • We can select any kind of template regarding your application. 
  • Simply select blank page and you can also edit the name of your new page. 
  • In your tool you can see new page with a blank design page. 



To navigate from mainpage to the blank page generate an event to the button by clicking on event symbol in properties window. It navigates to the code behind file. 
In your button click event add the below code 

this.frame.navigate(type of(Blankpage1)); 

                        

Here in the above code this frame(mainpage) is navigated to the other page, the page type is Blank page. Execute the code and when you click on button the page is navigated from main page to blank page. 







Monday, 24 August 2015

Button click event

We already discussed  how to dspaly the text written in the textbox to the We created default event for the textbox in order to display the text. Now let us discuss about button control

It is mainly used to communicate in the application. When we use button event  it is to performs other actions in the user interface. The default button control event is click. When we generate click event it is nothing but with the help of mouse button we should perform the action. We can also set different properties to the button. While you change the layout in your design it reflects in your XAML code. To change the color of the button it can be done in properties window. Similar to the textbox and textblock we can edit the whole properties of the button control.

In my recent blog we displayed the input text given from textbox to textblock.In the same way when I click the button the text should be displayed in the textblock. It is simple. Just go through with the below steps.


Go through with the design of  button, textbox and textblock

  • Open visual studio and create new project
  • Add the controls required to the design. Here we need one button, textbox and a textblock
  • We can edit the properties by pressing F4 with respect to the control. Please give a name to the control so that you can access the control in code behind file.


To generate click event for a button go to the properties of the button. Press on thunder symbol and double click on click event. It navigates to the code behind file. 



In the button click event just add the similar code which is used to display the text written in textbox to the textblock

text_output.Text=text_input.Text;


Note : Just check your names of the controls before you compiling the code.

Saturday, 22 August 2015

To display the text in the text block.

Let us discuss how to display the text in the text block when the input given in text box

As we already know the textbox is to input some text. We can edit our text in the textbox. we can also pass our text written in textbox. As we know the name and text can also be edited in properties window. This was discussed in the previous blog. We can also edit the properties and change the default values in the properties window. The name assigned for the textbox is mainly used in the code behind file. With this particular name we can manage functionalities of the particular control. 



For example : If you assign a name of your textbox as textinput. We should use the name of the textbox in the code behind file. in this way every control has name property. We should enter name of the control in order to access in the code behind file.


  • Open Visual studio from start menu
  • Start new project and select windows store applications in C# tab.
  • We can also edit the name and location of the particular project. To do this just click on browse and select the desired location.
  • After selecting particular project open the solution explorer in order to open the designer page.
  • Click on MainPage.XAML as it is the root page of the application in your project.
  • To display the text in the textblock we need two controls. They are textbox and textblock.
  • Just drag and drop these controls to your designer 


You should edit the name of your controls in properties window. In order to display the text written in textbox we should generate an event. Press on thunder symbol in your properties window or else you can just double click on your textbox control. When you double click on your control it navigates to the Mainpage.XAML.CS page which is nothing but the code behind file. You can see the below text while you double click on your textbox control. The default event of text box is textchanged.




This event can also be generated in your properties window. Click on thunder symbol and you can see the list of the events of the particular control. In order to display the text written in textbox we should generate textchanged event in the list. Just place your cursor and you can directly double click on the empty box else you can add some text and double click with your mouse.


In between the braces you should enter some code in order to display your text in text block.

blockoutput.Text = textinput.Text; //To display the text written in textbox

Note : The name of my text block is blockoutput

Output
                          

Friday, 21 August 2015

Diseases - Be careful

The disease is a harmful condition mainly affects the organisms of the living things. Humans also get effected with diseases and in the same time animals, trees also be effected with the diseases. It is an abnormal condition of a particular part of our body resulting from various causes and reasons. in early days the people don't even know what are diseases. The people in that days used to stay in a situation with out any hospital. Because the food habits and the way of living made it possible. The people in less number get effected with diseases. Some people even treat the person effected with disease with out any knowledge of science and the treatment got successful. This is because in that days the people lived with out using technology. So they survived for many years compared to the present situation.



Every disease has a cause. A disease can be a virus, bacteria, fungi, and worms. These tiny organisms mainly affects our cells in our body. Our human body can fight upto some extent with these small bacteria. If these virus has good strength even our body can't fight against the virus. This makes the person to fall ill. The virus spreads in our body. After certain medicine if the virus get killed then we regain our activeness. Until then we should struggle.  These diseases can be infectious and non infectious. Infectious is nothing but it spreads or transfers from one organism to another organism. Some of the infectious diseases are cold, cough, rabies, chicken pox etc. Non infectious is quite opposite of the infectious disease. It cannot be spread or transferred from one organism to the other. Examples of this non infectious diseases are diabetes,cancer, asthma etc. 



We should be careful with this infectious diseases because it can be passed or spread from different ways. While we talk with the person closely while he is affected with cold there is a chance of being effected with the same disease. Before we get affected with diseases we can find some symptoms. A symptom is something the patient who effected with the disease, that person can detect it. In our universe there are many uncountable diseases exist. Most of them are curable. Some of them are not curable. Doctors can't even find a perfect medicine to that particular diseases. Every disease has its own symptoms and signs in order to identify the disease. Mostly doctors find the diseases based on the signs, cause and symptoms of the individual. When a person is affected with diseases his body doesn't co-operates for any kind of action. He/She remains ill until the disease get cured..

Deficiency in diet also cause diseases. They can be cured by having proper diet and good exercise. The people also should take proper precautions in order to get rid of the disease. Diseases can be of many types. They are caused for many reasons. But all are harmful and dangerous. They lead to illness and sickness. Because of this technology increasing of diseases started. Radiation, pollution, heavy population, improper sanitation are some of the causes of diseases. The people mostly keep faith on doctors until the disease get cured. Even hospitals earn huge profits because number of patients also increased. Proper health and diet with good exercise can keep a man healthy.