****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>