ItemsControl使用

来源:互联网 发布:移动广告联盟源码 编辑:程序博客网 时间:2024/05/18 09:28

转载自:点击打开链接


<Grid>        <Grid.RowDefinitions>            <RowDefinition Height="Auto" />            <RowDefinition />            <RowDefinition />        </Grid.RowDefinitions>        <ItemsControl VerticalAlignment="Top">            <ItemsControl.ItemTemplate>                <DataTemplate>                    <Button Command="{Binding}" Content="{Binding}" Background="red"                        CommandTarget="{Binding ElementName=EditRegion}" />                </DataTemplate>            </ItemsControl.ItemTemplate>                        <ItemsControl.ItemsPanel>                <ItemsPanelTemplate>                    <StackPanel Orientation="Horizontal" Background="Green"/>                </ItemsPanelTemplate>            </ItemsControl.ItemsPanel>            <ItemsControl.Items>                <x:Static Member="ApplicationCommands.Cut"/>                <x:Static Member="ApplicationCommands.Copy"/>                <x:Static Member="ApplicationCommands.Paste"/>            </ItemsControl.Items>            <!--            <x:Static Member="ApplicationCommands.Cut"/>            <x:Static Member="ApplicationCommands.Copy"/>            <x:Static Member="ApplicationCommands.Paste"/>            -->        </ItemsControl>        <TextBox Name="EditRegion" Grid.Row="1"/>        <ListBox Grid.Row="2">            <ListBox.Items>                <ListBoxItem>                    <x:Static Member="ApplicationCommands.Cut"/>                </ListBoxItem>                <ListBoxItem>                    <x:Static Member="ApplicationCommands.Copy"/>                </ListBoxItem>                <ListBoxItem>                    <x:Static Member="ApplicationCommands.Paste"/>                </ListBoxItem>            </ListBox.Items>        </ListBox>    </Grid>


0 0
原创粉丝点击