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 }); }
In our previous post I have discussed about the introduction of combo box control and insert some items in it. What if I want to insert an image also with a text in combo box items? So in this article, I will add some items in combo box which will have text as well as an image also.
To place an image and a text, I am using a stack panel with orientation horizontal. This stack panel will contain an image and a textblock, providing sufficient information. Check out the below code:
The XAML code have simple definition of combo box which contains a name, height and width. IsEditable property will be used to do some search when user will type something in combo box. In the combo box tags I have used two stack panel (may be more), with an image and a text.
Run the code and a combobox will be shown with two items, each containing an image and a text specified above:
To place an image and a text, I am using a stack panel with orientation horizontal. This stack panel will contain an image and a textblock, providing sufficient information. Check out the below code:
<ComboBox Name="customizeComboBox" Height="30" Width="200"
IsEditable="True">
<StackPanel TextSearch.Text="Item 1" Orientation="Horizontal">
<Image Source="image1.png"></Image>
<TextBlock Text="First item with image"></TextBlock>
</StackPanel>
<StackPanel TextSearch.Text="Item 2" Orientation="Horizontal">
<Image Source="image2.png"></Image>
<TextBlock Text="Second item with image"></TextBlock>
</StackPanel>
</ComboBox>
IsEditable="True">
<StackPanel TextSearch.Text="Item 1" Orientation="Horizontal">
<Image Source="image1.png"></Image>
<TextBlock Text="First item with image"></TextBlock>
</StackPanel>
<StackPanel TextSearch.Text="Item 2" Orientation="Horizontal">
<Image Source="image2.png"></Image>
<TextBlock Text="Second item with image"></TextBlock>
</StackPanel>
</ComboBox>
The XAML code have simple definition of combo box which contains a name, height and width. IsEditable property will be used to do some search when user will type something in combo box. In the combo box tags I have used two stack panel (may be more), with an image and a text.
Run the code and a combobox will be shown with two items, each containing an image and a text specified above:
Comments
Post a Comment