• WPF 中combox与datagrid绑定


        <Grid x:Name="LayoutRoot"  DataContext="{Binding Source={StaticResource Locator}, Path=CustomerViewModel}">
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Margin="20,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
                <Label Content="新客户:"/>
                <TextBox TextWrapping="Wrap" Width="142" Margin="0,0,10,0" Name="txt_name" />
                <Label Content="客户类型:"/>
                <ComboBox Width="120" Margin="0,0,20,0" Name="comb_type" ItemsSource="{Binding GetCustomType,Mode=OneWay}" DisplayMemberPath="Name" SelectedValuePath="Id" />
                <Button Content="添 加" Width="75" Name="bt_add" />
            </StackPanel>
            <DataGrid Margin="0" Grid.Row="1" Name="dg_list" ItemsSource="{Binding GetCustomers}" AutoGenerateColumns="False" IsReadOnly="True"  >
             <DataGrid.Columns>
              <DataGridTextColumn Binding="{Binding Id,Mode=OneWay}" Header="编号" Visibility="Hidden"/>
              <DataGridTextColumn Binding="{Binding Name,Mode=OneWay}" Header="客户名称" Width="100"/>
              <DataGridTextColumn Binding="{Binding CustomType.Name,Mode=OneWay}" Header="客户类型" Width="150"/>
              <DataGridTextColumn Binding="{Binding CreateTime.Date, Mode=OneWay}" Header="创建时间"/>
             </DataGrid.Columns>
            </DataGrid>
        </Grid>
  • 相关阅读:
    kubernetes集群系列资料08--deployment介绍
    kubernetes集群系列资料07--RS介绍
    kubernetes集群系列资料06--pod介绍
    kubernetes集群系列资料05--K8S集群命令介绍
    kubernetes集群系列资料04--harbor部署
    uwsgi + nginx 部署python项目(一)
    argparse命令行传参
    Flask的 sqlalchemy 操作要点
    mysql: show full processlist 详解
    MySQL数据库的连接池问题
  • 原文地址:https://www.cnblogs.com/swarb/p/9924385.html
Copyright © 2020-2023  润新知