I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
The previous controls i.e. Label, TextBlock and etc. are used to display fix text in a window. Their text can be changed but through the programming, not by the user. Now to input some value by the user, or enable text editing, the text box control is used. The textbox control can contain only unformatted text in its text property.
<TextBox Width="200" Height=”25” Text="WPF Textbox control"></TextBox>
The above code will place a textbox control having width two hundred and above text in the textbox. The textbox is shown in the following image:
In the above textbox only one line can be written, means we can’t either enter a new line in to the textbox or cant inset more lines by default. To enable multiline, it have two properties to do that i.e. TextWrapping and AcceptReturn. To insert a multiline textbox, write following code:
Now when we run and write some more lines, then it will show something like this:
In the next post we will enable spell check for this textbox control.
<TextBox Width="200" Height=”25” Text="WPF Textbox control"></TextBox>
The above code will place a textbox control having width two hundred and above text in the textbox. The textbox is shown in the following image:
In the above textbox only one line can be written, means we can’t either enter a new line in to the textbox or cant inset more lines by default. To enable multiline, it have two properties to do that i.e. TextWrapping and AcceptReturn. To insert a multiline textbox, write following code:
<TextBox Width="200" Height="40" Margin="5" Text="WPF Textbox control" TextWrapping="Wrap" AcceptsReturn="True"></TextBox>
Now when we run and write some more lines, then it will show something like this:
In the next post we will enable spell check for this textbox control.
Comments
Post a Comment