C
C#16mo ago
Mekasu0124

✅ How to "preview" text in a DataGrid

<DataGridTextColumn CanUserReorder="False" CanUserResize="False" Width="*" Header="Diary Entry" Binding="{Binding Description}" />
<DataGridTextColumn CanUserReorder="False" CanUserResize="False" Width="*" Header="Diary Entry" Binding="{Binding Description}" />
How would I go about setting the description to only show like the first 10 words and trail off with a . . . like for example
Date | Time | Title | Description
08/12/23 | 6:54 PM | My Awesome Title | Some Entry Leading and Ending With. . .
Date | Time | Title | Description
08/12/23 | 6:54 PM | My Awesome Title | Some Entry Leading and Ending With. . .
4 Replies
Buddy
Buddy16mo ago
Mekasu0124
Mekasu0124OP16mo ago
I apprecaite it, but I have not learned how to use interfaces as of yet, so this is a bit out of my reach.
Mekasu0124
Mekasu0124OP16mo ago
ok thank you. can I ask another question? I am creating an item through a model, and that model's date property is a DateOnly. In my code, I'm converting it to such, but I'm wondering if I'm doing it right.
private DiaryItem CreateDiaryItem()
{
var date = DateOnly.FromDateTime(DateTime.Now);
var time = TimeOnly.FromTimeSpan(...);
return new DiaryItem { Description = Description, Title = Title, Date = date, Time = time };
}
private DiaryItem CreateDiaryItem()
{
var date = DateOnly.FromDateTime(DateTime.Now);
var time = TimeOnly.FromTimeSpan(...);
return new DiaryItem { Description = Description, Title = Title, Date = date, Time = time };
}
if I'm not doing this right, then I apologize. Still learning some libraries. I need to separate the current date and time into two separate variables and I need the date to be a DateOnly and the time to be a TimeOnly. nevermind. solved it
Want results from more Discord servers?
Add your server