main
syneffort 2 years ago
parent 1a15ebc427
commit 1381578890
  1. 10
      PacticeSolution/AnonymousMethod/AnonymousMethod.csproj
  2. 26
      PacticeSolution/AnonymousMethod/Program.cs
  3. 9
      PacticeSolution/HowToUseStyle/App.xaml
  4. 17
      PacticeSolution/HowToUseStyle/App.xaml.cs
  5. 10
      PacticeSolution/HowToUseStyle/AssemblyInfo.cs
  6. 10
      PacticeSolution/HowToUseStyle/HowToUseStyle.csproj
  7. 61
      PacticeSolution/HowToUseStyle/MainWindow.xaml
  8. 28
      PacticeSolution/HowToUseStyle/MainWindow.xaml.cs
  9. 30
      PacticeSolution/PacticeSolution.sln
  10. 3
      PacticeSolution/PageSample/MainWindow.xaml
  11. 9
      PacticeSolution/StaticResourceSample/App.xaml
  12. 17
      PacticeSolution/StaticResourceSample/App.xaml.cs
  13. 10
      PacticeSolution/StaticResourceSample/AssemblyInfo.cs
  14. 25
      PacticeSolution/StaticResourceSample/MainWindow.xaml
  15. 33
      PacticeSolution/StaticResourceSample/MainWindow.xaml.cs
  16. 10
      PacticeSolution/StaticResourceSample/StaticResourceSample.csproj
  17. 9
      PacticeSolution/TabContorlLightSample/App.xaml
  18. 17
      PacticeSolution/TabContorlLightSample/App.xaml.cs
  19. 10
      PacticeSolution/TabContorlLightSample/AssemblyInfo.cs
  20. 19
      PacticeSolution/TabContorlLightSample/MainWindow.xaml
  21. 28
      PacticeSolution/TabContorlLightSample/MainWindow.xaml.cs
  22. 10
      PacticeSolution/TabContorlLightSample/TabContorlLightSample.csproj

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -0,0 +1,26 @@
namespace AnonymousMethod
{
internal class Program
{
private delegate void TestDelegate();
static void Main(string[] args)
{
DoTest();
}
private static void DoTest()
{
TestDelegate t = delegate() {
Console.WriteLine("Anonymous method by delegate");
};
t += () =>
{
Console.WriteLine("Anonymous method by lambda");
};
t();
}
}
}

@ -0,0 +1,9 @@
<Application x:Class="HowToUseStyle.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:HowToUseStyle"
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 HowToUseStyle
{
/// <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,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

@ -0,0 +1,61 @@
<Window x:Class="HowToUseStyle.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:HowToUseStyle"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<!--Style Inheritance-->
<Style TargetType="{x:Type Button}" x:Key="styBoldButton">
<Setter Property="FontWeight" Value="ExtraBold"/>
</Style>
<Style TargetType="Button" BasedOn="{StaticResource styBoldButton}">
<Setter Property="Background" Value="Tomato"/>
<Setter Property="FontSize" Value="30"/>
</Style>
<Style TargetType="Button" x:Key="rscButton" BasedOn="{StaticResource styBoldButton}">
<Setter Property="Background" Value="PaleVioletRed"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Content="This is button"/>
<Button Grid.Row="1" Content="This is button" Style="{StaticResource rscButton}"/>
<Button Grid.Row="2" Content="Trigger button">
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LimeGreen"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<StackPanel Grid.Row="3" Orientation="Horizontal">
<CheckBox x:Name="cbTrigger"/>
<Button Content="Check the check box">
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=cbTrigger, Path=IsChecked}" Value="True">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="FontWeight" Value="ExtraBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</Grid>
</Window>

@ -0,0 +1,28 @@
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 HowToUseStyle
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

