zoukankan      html  css  js  c++  java
  • ListView和TextBox,x:Null

    <Window x:Class="WpfApp_Delete.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525"
            xmlns:Custom="clr-namespace:WpfApp_Delete"
            >
        <Window.Resources>
            <Custom:DemoList x:Key="MyList">
                <Custom:Demo Address="黄石" Sex="男" />
                <Custom:Demo Address="铁山" Sex="女"/>
            </Custom:DemoList>
            <Custom:Demo x:Key="MyDemo" Address="黄石" Sex="男" />
        </Window.Resources>
        <Grid DataContext="{StaticResource MyList}">
            <Grid.Resources>
                <!--x:Null的事例-->
                <Style TargetType="Button">
                    <Setter Property="Width" Value="200"/>
                </Style>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
                </Style>
            </Grid.Resources>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="10,10,0,0" Name="textBox1" Text="{Binding ElementName=lvRoot, Path=SelectedItem.Sex}" VerticalAlignment="Top" Width="120" />
            <ListView Name="lvRoot" Height="100" HorizontalAlignment="Left" Margin="10,43,0,0" VerticalAlignment="Top" Width="481" ItemsSource="{Binding}" >
                <ListView.View>
                    <GridView>
                        <GridViewColumn DisplayMemberBinding="{Binding Address}" Header="住址" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Sex}" Header="性别" Width="100"/>
                    </GridView>
                </ListView.View>
            </ListView>
            <!--x:Null的事例-->
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="35,157,0,0" Name="button1" VerticalAlignment="Top" />
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="265,157,0,0" Name="button2" Style="{x:Null}" VerticalAlignment="Top" />
        </Grid>
    </Window>
  • 相关阅读:
    我的UI启蒙之路
    关于UI设计行业的认识再到认识
    谈谈我对Ui设计师的一些观点
    Web前端工程师常去的15个技术网站
    Banner中文字怎么排版才好看?
    UI设计师经常去的五个网站
    PS快捷键大全,记住这些就够了!
    UI设计师如何提升审美?
    170. Two Sum III
    169. Majority Element
  • 原文地址:https://www.cnblogs.com/kelei12399/p/2582606.html
Copyright © 2011-2022 走看看