添加项目文件。

master
Tay 6 months ago
parent 01d05dd1d0
commit 2e07d45cf5

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34525.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testWPFDevelopers", "testWPFDevelopers\testWPFDevelopers.csproj", "{0003FC75-7BBF-4BF1-B3A6-55D2D7C792DD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0003FC75-7BBF-4BF1-B3A6-55D2D7C792DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0003FC75-7BBF-4BF1-B3A6-55D2D7C792DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0003FC75-7BBF-4BF1-B3A6-55D2D7C792DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0003FC75-7BBF-4BF1-B3A6-55D2D7C792DD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {78A48234-9673-425C-912D-1A983319881B}
EndGlobalSection
EndGlobal

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

@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;
namespace testWPFDevelopers
{
/// <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,45 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace testWPFDevelopers
{
public class MainViewModel
{
private ObservableCollection<string> myVar;
public ObservableCollection<string> MyProperty
{
get { return myVar; }
set { myVar = value; }
}
public MainViewModel()
{
myVar = new ObservableCollection<string>();
myVar.Add("a001");
myVar.Add("保001");
myVar.Add("保德03");
myVar.Add("dc04");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
myVar.Add("保德03");
}
}
}

@ -0,0 +1,22 @@
<Window x:Class="testWPFDevelopers.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:testWPFDevelopers"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<ComboBox IsTextSearchEnabled="False"
IsEditable="True"
Height="30"
HorizontalAlignment="Left"
Margin="12,23,0,0"
Name="comboBox1"
VerticalAlignment="Top"
Width="120"
KeyUp="comboBox1_KeyUp"
MaxDropDownHeight="150"/>
</Grid>
</Window>

@ -0,0 +1,36 @@
using System.Text;
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 testWPFDevelopers
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
List<string> list = new List<string> { "aa", "bb", "abc", "csd", "sdlfks", "osdi", "awd" , "aa", "bb", "abc", "csd", "sdlfks", "osdi", "awd", "aa", "bb", "abc", "csd", "sdlfks", "osdi", "awd" };
public MainWindow()
{
InitializeComponent();
this.DataContext=new MainViewModel();
comboBox1.ItemsSource = list;
}
private void comboBox1_KeyUp(object sender, KeyEventArgs e)
{
List<string> mylist = new List<string>();
mylist = list.FindAll(delegate (string s) { return s.Contains(comboBox1.Text.Trim()); });
comboBox1.ItemsSource = mylist;
comboBox1.IsDropDownOpen = true;
}
}
}

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