├── .gitignore
├── Animation
├── Animation.csproj
├── App.xaml
├── App.xaml.cs
├── Properties
│ ├── Annotations.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── TransitionShaking.xaml
└── TransitionShaking.xaml.cs
├── BitmapCache
├── App.xaml
├── App.xaml.cs
├── BitmapCache.csproj
├── BitmapCache.gif
├── MainWindow.xaml
├── MainWindow.xaml.cs
└── README.md
├── CanNotReceiveTouchMessageWS_EX_TRANSPARENT
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── CanNotReceiveTouchMessageWS_EX_TRANSPARENT.csproj
├── CanNotReceiveTouchMessageWS_EX_TRANSPARENT.sln
├── MainWindow.xaml
├── MainWindow.xaml.cs
└── README.md
├── ChildWindowDisplayedAndThenBackToMainWindow
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── ChildWindowDisplayedAndThenBackToMainWindow.csproj
├── ChildWindowDisplayedAndThenBackToMainWindow.sln
├── MainWindow.xaml
├── MainWindow.xaml.cs
└── README.md
├── ChildWindows
├── App.xaml
├── App.xaml.cs
├── ChildWindows.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── README.md
└── demo.mp4
├── ImageMemoryLeak
├── App.xaml
├── App.xaml.cs
├── ImageMemoryLeak.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
└── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── ImageMemoryLeakDotNetCore
├── App.xaml
├── App.xaml.cs
├── AssemblyInfo.cs
├── ImageMemoryLeakDotNetCore.csproj
├── MainWindow.xaml
└── MainWindow.xaml.cs
├── Issues.sln
├── MainThreadDeadlockWithStylusInputThread
├── MainThreadDeadlockWhenTouchThreadWaitForWindowClosed
│ ├── MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.sln
│ └── MainThreadDeadlockWhenTouchThreadWaitForWindowClosed
│ │ ├── App.config
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.csproj
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ └── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
└── README.md
├── MouseLeaveEvent
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MouseLeaveEvent.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── README.md
├── Window1.xaml
└── Window1.xaml.cs
├── MultiDragDemo
├── MultiDragDemo.sln
└── MultiDragDemo
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── MultiDragDemo.csproj
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── demo.mp4
├── README.md
├── RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast.csproj
└── WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
└── WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks.csproj
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 |
24 | # Visual Studio 2015 cache/options directory
25 | .vs/
26 | # Uncomment if you have tasks that create the project's static files in wwwroot
27 | #wwwroot/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opendb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 | # NuGet v3's project.json files produces more ignoreable files
154 | *.nuget.props
155 | *.nuget.targets
156 |
157 | # Microsoft Azure Build Output
158 | csx/
159 | *.build.csdef
160 |
161 | # Microsoft Azure Emulator
162 | ecf/
163 | rcf/
164 |
165 | # Microsoft Azure ApplicationInsights config file
166 | ApplicationInsights.config
167 |
168 | # Windows Store app package directory
169 | AppPackages/
170 | BundleArtifacts/
171 |
172 | # Visual Studio cache files
173 | # files ending in .cache can be ignored
174 | *.[Cc]ache
175 | # but keep track of directories ending in .cache
176 | !*.[Cc]ache/
177 |
178 | # Others
179 | ClientBin/
180 | ~$*
181 | *~
182 | *.dbmdl
183 | *.dbproj.schemaview
184 | *.pfx
185 | *.publishsettings
186 | node_modules/
187 | orleans.codegen.cs
188 |
189 | # RIA/Silverlight projects
190 | Generated_Code/
191 |
192 | # Backup & report files from converting an old project file
193 | # to a newer Visual Studio version. Backup files are not needed,
194 | # because we have git ;-)
195 | _UpgradeReport_Files/
196 | Backup*/
197 | UpgradeLog*.XML
198 | UpgradeLog*.htm
199 |
200 | # SQL Server files
201 | *.mdf
202 | *.ldf
203 |
204 | # Business Intelligence projects
205 | *.rdl.data
206 | *.bim.layout
207 | *.bim_*.settings
208 |
209 | # Microsoft Fakes
210 | FakesAssemblies/
211 |
212 | # GhostDoc plugin setting file
213 | *.GhostDoc.xml
214 |
215 | # Node.js Tools for Visual Studio
216 | .ntvs_analysis.dat
217 |
218 | # Visual Studio 6 build log
219 | *.plg
220 |
221 | # Visual Studio 6 workspace options file
222 | *.opt
223 |
224 | # Visual Studio LightSwitch build output
225 | **/*.HTMLClient/GeneratedArtifacts
226 | **/*.DesktopClient/GeneratedArtifacts
227 | **/*.DesktopClient/ModelManifest.xml
228 | **/*.Server/GeneratedArtifacts
229 | **/*.Server/ModelManifest.xml
230 | _Pvt_Extensions
231 |
232 | # Paket dependency manager
233 | .paket/paket.exe
234 |
235 | # FAKE - F# Make
236 | .fake/
237 |
--------------------------------------------------------------------------------
/Animation/Animation.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {EA13FC10-8BD3-4D0B-ADE2-922A22753F08}
8 | WinExe
9 | Properties
10 | WpfBugDemo
11 | WpfBugDemo
12 | v4.6.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 | false
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 | false
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 4.0
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | MSBuild:Compile
63 | Designer
64 |
65 |
66 | App.xaml
67 | Code
68 |
69 |
70 |
71 | TransitionShaking.xaml
72 | Code
73 |
74 |
75 |
76 |
77 | Code
78 |
79 |
80 | True
81 | True
82 | Resources.resx
83 |
84 |
85 | True
86 | Settings.settings
87 | True
88 |
89 |
90 | ResXFileCodeGenerator
91 | Resources.Designer.cs
92 |
93 |
94 | SettingsSingleFileGenerator
95 | Settings.Designer.cs
96 |
97 |
98 |
99 |
100 |
107 |
--------------------------------------------------------------------------------
/Animation/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Animation/App.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace WpfBugDemo
2 | {
3 | ///
4 | /// Interaction logic for App.xaml
5 | ///
6 | public partial class App
7 | {
8 | }
9 | }
--------------------------------------------------------------------------------
/Animation/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("WpfBugDemo")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("WpfBugDemo")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Animation/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WpfBugDemo.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfBugDemo.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Animation/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Animation/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WpfBugDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Animation/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Animation/TransitionShaking.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
20 | Click the button below, you can see a transition animation.
21 | However, the blue block will shakes slightly.
22 | If you can't see the shaking problem , please resize or move the window and try again.
23 | Maybe it's caused by the non-integral rendering size, but how can we avoid this problem for the particular layout?
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/Animation/TransitionShaking.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 | using System.Windows.Media.Animation;
6 | using System.Windows.Media.Imaging;
7 | using Microsoft.Expression.Media.Effects;
8 |
9 | namespace WpfBugDemo
10 | {
11 | ///
12 | /// Interaction logic for MainWindow.xaml
13 | ///
14 | public partial class MainWindow
15 | {
16 | public MainWindow()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
22 | {
23 | if (e.ButtonState == MouseButtonState.Pressed)
24 | {
25 | DragMove();
26 | }
27 | }
28 |
29 | private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
30 | {
31 | OuterGrid.Effect = new SlideInTransitionEffect
32 | {
33 | // To comment out the codes below, the first line text in the blue block will not shake while tansiting.
34 | // This snapped bitmap is little blurry, that means the RenderTargetBitmap renders in a different way.
35 | // How can I get a the same screenshot as the control?
36 | Input = new ImageBrush(TakeImage(InnerGrid))
37 | };
38 |
39 | var animation = new DoubleAnimation(0.0, 1.0, new Duration(TimeSpan.FromSeconds(0.8)))
40 | {
41 | AccelerationRatio = 0.5,
42 | DecelerationRatio = 0.5
43 | };
44 |
45 | Storyboard.SetTarget(animation, OuterGrid);
46 | Storyboard.SetTargetProperty(animation, new PropertyPath("Effect.Progress"));
47 |
48 | var storyboard = new Storyboard();
49 | storyboard.Completed += Storyboard_Completed;
50 |
51 | storyboard.Children.Add(animation);
52 | storyboard.Begin();
53 | }
54 |
55 | private void Storyboard_Completed(object sender, EventArgs e)
56 | {
57 | OuterGrid.BeginAnimation(EffectProperty, null);
58 | OuterGrid.Effect = null;
59 | }
60 |
61 | private static ImageSource TakeImage(FrameworkElement element)
62 | {
63 | var width = (int) element.ActualWidth;
64 | if (width == 0)
65 | {
66 | width = (int) element.Width;
67 | }
68 | var height = (int) element.ActualHeight;
69 | if (height == 0)
70 | {
71 | height = (int) element.Height;
72 | }
73 |
74 | var bitmap = new RenderTargetBitmap(width, height, 96.0, 96.0, PixelFormats.Pbgra32);
75 | bitmap.Render(element);
76 |
77 | var encoder = new PngBitmapEncoder();
78 | encoder.Frames.Add(BitmapFrame.Create(bitmap));
79 |
80 | return bitmap;
81 | }
82 | }
83 | }
--------------------------------------------------------------------------------
/BitmapCache/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BitmapCache/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace CoveredWindow
10 | {
11 | public partial class App : Application
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/BitmapCache/BitmapCache.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.0;net48
6 | true
7 |
8 |
9 |
--------------------------------------------------------------------------------
/BitmapCache/BitmapCache.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dotnet-campus/wpf-issues/3b6d2b65990278fb79e018ca000c5dab9234e623/BitmapCache/BitmapCache.gif
--------------------------------------------------------------------------------
/BitmapCache/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
--------------------------------------------------------------------------------
/BitmapCache/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Threading;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Media;
6 |
7 | namespace CoveredWindow
8 | {
9 | public partial class MainWindow
10 | {
11 | public MainWindow()
12 | {
13 | InitializeComponent();
14 |
15 | // When one of these methods called, the bug will be reproduced.
16 | Reproduce1();
17 | //Reproduce2();
18 |
19 | Content = new Button
20 | {
21 | CacheMode = new BitmapCache(),
22 | Content = "Step 1: Lock screen (WIN+L)\r\n" +
23 | "Step 2: Unlock screen\r\n" +
24 | "Step 3: Click this button, or resize this window\r\n" +
25 | "\r\nNow, this window should stop repainting itself...\r\n" +
26 | "If you can't see that happening, please restart the application and try again :-D",
27 | // The same thing could still happen by other operations:
28 | // A:
29 | // - Step 1: Let the application run for a while. (e.g. 10~30min)
30 | // - Step 2: Click this button, or resize this window. Now, this window should stop repainting itself...
31 | // B:
32 | // - Step 1: Show a UAC window in any way by any other programs.
33 | // - Step 2: Click any button to close the UAC window.
34 | // - Step 3: Click this button, or resize this window. Now, this window should stop repainting itself...
35 | };
36 | }
37 |
38 | ///
39 | /// In this method, Window.Hide() is necessary.
40 | ///
41 | private void Reproduce1()
42 | {
43 | var hiddenWindow = new Window();
44 | hiddenWindow.Show();
45 | hiddenWindow.Hide();
46 | }
47 |
48 | ///
49 | /// In this method, the window is shown in another thread, thus Window.Hide() is not necessary.
50 | ///
51 | private void Reproduce2()
52 | {
53 | var backgroundThread = new Thread((() =>
54 | {
55 | var backgroundWindow = new Window { Title = $"Background Thread:{Thread.CurrentThread.ManagedThreadId}", Width = 500, Height = 500 };
56 | backgroundWindow.ShowDialog();
57 | }));
58 | backgroundThread.SetApartmentState(ApartmentState.STA);
59 | backgroundThread.Start();
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/BitmapCache/README.md:
--------------------------------------------------------------------------------
1 | # WPF window stops rendering issue
2 |
3 | We make a control that use `CacheMode = new BitmapCache()` and it will make the windows stop render when we doing some operations like lock the screen and unlock it.
4 |
5 | The demo that about this issue is in github: https://github.com/iip-easi/wpf-issues/tree/master/BitmapCache
6 |
7 | Report in github: https://github.com/dotnet/wpf/issues/2158
8 |
9 | We write a Button like the code.
10 |
11 | ```csharp
12 | public partial class MainWindow
13 | {
14 | public MainWindow()
15 | {
16 | InitializeComponent();
17 |
18 | // When one of these methods called, the bug will be reproduced.
19 | Reproduce1();
20 | //Reproduce2();
21 |
22 | Content = new Button
23 | {
24 | CacheMode = new BitmapCache(),
25 | Content = "Step 1: Lock screen (WIN+L)\r\n" +
26 | "Step 2: Unlock screen\r\n" +
27 | "Step 3: Click this button, or resize this window\r\n" +
28 | "\r\nNow, this window should stop repainting itself...\r\n" +
29 | "If you can't see that happening, please restart the application and try again :-D",
30 | // The same thing could still happen by other operations:
31 | // A:
32 | // - Step 1: Let the application run for a while. (e.g. 10~30min)
33 | // - Step 2: Click this button, or resize this window. Now, this window should stop repainting itself...
34 | // B:
35 | // - Step 1: Show a UAC window in any way by any other programs.
36 | // - Step 2: Click any button to close the UAC window.
37 | // - Step 3: Click this button, or resize this window. Now, this window should stop repainting itself...
38 | };
39 | }
40 |
41 | ///
42 | /// In this method, Window.Hide() is necessary.
43 | ///
44 | private void Reproduce1()
45 | {
46 | var hiddenWindow = new Window();
47 | hiddenWindow.Show();
48 | hiddenWindow.Hide();
49 | }
50 |
51 | ///
52 | /// In this method, the window is shown in another thread, thus Window.Hide() is not necessary.
53 | ///
54 | private void Reproduce2()
55 | {
56 | var backgroundThread = new Thread((() =>
57 | {
58 | var backgroundWindow = new Window { Title = $"Background Thread:{Thread.CurrentThread.ManagedThreadId}", Width = 500, Height = 500 };
59 | backgroundWindow.ShowDialog();
60 | }));
61 | backgroundThread.SetApartmentState(ApartmentState.STA);
62 | backgroundThread.Start();
63 | }
64 | }
65 | ```
66 |
67 | We can see window stop repainting itself when we lock Screen and unlock it.
68 |
69 | 
70 |
71 | The step:
72 |
73 | step 1: Add a control like button with the CacheMode is BitmapCache.
74 |
75 | step 2: Lock screen (WIN+L)
76 |
77 | step 3: Unlock screen
78 |
79 | And you can see the windows stop render when you click the button or resize the window.
80 |
81 | If you can't see that happening, please restart the application and try again.
82 |
83 |
84 |
85 | ## What is the impact of this issue
86 |
87 | We dare not use this feature that it may make your software cant be use.
88 |
89 | If we dont use the BitmapCache, we will spend more memory.
90 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace CanNotReceiveTouchMessageWS_EX_TRANSPARENT
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/CanNotReceiveTouchMessageWS_EX_TRANSPARENT.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.1
6 | true
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/CanNotReceiveTouchMessageWS_EX_TRANSPARENT.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26124.0
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CanNotReceiveTouchMessageWS_EX_TRANSPARENT", "CanNotReceiveTouchMessageWS_EX_TRANSPARENT.csproj", "{F395C415-7D56-4ED4-82B3-FCF86088D7C3}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|Any CPU = Release|Any CPU
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Debug|x64.ActiveCfg = Debug|Any CPU
24 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Debug|x64.Build.0 = Debug|Any CPU
25 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Debug|x86.ActiveCfg = Debug|Any CPU
26 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Debug|x86.Build.0 = Debug|Any CPU
27 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Release|x64.ActiveCfg = Release|Any CPU
30 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Release|x64.Build.0 = Release|Any CPU
31 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Release|x86.ActiveCfg = Release|Any CPU
32 | {F395C415-7D56-4ED4-82B3-FCF86088D7C3}.Release|x86.Build.0 = Release|Any CPU
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Interop;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 |
18 | namespace CanNotReceiveTouchMessageWS_EX_TRANSPARENT
19 | {
20 | ///
21 | /// Interaction logic for MainWindow.xaml
22 | ///
23 | public partial class MainWindow : Window
24 | {
25 | public MainWindow()
26 | {
27 | InitializeComponent();
28 |
29 | MouseDown += MainWindow_MouseDown;
30 | TouchDown += MainWindow_TouchDown;
31 |
32 | Loaded += MainWindow_Loaded;
33 | }
34 |
35 | private void MainWindow_Loaded(object sender, RoutedEventArgs e)
36 | {
37 | IntPtr hwnd = new WindowInteropHelper(this).Handle;
38 | var extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
39 | SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
40 | }
41 |
42 | [DllImport("user32.dll")]
43 | private static extern int SetWindowLong(IntPtr window, int index, int value);
44 |
45 | private const int GWL_EXSTYLE = -20;
46 |
47 | private const int WS_EX_TRANSPARENT = 0x00000020;
48 |
49 | [DllImport("user32.dll")]
50 | private static extern int GetWindowLong(IntPtr window, int index);
51 |
52 | private void MainWindow_TouchDown(object sender, TouchEventArgs e)
53 | {
54 | Log("Touch down");
55 | }
56 |
57 | private void MainWindow_MouseDown(object sender, MouseButtonEventArgs e)
58 | {
59 | Log("Mouse down");
60 | }
61 |
62 | private void Log(string message)
63 | {
64 | TextBlock.Text += $"{DateTime.Now} {message} \r\n";
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/CanNotReceiveTouchMessageWS_EX_TRANSPARENT/README.md:
--------------------------------------------------------------------------------
1 | # WPF can not receive the touch message when set WS_EX_TRANSPARENT to window
2 |
3 | We can create an empty WPF application, and then we can output message when we receive the mouse down and touch down event
4 |
5 | But when we set the WS_EX_TRANSPARENT property to the window, that we can find that we can only receive the mouse event and can not receive the touch event
6 |
7 | ```csharp
8 | private void MainWindow_Loaded(object sender, RoutedEventArgs e)
9 | {
10 | IntPtr hwnd = new WindowInteropHelper(this).Handle;
11 | var extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
12 | SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
13 | }
14 | ```
15 |
16 | Here is the mini demo code: https://github.com/dotnet-campus/wpf-issues/tree/master/CanNotReceiveTouchMessageWS_EX_TRANSPARENT
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ChildWindowDisplayedAndThenBackToMainWindow
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/ChildWindowDisplayedAndThenBackToMainWindow.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.1
6 | true
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/ChildWindowDisplayedAndThenBackToMainWindow.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26124.0
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChildWindowDisplayedAndThenBackToMainWindow", "ChildWindowDisplayedAndThenBackToMainWindow.csproj", "{74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|Any CPU = Release|Any CPU
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Debug|x64.ActiveCfg = Debug|Any CPU
24 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Debug|x64.Build.0 = Debug|Any CPU
25 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Debug|x86.ActiveCfg = Debug|Any CPU
26 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Debug|x86.Build.0 = Debug|Any CPU
27 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Release|x64.ActiveCfg = Release|Any CPU
30 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Release|x64.Build.0 = Release|Any CPU
31 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Release|x86.ActiveCfg = Release|Any CPU
32 | {74C0BBD8-9A41-4A44-8C1C-DFFA53B66353}.Release|x86.Build.0 = Release|Any CPU
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 | We should run this application in VisualStudio and attache to debug.
12 |
13 | And then we can see that the child window is displayed first,
14 |
15 | then the child window is displayed behind the main window,
16 |
17 | and then the child window is displayed again in front of the main window
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ChildWindowDisplayedAndThenBackToMainWindow
4 | {
5 | ///
6 | /// Interaction logic for MainWindow.xaml
7 | ///
8 | public partial class MainWindow : Window
9 | {
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 | }
14 |
15 | private void Button_OnClick(object sender, RoutedEventArgs e)
16 | {
17 | var window = new Window()
18 | {
19 |
20 | };
21 |
22 | window.Show();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ChildWindowDisplayedAndThenBackToMainWindow/README.md:
--------------------------------------------------------------------------------
1 | # ChildWindowDisplayedAndThenBackToMainWindow
2 |
3 | We can see that the child window is displayed first, then the child window is displayed behind the main window, and then the child window is displayed again in front of the main window.
4 |
5 | The steps
6 |
7 | 1. Set MainWindows as follows
8 |
9 | ```xml
10 | WindowStyle="None" AllowsTransparency="True"
11 | WindowState="Maximized"
12 | ```
13 |
14 | 2. Add a button to main window
15 |
16 | ```xml
17 |
18 | ```
19 |
20 | 3. Show a child window when button clicked
21 |
22 | ```csharp
23 | private void Button_OnClick(object sender, RoutedEventArgs e)
24 | {
25 | var window = new Window()
26 | {
27 | };
28 |
29 | window.Show();
30 | }
31 | ```
32 |
33 | When we using VisualStudio 2019 to debug and attache the process, we will find that the child window is displayed first, then the child window is displayed behind the main window, and then the child window is displayed again in front of the main window.
34 |
35 | At this point if you don't have additional debugging in VisualStudio 2019, you won't see the child window flicker.
36 |
37 | There are two solutions
38 |
39 | The first method is to remove the AllowsTransparency property of the main window
40 |
41 | The second method is to set the Owner of the child window as the main window
42 |
43 | ```csharp
44 | private void Button_OnClick(object sender, RoutedEventArgs e)
45 | {
46 | var window = new Window()
47 | {
48 | Owner = this
49 | };
50 |
51 | window.Show();
52 | }
53 | ```
54 |
55 | I publish the code to [github](https://github.com/dotnet-campus/wpf-issues/tree/master/ChildWindowDisplayedAndThenBackToMainWindow) and welcome you to visit.
--------------------------------------------------------------------------------
/ChildWindows/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ChildWindows/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ChildWindows
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ChildWindows/ChildWindows.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.0;net48
6 | true
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ChildWindows/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ChildWindows/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ChildWindows
4 | {
5 | ///
6 | /// Interaction logic for MainWindow.xaml
7 | ///
8 | public partial class MainWindow
9 | {
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 |
14 |
15 | Loaded += (sender, e) =>
16 | {
17 | var w = new Window
18 | {
19 | Title = "ChildWindow",
20 | Owner = this,
21 | Width = 600,
22 | Height = 500,
23 | Content = "Step 1: Move a window of another appliation to over the MainWindow\r\n" +
24 | "Step 2: Active this window from the Windows taskbar\r\n" +
25 | "Step 3: Close this window (ChildWindow)\r\n" +
26 | "\r\nNow you can see that the MainWindow drops down and coverd by another window.\r\n" +
27 | "If you don't understand the description above, please refer to the video demo in this project."
28 | };
29 | w.Show();
30 | };
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/ChildWindows/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dotnet-campus/wpf-issues/3b6d2b65990278fb79e018ca000c5dab9234e623/ChildWindows/README.md
--------------------------------------------------------------------------------
/ChildWindows/demo.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dotnet-campus/wpf-issues/3b6d2b65990278fb79e018ca000c5dab9234e623/ChildWindows/demo.mp4
--------------------------------------------------------------------------------
/ImageMemoryLeak/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace ImageMemoryLeak
9 | {
10 | ///
11 | /// App.xaml 的交互逻辑
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/ImageMemoryLeak.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {80780E88-2D90-452D-BFEC-E07C9555E063}
8 | WinExe
9 | Properties
10 | ImageMemoryLeak
11 | ImageMemoryLeak
12 | v4.0
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 4.0
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | MSBuild:Compile
54 | Designer
55 |
56 |
57 | MSBuild:Compile
58 | Designer
59 |
60 |
61 | App.xaml
62 | Code
63 |
64 |
65 | MainWindow.xaml
66 | Code
67 |
68 |
69 |
70 |
71 | Code
72 |
73 |
74 | True
75 | True
76 | Resources.resx
77 |
78 |
79 | True
80 | Settings.settings
81 | True
82 |
83 |
84 | ResXFileCodeGenerator
85 | Resources.Designer.cs
86 |
87 |
88 | SettingsSingleFileGenerator
89 | Settings.Designer.cs
90 |
91 |
92 |
93 |
94 |
101 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Media;
7 | using System.Windows.Media.Imaging;
8 |
9 | namespace ImageMemoryLeak
10 | {
11 | ///
12 | /// MainWindow.xaml 的交互逻辑
13 | ///
14 | public partial class MainWindow
15 | {
16 | public MainWindow()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | private void Button_Click(object sender, RoutedEventArgs e)
22 | {
23 | // 每次点击此按钮会将当前呈现的图片移除视觉树,再将其Source属性设置为null。
24 | // 然后新建一个Image控件,并将其Source属性设置为RenderTargetBitmap对象,再呈现出来。
25 | // 再次过程中,RenderTargetBitmap对象从来不会被回收,造成内存泄露。
26 | // 可以从资源管理其中观察到程序的内存持续上涨的现象。
27 |
28 | // Remove the current Image control from the visual tree and set source is null when click button.
29 | // Then new a image control and add source to the RenderTargetBitmap object and show it.
30 | // You can see the gc never delete the RenderTargetBitmap object that make memory leak.
31 |
32 |
33 | var oldBorder = RootGrid.Children.OfType().LastOrDefault();
34 | if (oldBorder != null)
35 | {
36 | var oldImage = (Image)oldBorder.Child;
37 |
38 |
39 | // 如果在Image控件移除视觉树之前将其Source属性设为null,并调用UpdateLayout方法。
40 | // 则RenderTargetBitmap对象可被回收,不会导致内存泄露。
41 | // 取消注释下面的代码可以观察到上述现象。
42 | // In order to solve it , you should set the image.Source is null and use UpdateLayout.
43 | // The below code can solve it.
44 | // oldImage.Source = null;
45 | // oldImage.UpdateLayout();
46 |
47 | // 将当前的Image控件移除视觉树。
48 | // Remove the current Image control from the visual tree.
49 | RootGrid.Children.Remove(oldBorder);
50 | oldImage.Source = null;
51 | Borders.Add(oldBorder);
52 | }
53 |
54 | var bitmap = new RenderTargetBitmap(1024, 1024, 96, 96, PixelFormats.Default);
55 |
56 | var image = new Image { Source = bitmap };
57 | var border = new Border { Child = image };
58 | RootGrid.Children.Add(border);
59 |
60 | // 为了便于观察内存的变化,每次操作后都会进行垃圾回收。
61 | // In order to facilitate changes in memory, after each operation will be garbage collection
62 | GC.Collect();
63 | }
64 |
65 | public readonly List Borders = new List();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的常规信息通过以下
8 | // 特性集控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("ImageMemoryLeak")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("ImageMemoryLeak")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 使此程序集中的类型
20 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | // 则将该类型上的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请在
25 | // 中的 .csproj 文件中
26 | //设置 CultureYouAreCodingWith。 例如,如果您在源文件中
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(在页面或应用程序资源词典中
37 | // 未找到某个资源的情况下使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(在页面、应用程序或任何主题特定资源词典中
40 | // 未找到某个资源的情况下使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下面四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.34014
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ImageMemoryLeak.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的、缓存的 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ImageMemoryLeak.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
56 | /// 方法是使用此强类型资源类。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34014
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ImageMemoryLeak.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ImageMemoryLeak/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ImageMemoryLeakDotNetCore/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ImageMemoryLeakDotNetCore/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace ImageMemoryLeakDotNetCore
4 | {
5 | public partial class App : Application
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/ImageMemoryLeakDotNetCore/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly:ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/ImageMemoryLeakDotNetCore/ImageMemoryLeakDotNetCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.1
6 | true
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ImageMemoryLeakDotNetCore/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ImageMemoryLeakDotNetCore/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Media;
7 | using System.Windows.Media.Imaging;
8 |
9 | namespace ImageMemoryLeakDotNetCore
10 | {
11 | public partial class MainWindow
12 | {
13 | public MainWindow()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | private void Button_Click(object sender, RoutedEventArgs e)
19 | {
20 | // Remove the current Image control from the visual tree and set source is null when click button.
21 | // Then new a image control and add source to the RenderTargetBitmap object and show it.
22 | // You can see the gc never delete the RenderTargetBitmap object that make memory leak.
23 |
24 |
25 | var oldBorder = RootGrid.Children.OfType().LastOrDefault();
26 | if (oldBorder != null)
27 | {
28 | var oldImage = (Image)oldBorder.Child;
29 |
30 | // In order to solve it , you should set the image.Source is null and use UpdateLayout.
31 | // The below code can solve it.
32 | // oldImage.Source = null;
33 | // oldImage.UpdateLayout();
34 |
35 | // Remove the current Image control from the visual tree.
36 | RootGrid.Children.Remove(oldBorder);
37 | oldImage.Source = null;
38 | Borders.Add(oldBorder);
39 | }
40 |
41 | var bitmap = new RenderTargetBitmap(1024, 1024, 96, 96, PixelFormats.Default);
42 |
43 | var image = new Image { Source = bitmap };
44 | var border = new Border { Child = image };
45 | RootGrid.Children.Add(border);
46 |
47 | // In order to facilitate changes in memory, after each operation will be garbage collection
48 | GC.Collect();
49 | }
50 |
51 | public readonly List Borders = new List();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Issues.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29418.71
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitmapCache", "BitmapCache\BitmapCache.csproj", "{01005462-54D7-4537-8C4A-FF0525ACB82C}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Animation", "Animation\Animation.csproj", "{EA13FC10-8BD3-4D0B-ADE2-922A22753F08}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChildWindows", "ChildWindows\ChildWindows.csproj", "{85164B73-270A-4DD0-9289-AD6D027AD17D}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiDragDemo", "MultiDragDemo\MultiDragDemo\MultiDragDemo.csproj", "{38B7E662-8730-414B-8B30-09E5622BFC0B}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseLeaveEvent", "MouseLeaveEvent\MouseLeaveEvent.csproj", "{5ED92DFA-883A-48A9-99E8-EC5BE33B92CE}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageMemoryLeak", "ImageMemoryLeak\ImageMemoryLeak.csproj", "{80780E88-2D90-452D-BFEC-E07C9555E063}"
17 | EndProject
18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MainThreadDeadlockWhenTouchThreadWaitForWindowClosed", "MainThreadDeadlockWithStylusInputThread\MainThreadDeadlockWhenTouchThreadWaitForWindowClosed\MainThreadDeadlockWhenTouchThreadWaitForWindowClosed\MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.csproj", "{69AFA209-DAD3-45E4-A5AB-037B2111E9CA}"
19 | EndProject
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast", "RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast\RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast.csproj", "{5B60183F-432E-467D-AA5C-BE85345260CA}"
21 | EndProject
22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks", "WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks\WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks.csproj", "{BDAA628B-7236-45A0-8C88-80309A67D6DD}"
23 | EndProject
24 | Global
25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
26 | Debug|Any CPU = Debug|Any CPU
27 | Release|Any CPU = Release|Any CPU
28 | EndGlobalSection
29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
30 | {01005462-54D7-4537-8C4A-FF0525ACB82C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {01005462-54D7-4537-8C4A-FF0525ACB82C}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {01005462-54D7-4537-8C4A-FF0525ACB82C}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {01005462-54D7-4537-8C4A-FF0525ACB82C}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {EA13FC10-8BD3-4D0B-ADE2-922A22753F08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35 | {EA13FC10-8BD3-4D0B-ADE2-922A22753F08}.Debug|Any CPU.Build.0 = Debug|Any CPU
36 | {EA13FC10-8BD3-4D0B-ADE2-922A22753F08}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {EA13FC10-8BD3-4D0B-ADE2-922A22753F08}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {85164B73-270A-4DD0-9289-AD6D027AD17D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {85164B73-270A-4DD0-9289-AD6D027AD17D}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {85164B73-270A-4DD0-9289-AD6D027AD17D}.Release|Any CPU.ActiveCfg = Release|Any CPU
41 | {85164B73-270A-4DD0-9289-AD6D027AD17D}.Release|Any CPU.Build.0 = Release|Any CPU
42 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
44 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {5ED92DFA-883A-48A9-99E8-EC5BE33B92CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {5ED92DFA-883A-48A9-99E8-EC5BE33B92CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {5ED92DFA-883A-48A9-99E8-EC5BE33B92CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
49 | {5ED92DFA-883A-48A9-99E8-EC5BE33B92CE}.Release|Any CPU.Build.0 = Release|Any CPU
50 | {80780E88-2D90-452D-BFEC-E07C9555E063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 | {80780E88-2D90-452D-BFEC-E07C9555E063}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 | {80780E88-2D90-452D-BFEC-E07C9555E063}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 | {80780E88-2D90-452D-BFEC-E07C9555E063}.Release|Any CPU.Build.0 = Release|Any CPU
54 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
56 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
57 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Release|Any CPU.Build.0 = Release|Any CPU
58 | {5B60183F-432E-467D-AA5C-BE85345260CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59 | {5B60183F-432E-467D-AA5C-BE85345260CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
60 | {5B60183F-432E-467D-AA5C-BE85345260CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
61 | {5B60183F-432E-467D-AA5C-BE85345260CA}.Release|Any CPU.Build.0 = Release|Any CPU
62 | {BDAA628B-7236-45A0-8C88-80309A67D6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63 | {BDAA628B-7236-45A0-8C88-80309A67D6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
64 | {BDAA628B-7236-45A0-8C88-80309A67D6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
65 | {BDAA628B-7236-45A0-8C88-80309A67D6DD}.Release|Any CPU.Build.0 = Release|Any CPU
66 | EndGlobalSection
67 | GlobalSection(SolutionProperties) = preSolution
68 | HideSolutionNode = FALSE
69 | EndGlobalSection
70 | GlobalSection(ExtensibilityGlobals) = postSolution
71 | SolutionGuid = {6D66B8B4-6548-42C4-A967-857AD6737D1D}
72 | EndGlobalSection
73 | EndGlobal
74 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28010.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MainThreadDeadlockWhenTouchThreadWaitForWindowClosed", "MainThreadDeadlockWhenTouchThreadWaitForWindowClosed\MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.csproj", "{69AFA209-DAD3-45E4-A5AB-037B2111E9CA}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {DDA91E62-C46A-405F-A4B3-35D503E63E4C}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace MainThreadDeadlockWhenTouchThreadWaitForWindowClosed
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {69AFA209-DAD3-45E4-A5AB-037B2111E9CA}
8 | WinExe
9 | MainThreadDeadlockWhenTouchThreadWaitForWindowClosed
10 | MainThreadDeadlockWhenTouchThreadWaitForWindowClosed
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 4.0
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | MSBuild:Compile
55 |
56 |
57 | MSBuild:Compile
58 | Designer
59 |
60 |
61 | App.xaml
62 | Code
63 |
64 |
65 | MainWindow.xaml
66 | Code
67 |
68 |
69 |
70 |
71 | Code
72 |
73 |
74 | True
75 | True
76 | Resources.resx
77 |
78 |
79 | True
80 | Settings.settings
81 | True
82 |
83 |
84 | ResXFileCodeGenerator
85 | Resources.Designer.cs
86 |
87 |
88 | SettingsSingleFileGenerator
89 | Settings.Designer.cs
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Input.StylusPlugIns;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace MainThreadDeadlockWhenTouchThreadWaitForWindowClosed
18 | {
19 | public partial class MainWindow : Window
20 | {
21 | public MainWindow()
22 | {
23 | InitializeComponent();
24 | _fooWindow = new FooWindow();
25 | StylusPlugIns.Add(new FooStylusPlugIn(_fooWindow));
26 | _fooWindow.Show();
27 | }
28 |
29 | private void Button_OnClick(object sender, RoutedEventArgs e)
30 | {
31 | }
32 |
33 | private FooWindow _fooWindow;
34 | }
35 |
36 | public class FooWindow : Window
37 | {
38 |
39 | }
40 |
41 | public class FooStylusPlugIn : StylusPlugIn
42 | {
43 | public FooStylusPlugIn(FooWindow fooWindow)
44 | {
45 | FooWindow = fooWindow;
46 | }
47 |
48 | public FooWindow FooWindow { get; }
49 |
50 | ///
51 | protected override void OnStylusUp(RawStylusInput rawStylusInput)
52 | {
53 | FooWindow.Dispatcher.Invoke(() => FooWindow.Close());
54 | base.OnStylusUp(rawStylusInput);
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("MainThreadDeadlockWhenTouchThreadWaitForWindowClosed")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("MainThreadDeadlockWhenTouchThreadWaitForWindowClosed")]
15 | [assembly: AssemblyCopyright("Copyright © 2018")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MainThreadDeadlockWhenTouchThreadWaitForWindowClosed.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MainThreadDeadlockWithStylusInputThread/README.md:
--------------------------------------------------------------------------------
1 | D:/程序/uwp_introduction/WPF Main thread gets a deadlock when stylus input thread is waiting for the window to close.md
--------------------------------------------------------------------------------
/MouseLeaveEvent/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace MouseLeaveEvent
9 | {
10 | ///
11 | /// App.xaml 的交互逻辑
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace MouseLeaveEvent
4 | {
5 | ///
6 | /// MainWindow.xaml 的交互逻辑
7 | ///
8 | public partial class MainWindow
9 | {
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 | Loaded += MainWindow_Loaded;
14 | }
15 |
16 | private void MainWindow_Loaded(object sender, RoutedEventArgs e)
17 | {
18 | Window1 window1 = new Window1 {Owner = this};
19 | window1.ShowDialog();
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/MouseLeaveEvent/MouseLeaveEvent.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5ED92DFA-883A-48A9-99E8-EC5BE33B92CE}
8 | WinExe
9 | Properties
10 | MouseLeaveEvent
11 | MouseLeaveEvent
12 | v4.6.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 | false
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 | false
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 4.0
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | MSBuild:Compile
57 | Designer
58 |
59 |
60 | Window1.xaml
61 |
62 |
63 | MSBuild:Compile
64 | Designer
65 |
66 |
67 | App.xaml
68 | Code
69 |
70 |
71 | MainWindow.xaml
72 | Code
73 |
74 |
75 | Designer
76 | MSBuild:Compile
77 |
78 |
79 |
80 |
81 | Code
82 |
83 |
84 | True
85 | True
86 | Resources.resx
87 |
88 |
89 | True
90 | Settings.settings
91 | True
92 |
93 |
94 | ResXFileCodeGenerator
95 | Resources.Designer.cs
96 |
97 |
98 |
99 | SettingsSingleFileGenerator
100 | Settings.Designer.cs
101 |
102 |
103 |
104 |
105 |
112 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("MouseLeaveEvent")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("MouseLeaveEvent")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MouseLeaveEvent.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MouseLeaveEvent.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MouseLeaveEvent.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/README.md:
--------------------------------------------------------------------------------
1 | # Window's Button cant get the mouse leave event when show dialog in WPF
2 |
3 | We found that the Button cant raise the OnMouseLeave Event when show the window dialog.
4 |
5 | We make a Window that call Window1 and write a button in Windows1.
6 |
7 | We can get the OnMouseEnter and OnMouseLeave event on this button.
8 |
9 | I hover my mouse on this button and I can see the button changed the background.
10 |
11 | I move the mouse out of the two windows very quickly .Then I can see the button still has a effect of hovering.
12 |
13 | See the gif:
14 |
15 | The code is in github: https://github.com/iip-easi/wpf-issues/tree/master/MouseLeaveEvent
16 |
17 |
18 |
19 | The step:
20 |
21 | Step 1: Making a Window and add a button. I call this Window as Windows1.
22 |
23 | Step 2: Showing this Window as dialog.
24 |
25 | Window1 window1 = new Window1 {Owner = this};
26 | window1.ShowDialog();
27 |
28 | Step 3: Hover the mouse on the button and then move out the mouse to the two windows .
29 |
30 | Now you can see that the button still has a effect of hovering.
31 |
32 |
33 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Window1.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
--------------------------------------------------------------------------------
/MouseLeaveEvent/Window1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Windows;
3 | using System.Windows.Input;
4 |
5 | namespace MouseLeaveEvent
6 | {
7 | ///
8 | /// Window1.xaml 的交互逻辑
9 | ///
10 | public partial class Window1/*:Window*/ //That is the same problem whether inherit Window
11 | {
12 | public Window1()
13 | {
14 | InitializeComponent();
15 |
16 | Button.Content = "Step 1: Hover your mouse on this button.\r\n" +
17 | "Step 2: Move your mouse out of the two windows very quickly.\r\n" +
18 | "\r\nNow you can see that the button still has a effect of hovering.\r\n";
19 | }
20 | private void UIElement_OnMouseEnter(object sender, MouseEventArgs e)
21 | {
22 | Debug.WriteLine("Enter");
23 | }
24 |
25 | private void UIElement_OnMouseLeave(object sender, MouseEventArgs e)
26 | {
27 | Debug.WriteLine("Leave");
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.23107.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiDragDemo", "MultiDragDemo\MultiDragDemo.csproj", "{38B7E662-8730-414B-8B30-09E5622BFC0B}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {38B7E662-8730-414B-8B30-09E5622BFC0B}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace MultiDragDemo
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MultiDragDemo
17 | {
18 | ///
19 | /// MainWindow.xaml 的交互逻辑
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | StepsTextBlock.Text = "Step1: Use your five fingers to slide on the blue canvas for serveral seconds."+"\r\n"
27 | + "Step2: Touch the button below."+"\r\n"+
28 | "\r\nThe button should be untouchable now.\r\n" +
29 | "If you don't understand the description above, please refer to the demo video in this project.";
30 | }
31 |
32 | private void UIElement_OnMouseMove(object sender, MouseEventArgs e)
33 | {
34 | if (e.LeftButton == MouseButtonState.Pressed)
35 | {
36 | DragDrop.DoDragDrop(this, "OK", DragDropEffects.Move);
37 | }
38 | }
39 |
40 | private int i = 0;
41 | private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
42 | {
43 | Button1.Content = "Click me " + i++;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/MultiDragDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {38B7E662-8730-414B-8B30-09E5622BFC0B}
8 | WinExe
9 | Properties
10 | MultiDragDemo
11 | MultiDragDemo
12 | v4.6.2
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 |
18 |
19 |
20 | AnyCPU
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 | false
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 | false
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 4.0
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | MSBuild:Compile
63 | Designer
64 |
65 |
66 | App.xaml
67 | Code
68 |
69 |
70 | MainWindow.xaml
71 | Code
72 |
73 |
74 |
75 |
76 | Code
77 |
78 |
79 | True
80 | True
81 | Resources.resx
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 | ResXFileCodeGenerator
90 | Resources.Designer.cs
91 |
92 |
93 | SettingsSingleFileGenerator
94 | Settings.Designer.cs
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
112 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("MultiDragDemo")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("MultiDragDemo")]
15 | [assembly: AssemblyCopyright("Copyright © 2015")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | //将 ComVisible 设置为 false 将使此程序集中的类型
20 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请
25 | // 中的 .csproj 文件中
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(当资源未在页面
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(当资源未在页面
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MultiDragDemo.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MultiDragDemo.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.42000
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MultiDragDemo.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.1.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MultiDragDemo/MultiDragDemo/demo.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dotnet-campus/wpf-issues/3b6d2b65990278fb79e018ca000c5dab9234e623/MultiDragDemo/MultiDragDemo/demo.mp4
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WPF Issues
2 |
3 | This repository provides small demo programs and code snippets to reproduce several wpf-related bugs. We hope these demos could do a little help to locate and debug the bugs.
4 |
5 | #### WPF Main thread gets a deadlock when stylus input thread is waiting for the window to close
6 | Please refer to the [MainThreadDeadlockWithStylusInputThread](./MainThreadDeadlockWithStylusInputThread/MainThreadDeadlockWhenTouchThreadWaitForWindowClosed) demo program for details.
7 |
8 | #### [Fixed by .net 4.6.2] WPF program sometimes becomes untouchable after multi-touch operations.
9 | Please refer to the [MultiDragDemo](./MultiDragDemo) demo program for details.
10 |
11 | #### WPF window sometimes gets covered by other windows after its child window being closed.
12 | Please refer to the [ChildWindows](./ChildWindows) demo program for details.
13 |
14 | #### WPF translation animation sometimes shakes slightly.
15 | Please refer to the [Animation](./Animation) demo program for details.
16 |
17 | #### WPF UI thread sometimes stops rendering while another background thread shows a window.
18 | Please refer to the [BitmapCache](./BitmapCache) demo program for details.
19 |
20 | #### WPF child window may sometimes lost mouse leave event.
21 | Please refer to the [MouseLeaveEvent](./MouseLeaveEvent) demo program for details.
22 |
23 |
24 | #### WPF child window displayed behind the main window, and then the child window is displayed again in front of the main window
25 | Please refer to the [ChildWindowDisplayedAndThenBackToMainWindow](./ChildWindowDisplayedAndThenBackToMainWindow) demo program for details.
26 |
27 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Globalization;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Data;
11 | using System.Windows.Documents;
12 | using System.Windows.Input;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 |
18 | namespace RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast
19 | {
20 | ///
21 | /// MainWindow.xaml 的交互逻辑
22 | ///
23 | public partial class MainWindow : Window
24 | {
25 | public MainWindow()
26 | {
27 | InitializeComponent();
28 | DataContext = this;
29 |
30 |
31 | Loaded += (s, e) => { FastCreated(); };
32 | }
33 |
34 | private async void FastCreated()
35 | {
36 | var ran = new Random();
37 |
38 | while (true)
39 | {
40 | await Task.Delay(100).ContinueWith(_ =>
41 | {
42 | ImageList.Clear();
43 | var n = ran.Next(int.MaxValue / 10);
44 | for (int i = n; i < n + 1000; i++)
45 | {
46 | try
47 | {
48 | DrawingVisual drawingVisual = new DrawingVisual();
49 | DrawingContext drawingContext = drawingVisual.RenderOpen();
50 |
51 | var text = new FormattedText(i.ToString(),
52 | CultureInfo.GetCultureInfo("zh-cn"),
53 | FlowDirection.LeftToRight,
54 | new Typeface("Verdana"),
55 | 36, Brushes.Black);
56 | drawingContext.DrawText(text,
57 | new Point(0, 0));
58 |
59 | drawingContext.Close();
60 |
61 | var image = new RenderTargetBitmap((int) text.Width, (int) text.Height, 96, 96,
62 | PixelFormats.Pbgra32);
63 | image.Render(drawingVisual);
64 |
65 | ImageList.Add(image);
66 | }
67 | catch (Exception e)
68 | {
69 | // RenderTargetBitmap throws COM exception when created too fast: MILERR_WIN32ERROR (Exception from HRESULT: 0x88980003)
70 | Console.WriteLine(e);
71 | }
72 |
73 | GC.WaitForPendingFinalizers();
74 | }
75 | }, TaskScheduler.FromCurrentSynchronizationContext());
76 | }
77 | }
78 |
79 |
80 | public ObservableCollection ImageList { get; set; } = new ObservableCollection();
81 | }
82 | }
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast")]
15 | [assembly: AssemblyCopyright("Copyright © 2019")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast/RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5B60183F-432E-467D-AA5C-BE85345260CA}
8 | WinExe
9 | RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast
10 | RenderTargetBitmapThrowsCOMExceptionWhenCreatedTooFast
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | 4.0
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | MSBuild:Compile
55 |
56 |
57 | MSBuild:Compile
58 | Designer
59 |
60 |
61 | App.xaml
62 | Code
63 |
64 |
65 | MainWindow.xaml
66 | Code
67 |
68 |
69 |
70 |
71 | Code
72 |
73 |
74 | True
75 | True
76 | Resources.resx
77 |
78 |
79 | True
80 | Settings.settings
81 | True
82 |
83 |
84 | ResXFileCodeGenerator
85 | Resources.Designer.cs
86 |
87 |
88 | SettingsSingleFileGenerator
89 | Settings.Designer.cs
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks
10 | {
11 | ///
12 | /// App.xaml 的交互逻辑
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks
17 | {
18 | ///
19 | /// MainWindow.xaml 的交互逻辑
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | private void Button_OnClick(object sender, RoutedEventArgs e)
29 | {
30 | Txt.Text = new string('\u0483', 550);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // 有关程序集的一般信息由以下
8 | // 控制。更改这些特性值可修改
9 | // 与程序集关联的信息。
10 | [assembly: AssemblyTitle("WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks")]
15 | [assembly: AssemblyCopyright("Copyright © 2019")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // 将 ComVisible 设置为 false 会使此程序集中的类型
20 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
21 | //请将此类型的 ComVisible 特性设置为 true。
22 | [assembly: ComVisible(false)]
23 |
24 | //若要开始生成可本地化的应用程序,请设置
25 | //.csproj 文件中的 CultureYouAreCodingWith
26 | //例如,如果您在源文件中使用的是美国英语,
27 | //使用的是美国英语,请将 设置为 en-US。 然后取消
28 | //对以下 NeutralResourceLanguage 特性的注释。 更新
29 | //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //主题特定资源词典所处位置
36 | //(未在页面中找到资源时使用,
37 | //或应用程序资源字典中找到时使用)
38 | ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
39 | //(未在页面中找到资源时使用,
40 | //、应用程序或任何主题专用资源字典中找到时使用)
41 | )]
42 |
43 |
44 | // 程序集的版本信息由下列四个值组成:
45 | //
46 | // 主版本
47 | // 次版本
48 | // 生成号
49 | // 修订号
50 | //
51 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
52 | // 方法是按如下所示使用“*”: :
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks.Properties
12 | {
13 |
14 |
15 | ///
16 | /// 强类型资源类,用于查找本地化字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks/WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BDAA628B-7236-45A0-8C88-80309A67D6DD}
8 | WinExe
9 | WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks
10 | WPFAppsCrashIfDisplayTextWithTooManyCombiningMarks
11 | v4.7.2
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 4.0
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | MSBuild:Compile
56 |
57 |
58 | MSBuild:Compile
59 | Designer
60 |
61 |
62 | App.xaml
63 | Code
64 |
65 |
66 | MainWindow.xaml
67 | Code
68 |
69 |
70 |
71 |
72 | Code
73 |
74 |
75 | True
76 | True
77 | Resources.resx
78 |
79 |
80 | True
81 | Settings.settings
82 | True
83 |
84 |
85 | ResXFileCodeGenerator
86 | Resources.Designer.cs
87 |
88 |
89 | SettingsSingleFileGenerator
90 | Settings.Designer.cs
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------