Wpf改变gridView中的数据大小

时间:2014-10-29 20:08:18

标签: c# wpf xaml

你好我在gridView中有数据,我想改变数据的大小: 我的意思是我想调整来自c#

列表中的数据的大小

代码:

<Window x:Class="DadBussines.PL.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="800" Width="1600">
<Grid>

    <Label Content="product name" FontSize="25" Margin="705,121,652.6,590.4"/>
    <TextBox Name="name_textBox" FontSize="25" HorizontalAlignment="Left" Height="58" Margin="599,195,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="400" AllowDrop="True" IsHitTestVisible="True" TextChanged="name_textBox_TextChanged" />


    <Button Content="add product" FontSize="25" HorizontalAlignment="Left" Margin="19,27,0,0" VerticalAlignment="Top" Width="123" Click="Button_Click_Add_Product"/>
    <Button Content="delete product" FontSize="25" HorizontalAlignment="Left" Margin="161,27,0,0" VerticalAlignment="Top" Width="129" Click="Button_Click_Delete_Product"/>
    <Button Content="add amount" FontSize="25" HorizontalAlignment="Left" Margin="304,27,0,0" VerticalAlignment="Top" Width="142" Click="Button_Click_Add_Amount"/>
    <Button Content="delete amount" FontSize="25" HorizontalAlignment="Left" Margin="461,27,0,0" VerticalAlignment="Top" Width="151" Click="Button_Click_Remove_Amount"/>
    <Button Content="change price" FontSize="25" HorizontalAlignment="Left" Margin="629,27,0,0" VerticalAlignment="Top" Width="151" Click="Button_Click_Change_Price" />
    <Label Content="money in staff" FontSize="25" HorizontalAlignment="Left" Margin="1388,90,0,0" VerticalAlignment="Top" Width="166"/>
    <Label Name="sumOfMoney_label" Content="" FontSize="25" HorizontalAlignment="Left" Margin="1185,95,0,0" VerticalAlignment="Top" Width="177"/>

    <ListView Margin="10,288,10,10" Name="products_ListView"  >
        <ListView.View>
            <GridView>
                <GridViewColumn Header="index" Width="40" DisplayMemberBinding="{Binding id}"/>
                <GridViewColumn Header="name product" Width="312" DisplayMemberBinding="{Binding name}"/>
                <GridViewColumn Header="price product" Width="312" DisplayMemberBinding="{Binding price}" />
                <GridViewColumn Header="amount product in cartons" Width="312" DisplayMemberBinding="{Binding amount}" />
                <GridViewColumn Header="amount product inside cartons" Width="312" DisplayMemberBinding="{Binding amount_in_box}" />
                <GridViewColumn Header="product type" Width="312" DisplayMemberBinding="{Binding catagory}" />


            </GridView>
        </ListView.View>
    </ListView>

</Grid>

1 个答案:

答案 0 :(得分:0)

如果要为每个gridviewcolumn的输出设置样式,则需要将列的celltemplate属性设置为某些内容。

查看MSDN上的示例: http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn.celltemplate(v=vs.110).aspx