GetItem Method
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WPF. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets a particular image from the collection.
Syntax
GetItem()
Gets the image selected by the user.
public Image GetItem();Public Function GetItem() As ImageGetItem(int)
Gets the image with the specified identifier. An identifier can be set with the Image.ID property.
public Image GetItem(int id);Public Function GetItem(id As Integer) As Image| Parameter | Description |
|---|---|
| id | Specifies the image's identifier. The method returns null if an image with the specified identifier does not exist. |
GetItem(string)
Gets the image with the specified name. A name can be set with the Image.Name property.
public Image GetItem(string name);Public Function GetItem(name As String) As Image| Parameter | Description |
|---|---|
| name | Specifies the image's name. The method returns null if an image with the specified name does not exist. |
Return Value
The return value is null, if an image with the specified parameters could not be found. Otherwise, it is an object of the type Image.
Examples
The following example retrieves the image at the current input position and supplies missing alternative text.
TXTextControl.Image logo = new() { FileName = @"Images\company-logo.png", Name = "CompanyLogo", DescriptiveText = "Company logo" };
textControl.Images.Add(logo, -1);
TXTextControl.Image image = textControl.Images.GetItem();
if (image != null && string.IsNullOrWhiteSpace(image.DescriptiveText))
{
image.DescriptiveText = "Company logo";
}Dim logo As New TXTextControl.Image() With { .FileName = "Images\company-logo.png", .Name = "CompanyLogo", .DescriptiveText = "Company logo" }
textControl.Images.Add(logo, -1)
Dim image As TXTextControl.Image = textControl.Images.GetItem()
If image IsNot Nothing AndAlso String.IsNullOrWhiteSpace(image.DescriptiveText) Then
image.DescriptiveText = "Company logo"
End If