main
syneffort 2 years ago
parent 9477a637f7
commit 5ceff2083d
  1. 9
      PacticeSolution/ComboBoxSample/App.xaml
  2. 17
      PacticeSolution/ComboBoxSample/App.xaml.cs
  3. 10
      PacticeSolution/ComboBoxSample/AssemblyInfo.cs
  4. 24
      PacticeSolution/ComboBoxSample/ColorList.cs
  5. 10
      PacticeSolution/ComboBoxSample/ComboBoxSample.csproj
  6. 43
      PacticeSolution/ComboBoxSample/MainWindow.xaml
  7. 28
      PacticeSolution/ComboBoxSample/MainWindow.xaml.cs
  8. 6
      PacticeSolution/PacticeSolution.sln

@ -0,0 +1,9 @@
<Application x:Class="ComboBoxSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ComboBoxSample"
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 ComboBoxSample
{
/// <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,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ComboBoxSample
{
class ColorList : List<string>
{
public ColorList()
{
InitInstance();
}
private void InitInstance()
{
this.Add("Red");
this.Add("Green");
this.Add("Blue");
this.Add("Salmon");
}
}
}

@ -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,43 @@
<Window x:Class="ComboBoxSample.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:ComboBoxSample"
mc:Ignorable="d"
Title="MainWindow" Height="400" Width="400">
<Window.DataContext>
<local:ColorList/>
</Window.DataContext>
<StackPanel>
<Label Content="Color" HorizontalAlignment="Center" FontWeight="Bold"/>
<ComboBox Width="200" HorizontalAlignment="Center" SelectedIndex="0">
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Ellipse Fill="Red" Width="15" Height="15" Margin="0 0 5 0"/>
<TextBlock Text="Red"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Ellipse Fill="Green" Width="15" Height="15" Margin="0 0 5 0"/>
<TextBlock Text="Green"/>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem Content="Blue"/>
<ComboBoxItem Content="Orange"/>
</ComboBox>
<Label Content="Color from list" HorizontalAlignment="Center" FontWeight="Bold"/>
<ComboBox Width="200" ItemsSource="{Binding}" SelectedIndex="0">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Ellipse Fill="{Binding}" Width="15" Height="15" Margin="0 0 5 0"/>
<TextBlock Text="{Binding}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</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 ComboBoxSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

@ -113,6 +113,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DelegateEventFuncAction", "
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassInitInXaml", "ClassInitInXaml\ClassInitInXaml.csproj", "{4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassInitInXaml", "ClassInitInXaml\ClassInitInXaml.csproj", "{4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComboBoxSample", "ComboBoxSample\ComboBoxSample.csproj", "{0A10867D-797C-4477-A584-6CB72B1DE97A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -339,6 +341,10 @@ Global
{4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU {4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}.Release|Any CPU.Build.0 = Release|Any CPU {4D5438AC-CDD0-4975-8D0A-F1BBF49F4EE5}.Release|Any CPU.Build.0 = Release|Any CPU
{0A10867D-797C-4477-A584-6CB72B1DE97A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A10867D-797C-4477-A584-6CB72B1DE97A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A10867D-797C-4477-A584-6CB72B1DE97A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A10867D-797C-4477-A584-6CB72B1DE97A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

Loading…
Cancel
Save