During my search on Google I have seen many web sites and there layouts But the one which really impress me is the how web sites owner ask to the user to post their comments. The layout of the posting the feedback about the post or article on website or blog is necessary as website or blog know about his/her post feedback and improve the future posts. The layout of the how to post comments against post or article is integral part and In this post I will show you one of the layout I have like most. You can see the layout in the image.
In the above image you can see that icon is displayed in the textbox control which looks quite nice. In the above image you can see the controls are arranged in two columns one for the label and second one for the textbox controls. One lable to show the total characters entered in the comments text box control and the button control for submit. I have not used icon for the comments multiline text box. For this I have created class of ImageTextBox which inherites from the TextBox control. The ImageTextBox control which Inherit from the TextBox control has one additional dependency property with the name of Icon to add the icon with the Text box control. The code is shown in the List 1 . The Icon dependency property is of ImageSource type.
Next is to create the custom style for the ImageTextBox which is same as the Text Box But here I have added the Image control which of size 20*20 height and width of the Image control. The xaml code for the style is shown in the list 2 I have added only the part which is used to show the Image in the style not the whole style. Here you can see that I have bind the Source of the Image control to the Icon property of the ImageTextBox.
Next is to add the ImageTextBox control in the form by adding the namespace add the top of the main form and name it to the local which you can see in the list 3. And then the local:ImageTextBox when you set the properties of the ImageTextBox control you can see the Icon property there which will take the Image path. I have used the png for the all the icon here in my sample. The code for adding the ImageTextBox is shown in the List 3.
Next I have add the converter for the character count of the comments field. The converter is simple one and is listed down in the List 4. You can see that I have just return the length of the string passed to the converter as I have bind the counter label with the text propperty of the comments field. I have added the only the converter function not the convert back which I have not implemented here.
Note: I have add the ImageTexBox control in the User control folder and the converter in the converters folder.
You can download the source code from here
All and any comments / bugs / suggestions are welcomed!