ユーザーコントロールのobject、nint、nuint型プロパティはプロパティウィンドウで読み取り専用になります。
namespace UserControlTest1;
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
public object? ObjectProp { get; set; } = null;
public sbyte Int8Prop { get; set; }
public byte UInt8Prop { get; set; }
public short Int16Prop { get; set; }
public ushort UInt16Prop { get; set; }
public int Int32Prop { get; set; }
public uint UInt32Prop { get; set; }
public long Int64Prop { get; set; }
public ulong UInt64Prop { get; set; }
public nint NIntProp { get; set; }
public nuint NUIntProp { get; set; }
public char CharProp { get; set; }
public string StringProp { get; set; } = "123";
public float FloatProp { get; set; }
public double DoubleProp { get; set; }
public bool BoolProp { get; set; }
public int[] IntArrayProp { get; set; } = new[] { 1, 2, 3 };
public char[] CharArrayProp { get; set; } = new[] { 'A', 'B', 'C' };
public byte[] ByteArrayProp { get; set; } = new byte[] { 1, 2, 3 };
public string[] StringArrayProp { get; set; } = new[] { "A", "B", "C" };
public bool[] BoolArrayProp { get; set; } = new[] { false, true };
}
nint、nuint型プロパティはTypeConverter
を適用すると別の型として編集できます。
[TypeConverter(typeof(Int32Converter))]
public nint NIntProp { get; set; }
[TypeConverter(typeof(UInt32Converter))]
public nuint NUIntProp { get; set; }