首页 新闻 搜索 专区 学院

在WPF里做这种表用什么来设置

0
悬赏园豆:80 [已解决问题] 解决于 2017-04-19 08:51

刚接触的原来用的Grid直接写死的   但是后来需要生成折线图

wpf
不要放弃飞翔的主页 不要放弃飞翔 | 初学一级 | 园豆:107
提问于:2017-04-10 16:48
< >
分享
最佳答案
1

grid为布局容器 仅用于布局 边框应使用border 这个效果需要两者结合来完成

<Border Width="668" Height="224" HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="#86B4DF" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="28"></RowDefinition>
<RowDefinition Height="28"></RowDefinition>
<RowDefinition Height="28"></RowDefinition>
<RowDefinition Height="28"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="68"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="68"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Background="#86B4DF">
<TextBlock Text="氧化铝" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"></TextBlock>
</Border>
<Border Grid.Column="0" Grid.Row="1" BorderBrush="#86B4DF" BorderThickness="0,0,0,1">
<TextBlock Text="日期:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="0" Grid.Row="2" BorderBrush="#86B4DF" BorderThickness="0,0,0,1">
<TextBlock Text="单位:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="0" Grid.Row="3" BorderBrush="#86B4DF" BorderThickness="0,0,0,1">
<TextBlock Text="涨跌:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="0" Grid.Row="4" BorderBrush="#86B4DF" BorderThickness="0,0,0,0">
<TextBlock Text="说明:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="1" Grid.Row="1" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<TextBlock Text="20170215" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="1" Grid.Row="2" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<TextBlock Text="元/吨" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="1" Grid.Row="3" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<StackPanel Orientation="Horizontal">
<TextBlock Text="-20" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
<TextBlock Text="50" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</StackPanel>
</Border>
<Border Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3" BorderBrush="#86B4DF" BorderThickness="1,0,0,0">
<TextBlock Text="..." HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="2" Grid.Row="1" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<TextBlock Text="价格:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="2" Grid.Row="2" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<TextBlock Text="规格:" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="2" Grid.Row="3" BorderBrush="#86B4DF" BorderThickness="1,0,0,1"></Border>
<Border Grid.Column="3" Grid.Row="1" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<TextBlock Text="2910" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="3" Grid.Row="2" BorderBrush="#86B4DF" BorderThickness="1,0,0,1">
<TextBlock Text="散装" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5"></TextBlock>
</Border>
<Border Grid.Column="3" Grid.Row="3" BorderBrush="#86B4DF" BorderThickness="1,0,0,1"></Border>
</Grid>
</Border>

收获园豆:80
普通的地球人 | 菜鸟二级 |园豆:298 | 2017-04-18 11:39
其他回答(4)
0
codingHeart | 园豆:1511 (小虾三级) | 2017-04-10 17:04

wo 问的是标题的那个表用什么设计

支持(0) 反对(0) 不要放弃飞翔 | 园豆:107 (初学一级) | 2017-04-10 17:06
0

个人觉得还是用Grid呈现,折线图的生成单独用数据生成。

xs~ing | 园豆:184 (初学一级) | 2017-04-10 17:15

竖线没法弄出来

支持(0) 反对(0) 不要放弃飞翔 | 园豆:107 (初学一级) | 2017-04-12 08:39
0

谢谢了 不过自己已解决好久。。非常详细

不要放弃飞翔 | 园豆:107 (初学一级) | 2017-04-19 08:50
0

用WPF下的DataGrid实现

zenmshuo | 园豆:287 (菜鸟二级) | 2017-04-28 12:28
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册