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 }); }
This thread solve all realted questions which is generated on open new form, close existing wpf form c#. Also this thread solve other related thread like:
Now the solution of all thread is, following steps which is mentioned below:
- WPF Application still runs in background after closing.
- My Windows Store app is still running in debug mode after I close it.
- VS2012 Debugging fails on subsequent runs.
- WPF Main application stops responding if a child window is being moved around.
- Application doesn't exit if it creates a window which is not shown.
- How main WPF window knows when secondary WPF window is closed.
- When shutting down the application, not all windows are closed.
- How to connect WPF Application project to Windows Game project?
- Clarification on WPF Window.Show() and Window.Close() and how they work with Multiple Windows.
- WPF App Doesn't Shut Down When Closing Main Window.
Now the solution of all thread is, following steps which is mentioned below:
Step-1 : Add two new window in wpf solution explorer. like first.xaml and second.xaml
Step-2 : Add a button control in first window from the toolbox.
Step-3 : Add this code into your first.xaml.cs file.
private void Button_Click(object sender, RoutedEventArgs e)
{
second sc = new second();
sc.Owner = this;
this.Hide();
sc.ShowDialog();
}
Step-4 : Also add this code into your second.xaml.cs file.
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
Application.Current.Shutdown();
}
Now, run your application, but first to set the start page from app.xaml file.
How to set startup page in wpf:
1. Open app.xaml file; also set startupUri like
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="first.xaml">
<Application.Resources>
</Application.Resources>
</Application>
Comments
Post a Comment