CrazyGood 2023-01-18 15:14 采纳率: 0%
浏览 80
已结题

WPF前端XAML代码如何用后台XAML.CS代码实现?

问题:下列WPF前端XAML代码如何用后台XAML.CS代码实现?

背景:需根据后台返回List个数动态生成数据方块,呈如图所示分布。

img

前端代码:

    <!--动态生成指令信息方块的可滚动区域begin-->
    <ScrollViewer  VerticalScrollBarVisibility="Auto" Height="627" Margin="0,174,10,0" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Right" Width="533" >
        <!--居中对齐-->
        <StackPanel x:Name="StackPanelMain" Height="auto" Width="530"  VerticalAlignment="Center">
            <!--左数据方块-->
            <Grid  Height="100" Margin="25,10,270,10" >
                <Grid.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="FontSize" Value="16"/>
                        <Setter Property="FontFamily" Value="微软雅黑"/>
                    </Style>
                    <Style TargetType="Border">
                        <Setter Property="BorderBrush" Value="Black"/>
                        <Setter Property="BorderThickness" Value="1"/>
                    </Style>
                </Grid.Resources>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80"/>
                    <ColumnDefinition Width="150"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Border Grid.RowSpan="4"  Grid.ColumnSpan="4" Background="Yellow"/>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="拣货单:"/>
                <TextBlock Grid.Row="0" Grid.Column="1" Text="ME0000052"/>
                <TextBlock Grid.Row="1" Grid.Column="0" Text="指令号:"/>
                <TextBlock Grid.Row="1" Grid.Column="1" Text="22090700006"/>
                <TextBlock Grid.Row="2" Grid.Column="0" Text="料号:"/>
                <TextBlock Grid.Row="2" Grid.Column="1" Text="HQ11730306009"/>
                <TextBlock Grid.Row="3" Grid.Column="0" Text="指令需求:"/>
                <TextBlock Grid.Row="3" Grid.Column="1" Text="10009"/>
            </Grid>
            <!--右数据方块-->
            <Grid Height="100" Margin="270,-110,25,10" >
                <Grid.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="FontSize" Value="16"/>
                        <Setter Property="FontFamily" Value="微软雅黑"/>
                    </Style>
                    <Style TargetType="Border">
                        <Setter Property="BorderBrush" Value="Black"/>
                        <Setter Property="BorderThickness" Value="1"/>
                    </Style>
                </Grid.Resources>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80"/>
                    <ColumnDefinition Width="150"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Border Grid.RowSpan="4"  Grid.ColumnSpan="4" Background="Yellow"/>

                <TextBlock Grid.Row="0" Grid.Column="0" Text="拣货单:"/>
                <TextBlock Grid.Row="0" Grid.Column="1" Text="ME0000052"/>
                <TextBlock Grid.Row="1" Grid.Column="0" Text="指令号:"/>
                <TextBlock Grid.Row="1" Grid.Column="1" Text="22090700006"/>
                <TextBlock Grid.Row="2" Grid.Column="0" Text="料号:"/>
                <TextBlock Grid.Row="2" Grid.Column="1" Text="HQ11730306009"/>
                <TextBlock Grid.Row="3" Grid.Column="0" Text="指令需求:"/>
                <TextBlock Grid.Row="3" Grid.Column="1" Text="10009"/>
            </Grid>
        </StackPanel>
    </ScrollViewer>
    <!--动态生成指令信息按钮区域end-->
  • 写回答

5条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-01-18 18:33
    关注
    评论

报告相同问题?

问题事件

  • 系统已结题 1月26日
  • 修改了问题 1月18日
  • 修改了问题 1月18日
  • 修改了问题 1月18日
  • 展开全部

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler