wpf, datagrid最后空白列,消除方法 5
最后空白“列”其实不是列,只是最后列的宽度没有控制好,而“横线”划过头了。如何消除,网络的答案width="*",和加入到BoxView都不行。还有其它方法吗?刚对WPF...
最后空白“列”其实不是列,只是最后列的宽度没有控制好,而“横线”划过头了。如何消除,网络的答案
width="*", 和 加入 到BoxView 都不行。还有其它方法吗? 刚对WPF有点好感, 发现这个致命的缺陷! 因为数据库开发最关心 Datagrid 展开
width="*", 和 加入 到BoxView 都不行。还有其它方法吗? 刚对WPF有点好感, 发现这个致命的缺陷! 因为数据库开发最关心 Datagrid 展开
2个回答
展开全部
<Grid x:Name="grid">
<DataGrid IsReadOnly="False" CanUserAddRows="True" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="0,10,0,0" Name="dgv_ModuleAuthority" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=grid, Mode=OneWay}" Height="380">
<DataGrid.Columns>
<DataGridTextColumn Header="编号" Binding="{Binding Path=Auto_ID}" Width="90"/>
<DataGridTextColumn Header="模块编号" Binding="{Binding Path=Module_ID}" Width="90"/>
<!--<DataGridComboBoxColumn Header="AccessAuthoritys" Width="95"
SelectedItemBinding="{Binding AccessAuthoritys,UpdateSourceTrigger=PropertyChanged}">
<DataGridComboBoxColumn.ItemsSource>
<col:ArrayList>
<sys:String>321</sys:String>
<sys:String>145</sys:String>
<sys:String>123</sys:String>
</col:ArrayList>
</DataGridComboBoxColumn.ItemsSource>
</DataGridComboBoxColumn>-->
<DataGridComboBoxColumn x:Name="AccessAuthoritys" Header="访问权限" Width="95" ItemsSource="{Binding Source={StaticResource myEnum}}"
TextBinding="{Binding AccessAuthoritys}">
</DataGridComboBoxColumn>
<!--<DataGridTemplateColumn Header="访问权限" Width="95">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Source={StaticResource AccessEnum}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<DataGridCheckBoxColumn Header="新增" Binding="{Binding Path=AllowAdd}" Width="90"/>
<DataGridCheckBoxColumn Header="修改" Binding="{Binding Path=AllowModidfy}" Width="90"/>
<DataGridCheckBoxColumn Header="删除" Binding="{Binding Path=AllowDelete}" Width="90"/>
<DataGridCheckBoxColumn Header="打印" Binding="{Binding Path=AllowPrint}" Width="90"/>
<DataGridCheckBoxColumn Header="导出" Binding="{Binding Path=AllowExport}" Width="90"/>
<DataGridCheckBoxColumn Header="审核" Binding="{Binding Path=AllowAuditing}" Width="90"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btn_Save" Content="保存" HorizontalAlignment="Left" Margin="270,404,0,0" VerticalAlignment="Top" Width="75" Click="btn_Save_Click"/>
<Button x:Name="btn_Del" Content="删除" HorizontalAlignment="Left" Margin="549,404,0,0" VerticalAlignment="Top" Width="75" Click="btn_Del_Click"/>
</Grid>
<DataGrid IsReadOnly="False" CanUserAddRows="True" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="0,10,0,0" Name="dgv_ModuleAuthority" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=grid, Mode=OneWay}" Height="380">
<DataGrid.Columns>
<DataGridTextColumn Header="编号" Binding="{Binding Path=Auto_ID}" Width="90"/>
<DataGridTextColumn Header="模块编号" Binding="{Binding Path=Module_ID}" Width="90"/>
<!--<DataGridComboBoxColumn Header="AccessAuthoritys" Width="95"
SelectedItemBinding="{Binding AccessAuthoritys,UpdateSourceTrigger=PropertyChanged}">
<DataGridComboBoxColumn.ItemsSource>
<col:ArrayList>
<sys:String>321</sys:String>
<sys:String>145</sys:String>
<sys:String>123</sys:String>
</col:ArrayList>
</DataGridComboBoxColumn.ItemsSource>
</DataGridComboBoxColumn>-->
<DataGridComboBoxColumn x:Name="AccessAuthoritys" Header="访问权限" Width="95" ItemsSource="{Binding Source={StaticResource myEnum}}"
TextBinding="{Binding AccessAuthoritys}">
</DataGridComboBoxColumn>
<!--<DataGridTemplateColumn Header="访问权限" Width="95">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Source={StaticResource AccessEnum}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<DataGridCheckBoxColumn Header="新增" Binding="{Binding Path=AllowAdd}" Width="90"/>
<DataGridCheckBoxColumn Header="修改" Binding="{Binding Path=AllowModidfy}" Width="90"/>
<DataGridCheckBoxColumn Header="删除" Binding="{Binding Path=AllowDelete}" Width="90"/>
<DataGridCheckBoxColumn Header="打印" Binding="{Binding Path=AllowPrint}" Width="90"/>
<DataGridCheckBoxColumn Header="导出" Binding="{Binding Path=AllowExport}" Width="90"/>
<DataGridCheckBoxColumn Header="审核" Binding="{Binding Path=AllowAuditing}" Width="90"/>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="btn_Save" Content="保存" HorizontalAlignment="Left" Margin="270,404,0,0" VerticalAlignment="Top" Width="75" Click="btn_Save_Click"/>
<Button x:Name="btn_Del" Content="删除" HorizontalAlignment="Left" Margin="549,404,0,0" VerticalAlignment="Top" Width="75" Click="btn_Del_Click"/>
</Grid>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询