wpf datagrid 的单元格内容超出列宽度
2021-04-14 17:25
标签:nta inf false text block 单元 prope setter ade wpf datagrid 的单元格内容超出列宽度 标签:nta inf false text block 单元 prope setter ade 原文地址:https://www.cnblogs.com/softwyy/p/8954631.html 1 Window x:Class="WpfApplication2.MainWindow"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 Title="MainWindow" Height="350" Width="525">
5 Grid>
6 DataGrid Name="grid1" AutoGenerateColumns="False">
7 DataGrid.Columns>
8
9 DataGridTemplateColumn Header="姓名" Width="30" MaxWidth="100">
10 DataGridTemplateColumn.CellTemplate>
11 DataTemplate>
12
13 TextBlock Text="{Binding Name}" TextTrimming="WordEllipsis"/>
14 DataTemplate>
15 DataGridTemplateColumn.CellTemplate>
16 DataGridTemplateColumn.CellStyle>
17 Style>
18
19 Setter Property="ToolTipService.ToolTip" Value="{Binding Name}"/>
20 Style>
21 DataGridTemplateColumn.CellStyle>
22 DataGridTemplateColumn>
23 DataGridTextColumn Header="年龄" Binding="{Binding Age}" Width="50"/>
24 DataGrid.Columns>
25 DataGrid>
26 Grid>
文章标题:wpf datagrid 的单元格内容超出列宽度
文章链接:http://soscw.com/index.php/essay/75745.html