window startup basic

main
syneffort 2 years ago
parent 1e9a9fca70
commit 52f3b34882
  1. 25
      PacticeSolution/PacticeSolution.sln
  2. 9
      PacticeSolution/PacticeSolution/App.xaml
  3. 17
      PacticeSolution/PacticeSolution/App.xaml.cs
  4. 10
      PacticeSolution/PacticeSolution/AssemblyInfo.cs
  5. 12
      PacticeSolution/PacticeSolution/Children/ChildWindow.xaml
  6. 27
      PacticeSolution/PacticeSolution/Children/ChildWindow.xaml.cs
  7. 15
      PacticeSolution/PacticeSolution/MainWindow.xaml
  8. 59
      PacticeSolution/PacticeSolution/MainWindow.xaml.cs
  9. 10
      PacticeSolution/PacticeSolution/PacticeSolution.csproj

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PacticeSolution", "PacticeSolution\PacticeSolution.csproj", "{6AE700B8-28D0-4D9F-978B-91AFB1033125}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6AE700B8-28D0-4D9F-978B-91AFB1033125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AE700B8-28D0-4D9F-978B-91AFB1033125}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AE700B8-28D0-4D9F-978B-91AFB1033125}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AE700B8-28D0-4D9F-978B-91AFB1033125}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {92FAC045-5C95-49EC-8241-6E62578C29E2}
EndGlobalSection
EndGlobal

@ -0,0 +1,9 @@
<Application x:Class="PacticeSolution.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PacticeSolution"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace PacticeSolution
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

@ -0,0 +1,12 @@
<Window x:Class="PacticeSolution.Children.ChildWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PacticeSolution.Children"
mc:Ignorable="d"
Title="ChildWindow" Height="100" Width="250" WindowStartupLocation="CenterOwner">
<Grid>
<Label FontFamily="Malgun Gothic" FontSize="30 " HorizontalAlignment="Center" VerticalAlignment="Center">Child window</Label>
</Grid>
</Window>

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace PacticeSolution.Children
{
/// <summary>
/// ChildWindow.xaml에 대한 상호 작용 논리
/// </summary>
public partial class ChildWindow : Window
{
public ChildWindow()
{
InitializeComponent();
}
}
}

@ -0,0 +1,15 @@
<Window x:Class="PacticeSolution.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PacticeSolution"
mc:Ignorable="d"
Title="MainWindow" Height="120" Width="400">
<StackPanel>
<Button x:Name="btnOwner" Click="btnOwner_Click">Owner</Button>
<Button x:Name="btnScreen" Click="btnScreen_Click">Screen</Button>
<Button x:Name="btnManual" Click="btnManual_Click">Manual</Button>
<Button x:Name="btnTopMost" Click="btnTopMost_Click">TopMost</Button>
</StackPanel>
</Window>

@ -0,0 +1,59 @@
using PacticeSolution.Children;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PacticeSolution
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void btnOwner_Click(object sender, RoutedEventArgs e)
{
ChildWindow child = new ChildWindow();
child.Owner = this;
child.WindowStartupLocation = WindowStartupLocation.CenterOwner;
child.Show();
}
private void btnScreen_Click(object sender, RoutedEventArgs e)
{
ChildWindow child = new ChildWindow();
child.WindowStartupLocation = WindowStartupLocation.CenterScreen;
child.Show();
}
private void btnManual_Click(object sender, RoutedEventArgs e)
{
ChildWindow child = new ChildWindow();
child.WindowStartupLocation = WindowStartupLocation.Manual;
child.Show();
}
private void btnTopMost_Click(object sender, RoutedEventArgs e)
{
ChildWindow child = new ChildWindow();
child.Background = Brushes.LightCyan;
child.Topmost = true;
child.Show();
}
}
}

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
Loading…
Cancel
Save