blazor-devexpress-dot-blazor-dot-dxgrid-b55e1000.md
Specifies whether the Grid wraps words or trims extra words and displays an ellipsis.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[DefaultValue(true)]
[Parameter]
public bool TextWrapEnabled { get; set; }
| Type | Default | Description |
|---|---|---|
| Boolean | true |
true to wrap words; false to trim extra words and display an ellipsis.
|
If a value does not fit into a cell as a single line, the cell displays multiple lines of text. Set the TextWrapEnabled property to false to disable word wrap and trim extra words in the following Grid elements (in other Grid elements, word wrap is always enabled):
Instead of trimmed characters, the Grid component displays an ellipsis. Users can hover over the cell to display all the text in a tooltip.
The following code snippet disables text wrapping:
<DxGrid Data="@Data"
TextWrapEnabled="false">
<Columns>
<DxGridDataColumn FieldName="CompanyName" />
<DxGridDataColumn FieldName="ContactName" />
<DxGridDataColumn FieldName="ContactTitle" />
<DxGridDataColumn FieldName="Country" Width="10%" />
<DxGridDataColumn FieldName="City" Width="10%" />
<DxGridDataColumn FieldName="Address" />
<DxGridDataColumn FieldName="Phone" Width="10%" />
</Columns>
</DxGrid>
@code {
object Data { get; set; }
protected override async Task OnInitializedAsync() {
var suppliers = await NwindDataService.GetSuppliersAsync();
Data = suppliers.Select(s => {
return new {
CompanyName = s.CompanyName,
ContactName = s.ContactName,
ContactTitle = s.ContactTitle,
Country = s.Country,
City = s.City,
Address = s.Address,
Phone = s.Phone
};
});
}
}
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace BlazorDemo.Data.Northwind {
public partial class Supplier {
public Supplier() {
Products = new HashSet<Product>();
}
public int SupplierId { get; set; }
public string CompanyName { get; set; }
public string ContactName { get; set; }
public string ContactTitle { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Region { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public string HomePage { get; set; }
public virtual ICollection<Product> Products { get; set; }
}
}
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BlazorDemo.Data.Northwind;
using BlazorDemo.DataProviders;
namespace BlazorDemo.Services {
public partial class NwindDataService {
public Task<IEnumerable<Supplier>> GetSuppliersAsync(CancellationToken ct = default) {
// Return your data here
}
}
}
// ...
builder.Services.AddScoped<NwindDataService>();
See Also