开发者

WPF Custom ComboBox Control

开发者 https://www.devze.com 2023-03-01 04:20 出处:网络
I am using a ComboBox in my WPF application. The ComboBox has a scrolling issue that was introduced in the .NET Framework. I looked online for a solution and found that I need to create a new ComboBox

I am using a ComboBox in my WPF application. The ComboBox has a scrolling issue that was introduced in the .NET Framework. I looked online for a solution and found that I need to create a new ComboBox that overrides OnApplyTemplate() and GetVisualChil开发者_JAVA技巧d((DependencyObject reference)) and introduces some new logic to fix the issue in these methods.

See: http://social.msdn.microsoft.com/forums/en-US/wpf/thread/0a571c75-4976-4c94-a59e-b085679a5d08/

My question, is simply, what type of control do you reckon I should create?

  1. Custom Control
  2. User Control
  3. Inherited from CoboBox Class - just simply create a new class that derives from ComboBox and add the methods above?


Your best bet is #3, which is what is done in the link you provided. For #1, you'd have to duplicate all of the ComboBox control code and I'm not sure you could do it with #2.

0

精彩评论

暂无评论...
验证码 换一张
取 消