如何将数据网格中的列宽度设置为 *
我的数据网格只有几列,我希望其中一列始终填充该数据网格的空白空间。我如何更改此代码以获得此结果?不幸的是这不是我的代码
<data:DataGrid
x:Name="grdArchive"
Grid.Row="0"
Visibility="Visible"
Style="{StaticResource DGrid}"
ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"
RowStyle="{StaticResource DataGridRowStyle}"
GridLinesVisibility="Horizontal"
SelectionMode="Single"
AutoGenerateColumns="False"
Background="#FFFFFF"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
IsReadOnly="True"
CanUserResizeColumns="False"
LoadingRow="grdMessages_LoadingRow">
<data:DataGrid.Columns>
<!-- COLUMN: ESCALATE TYPE ID -->
<data:DataGridTemplateColumn CanUserSort="True"
SortMemberPath="EscalateTypeId">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding EscalateTypeId, Converter={StaticResource cnvMessagingStrings}, ConverterParameter=2}"
VerticalAlignment="Center"
Margin="5,0,5,0"/>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
I have got datagrid with few columns, and I want to have one of them always fill empty space of this datagrid. Hwo can I change this code to have this result? Unfortunately this is not my code
<data:DataGrid
x:Name="grdArchive"
Grid.Row="0"
Visibility="Visible"
Style="{StaticResource DGrid}"
ColumnHeaderStyle="{StaticResource DataGridColumnHeaderStyle}"
RowStyle="{StaticResource DataGridRowStyle}"
GridLinesVisibility="Horizontal"
SelectionMode="Single"
AutoGenerateColumns="False"
Background="#FFFFFF"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
IsReadOnly="True"
CanUserResizeColumns="False"
LoadingRow="grdMessages_LoadingRow">
<data:DataGrid.Columns>
<!-- COLUMN: ESCALATE TYPE ID -->
<data:DataGridTemplateColumn CanUserSort="True"
SortMemberPath="EscalateTypeId">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding EscalateTypeId, Converter={StaticResource cnvMessagingStrings}, ConverterParameter=2}"
VerticalAlignment="Center"
Margin="5,0,5,0"/>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为 DataGridTemplateColumn 之一设置
Width="*"
。Set
Width="*"
for one of your DataGridTemplateColumn.我希望有一个与以下内容等效的 silverlight
I hope there is a silverlight equivalent of the following