博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WPF 控件
阅读量:4506 次
发布时间:2019-06-08

本文共 3826 字,大约阅读时间需要 12 分钟。

****ScrollViewer****

前台:

<ScrollViewer  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Left" Margin="96,66,0,0" Name="scrollViewer1" VerticalAlignment="Top" Width="218"  Height="115">

            <TextBlock  HorizontalAlignment="Left" Margin="96,2,0,0" Name="textBlock1" VerticalAlignment="Top" />
        </ScrollViewer>

后台:

 textBlock1.Text = "dfsdfsdfsdfsdfsdfsdfsdfdfsdfsdf\"\r\n\"sdf“

****ListView****

前台:

<ListView Height="100" HorizontalAlignment="Left" Margin="12,12,0,0" Name="listView1" VerticalAlignment="Top" Width="300" >

            <ListView.View>
                <GridView x:Name="gridView1">
                    <GridViewColumn Header="商品名称" DisplayMemberBinding="{Binding Path=GoodsName}"></GridViewColumn>
                    <GridViewColumn Header="内容" DisplayMemberBinding="{Binding Path=GoodsIntroduce}"></GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

后台:

 public MainWindow()

        {
            InitializeComponent();
            string sql = "server=.;database=db_Tome1;uid=sa;pwd=123456";//连接字符串
            SqlConnection sqlcon = new SqlConnection(sql);//
            string sqlstr = "select GoodsName,GoodsIntroduce from tb_GoodsInfo";
            SqlDataAdapter da = new SqlDataAdapter(sqlstr, sqlcon);
            DataSet ds = new DataSet();
            ds.Clear();
            DataTable table1 = new DataTable();
            sqlcon.Open();
            da.Fill(ds, "table1");
            listView1.ItemsSource = ds.Tables[0].DefaultView;
            sqlcon.Dispose();
            sqlcon.Close();
           
        }

****Expander****

<StackPanel Margin="20,20" Width="100" Height="460" HorizontalAlignment="Left"  

                VerticalAlignment="Top">
            <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
                <Expander.Header>
                    <TextBlock Text="用户管理" FontSize="14" FontWeight="Bold" />
                </Expander.Header>
                <Expander.Content>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>
                        <RadioButton Grid.Row="0">会员管理</RadioButton>
                        <RadioButton Grid.Row="1">角色管理</RadioButton>
                    </Grid>
                </Expander.Content>
            </Expander>
            <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
                <Expander.Header>
                    <TextBlock Text="文档管理" FontSize="14" FontWeight="Bold" />
                </Expander.Header>
                <Expander.Content>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>
                        <RadioButton Grid.Row="0">部门资料</RadioButton>
                        <RadioButton Grid.Row="1">员工资料</RadioButton>
                        <RadioButton Grid.Row="2">职位资料</RadioButton>
                    </Grid>
                </Expander.Content>
            </Expander>
            <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
                <Expander.Header>
                    <TextBlock Text="采购管理" FontSize="14" FontWeight="Bold" />
                </Expander.Header>
                <Expander.Content>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>
                        <RadioButton Grid.Row="0">采购计划</RadioButton>
                        <RadioButton Grid.Row="1">需求分析</RadioButton>
                        <RadioButton Grid.Row="2">采购单</RadioButton>
                        <RadioButton Grid.Row="3">入库验收</RadioButton>
                        <RadioButton Grid.Row="4">入库退回</RadioButton>
                    </Grid>
                </Expander.Content>
            </Expander>
            <Expander VerticalAlignment="Stretch" ExpandDirection="Down" HorizontalContentAlignment="Left" SnapsToDevicePixels="True">
                <Expander.Header>
                    <TextBlock Text="供应商" FontSize="14" FontWeight="Bold" />
                </Expander.Header>
                <Expander.Content>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>
                        <RadioButton Grid.Row="0">基本资料</RadioButton>
                        <RadioButton Grid.Row="1">往来单位</RadioButton>
                        <RadioButton Grid.Row="2">上游供应商</RadioButton>
                    </Grid>
                </Expander.Content>
            </Expander>
        </StackPanel>

转载于:https://www.cnblogs.com/zhaoliang831214/p/3547722.html

你可能感兴趣的文章
Charles 连接手机抓包出现Unknown,一直无法抓包的问题解决
查看>>
VIM-->基础操作汇总
查看>>
oracle cursor
查看>>
Response.StatusCode的HTTP状态代码列表
查看>>
win7下maven安装和配置
查看>>
C# 多线程编程 ThreadStart ParameterizedThreadStart
查看>>
Android Camera Parameters 方法出错,求教
查看>>
一个仿照系统UIAlertView写的提示框
查看>>
Genymotion集成到Eclipse
查看>>
代码简洁之四 统一抽象层次
查看>>
IOS 缩放图片常用方法
查看>>
软件工程课
查看>>
Pycharm-连接服务器
查看>>
[Leetcode] The Skyline Problem
查看>>
okhttp异步请求流程和源码分析
查看>>
【集合框架】JDK1.8源码分析之Comparable && Comparator(九)
查看>>
Flutter之内置动画(转)
查看>>
uni-app中onLoad不起作用
查看>>
多线程概述
查看>>
Linux_ubuntu命令-用户、权限管理
查看>>