-
Notifications
You must be signed in to change notification settings - Fork 1k
Porting System.Windows.Forms.Design.ListControlStringCollectionEditor #2078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: TypeForwardedTo(typeof(System.Windows.Forms.Design.ListControlStringCollectionEditor))] | ||
RussKie marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we still need |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.ComponentModel; | ||
|
||
namespace System.Windows.Forms.Design | ||
{ | ||
/// <summary> | ||
/// The ListControlStringCollectionEditor override StringCollectionEditor | ||
/// to prevent the string collection from being edited if a DataSource | ||
/// has been set on the control. | ||
/// </summary> | ||
internal class ListControlStringCollectionEditor : StringCollectionEditor | ||
{ | ||
public ListControlStringCollectionEditor(Type type) : base(type) | ||
{ | ||
} | ||
|
||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) | ||
{ | ||
// If we're trying to edit the items in an object that has a DataSource set, throw an exception | ||
ListControl control = context.Instance as ListControl; | ||
if (control?.DataSource != null) | ||
{ | ||
throw new ArgumentException(SR.DataSourceLocksItems); | ||
} | ||
|
||
return base.EditValue(context, provider, value); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.