@ -93,11 +93,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AddressBook_MVVMSampleV2",
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSSQL_MVVM_Sample", "MSSQL_MVVM_Sample\MSSQL_MVVM_Sample.csproj", "{BAAF8254-74D1-406D-9765-43DCA9F939C7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSSQL_MVVM_Sample", "MSSQL_MVVM_Sample\MSSQL_MVVM_Sample.csproj", "{BAAF8254-74D1-406D-9765-43DCA9F939C7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BindingBasic", "BindingBasic\BindingBasic.csproj", "{8A804AD3-0DE0-406A-94ED-25A185875278}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BindingBasic", "BindingBasic\BindingBasic.csproj", "{8A804AD3-0DE0-406A-94ED-25A185875278}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringBuilderTest", "StringBuilderTest\StringBuilderTest.csproj", "{39BB03B4-BD6D-412A-AEF9-524597AA5673}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StringBuilderTest", "StringBuilderTest\StringBuilderTest.csproj", "{39BB03B4-BD6D-412A-AEF9-524597AA5673}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PageSample", "PageSample\PageSample.csproj", "{FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PageSample", "PageSample\PageSample.csproj", "{FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnonymousMethod", "AnonymousMethod\AnonymousMethod.csproj", "{9ECA12DE-F55E-4899-8EB4-625719382F4F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TabContorlLightSample", "TabContorlLightSample\TabContorlLightSample.csproj", "{BB27AD88-D070-4095-BB8B-E2049F7DB0EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StaticResourceSample", "StaticResourceSample\StaticResourceSample.csproj", "{6206E9C9-4449-42CC-A0A5-E54C4B15AA53}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HowToUseStyle", "HowToUseStyle\HowToUseStyle.csproj", "{6E182894-D2F1-4D2C-B991-51B01A2E3223}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -297,6 +305,22 @@ Global
{FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}.Release|Any CPU.Build.0 = Release|Any CPU {FA1B4A97-2D15-4EDD-BB0F-7E689F203DCD}.Release|Any CPU.Build.0 = Release|Any CPU
{9ECA12DE-F55E-4899-8EB4-625719382F4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9ECA12DE-F55E-4899-8EB4-625719382F4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9ECA12DE-F55E-4899-8EB4-625719382F4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9ECA12DE-F55E-4899-8EB4-625719382F4F}.Release|Any CPU.Build.0 = Release|Any CPU
{BB27AD88-D070-4095-BB8B-E2049F7DB0EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB27AD88-D070-4095-BB8B-E2049F7DB0EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB27AD88-D070-4095-BB8B-E2049F7DB0EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB27AD88-D070-4095-BB8B-E2049F7DB0EC}.Release|Any CPU.Build.0 = Release|Any CPU
{6206E9C9-4449-42CC-A0A5-E54C4B15AA53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6206E9C9-4449-42CC-A0A5-E54C4B15AA53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6206E9C9-4449-42CC-A0A5-E54C4B15AA53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6206E9C9-4449-42CC-A0A5-E54C4B15AA53}.Release|Any CPU.Build.0 = Release|Any CPU
{6E182894-D2F1-4D2C-B991-51B01A2E3223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6E182894-D2F1-4D2C-B991-51B01A2E3223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E182894-D2F1-4D2C-B991-51B01A2E3223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E182894-D2F1-4D2C-B991-51B01A2E3223}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -24,6 +24,7 @@
Click="btnPage2_Click"/> Click="btnPage2_Click"/>
</Grid> </Grid>
<Frame x:Name="frmMain" Grid.Row="1"/> <Frame x:Name="frmMain" Grid.Row="1"
NavigationUIVisibility="Hidden"/>
</Grid> </Grid>
</Window> </Window>

@ -0,0 +1,9 @@
<Application x:Class="StaticResourceSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:StaticResourceSample"
StartupUri="MainWindow.xaml">
<Application.Resources>
<SolidColorBrush Color="Lime" x:Key="rscApp"/>
</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 StaticResourceSample
{
/// <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,25 @@
<Window x:Class="StaticResourceSample.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:StaticResourceSample"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<SolidColorBrush Color="Tomato" x:Key="rscWindow"/>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Content="window resource" Background="{StaticResource rscWindow}"/>
<Button Grid.Row="1" Content="app resource" Background="{StaticResource rscApp}"/>
<Button Grid.Row="2" Content="dynamic resource" Background="{DynamicResource rscDynamic}"
Click="Button_Click"/>
</Grid>
</Window>

@ -0,0 +1,33 @@
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 StaticResourceSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Resources["rscDynamic"] = new SolidColorBrush(Colors.BlueViolet);
}
}
}

@ -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>

@ -0,0 +1,9 @@
<Application x:Class="TabContorlLightSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TabContorlLightSample"
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 TabContorlLightSample
{
/// <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,19 @@
<Window x:Class="TabContorlLightSample.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:TabContorlLightSample"
mc:Ignorable="d"
Title="MainWindow" Height="300" Width="300">
<Grid Margin="10">
<TabControl>
<TabItem Header="Tab1">
<Label Background="LightGreen" Content="Tab1"/>
</TabItem>
<TabItem Header="Tab2">
<Label Background="LightCoral" Content="Tab2"/>
</TabItem>
</TabControl>
</Grid>
</Window>

@ -0,0 +1,28 @@
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 TabContorlLightSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

@ -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