PartBase<T> Class
Represents a part within a part-based edit box.
public abstract class PartBase<T> : IPart
- Type Parameters:
-
T-The part value type.
- Inheritance:
- object object
- Derived:
- FormattedPartBase<T> LiteralPart
- Implements:
- IPart
Constructors
PartBase()
Initializes an instance of the class.
protected PartBase()
Properties
IsEditable
Indicates whether the part is editable.
public virtual bool IsEditable { get; }
Property Value
- bool:
trueif the part is editable; otherwise,false.
IsLiteral
Indicates whether the part is a literal.
[Obsolete("Instead of the IsLiteral property, test if an object implements the ILiteralPart interface.")]
public virtual bool IsLiteral { get; }
Property Value
- bool:
trueif the part is a literal; otherwise,false.
IsOptional
Indicates whether this part is optional.
public virtual bool IsOptional { get; }
Property Value
- bool:
trueif this part is optional; otherwise,false.
Length
The character length of the part within the text.
StartOffset
The start offset of the part within the text.
StringValue
The current string value of the part, if known.
Methods
IsTextInputAllowed(string, int, CultureInfo)
Indicates whether the input text is allowed.
public virtual bool IsTextInputAllowed(string text, int offset, CultureInfo culture)
| Parameter | Type | Description |
|---|---|---|
| text | string | The text to examine. |
| offset | int | The absolute offset at which the text would be input if allowed, which can be compared to StartOffset to determine the relative offset within the part. |
| culture | CultureInfo | The CultureInfo to use. |
Returns
- bool:
trueif the text input is allowed; otherwise,false.
Remarks
This method is only called when the corresponding edit box has enabled input filtering.
See Also
TryParseText(IList<IPart>, string, int, CultureInfo, out int)
Tries to parse the text starting offset and returns the offset through which parsing was completed.
public abstract bool TryParseText(IList<IPart> parts, string text, int startOffset, CultureInfo culture, out int offset)
| Parameter | Type | Description |
|---|---|---|
| parts | IList<IPart> | The part collection in which this part is a member. |
| text | string | The text to examine. |
| startOffset | int | The start offset. |
| culture | CultureInfo | The CultureInfo to use. |
| offset | int | Returns the offset through which parsing was completed. |
Returns
- bool:
trueif parsing was successful; otherwise,false.
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()