zoukankan      html  css  js  c++  java
  • WPF SurfaceListBox SelectionChanged事件分析

    图片预览:

    xmal代码区:

    <s:SurfaceWindow x:Class="Qv2._0.SurfaceWindow1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="http://schemas.microsoft.com/surface/2008"
        Title="Qv2._0"
        >
        <Grid Background="Transparent">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <s:SurfaceListBox Name="ContentSelector" Grid.Column="0"
                              SelectionChanged="OnSelectionChanged" Width="200" >       
                <s:SurfaceListBoxItem Content="item1" >
                    <s:SurfaceListBoxItem.Tag>
                        <Grid>
                            <Button Width="200" Height="200">OK1</Button>
                            <Button VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="200" Height="200"
                                    Click="Button_Click">返回</Button>
                        </Grid>
                    </s:SurfaceListBoxItem.Tag>
                </s:SurfaceListBoxItem>

                <s:SurfaceListBoxItem Content="item2">
                    <s:SurfaceListBoxItem.Tag>
                        <Grid>
                            <Button Width="200" Height="200">OK2</Button>
                            <Button VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="200" Height="200"
                                    Click="Button_Click2">返回</Button>
                        </Grid>
                    </s:SurfaceListBoxItem.Tag>
                </s:SurfaceListBoxItem>

                <s:SurfaceListBoxItem Content="item3">
                    <s:SurfaceListBoxItem.Tag>
                        <Grid>
                            <Button Width="200" Height="200">OK3</Button>
                            <Button VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="200" Height="200"
                                    Click="Button_Click3">返回</Button>
                        </Grid>
                    </s:SurfaceListBoxItem.Tag>
                </s:SurfaceListBoxItem>
            </s:SurfaceListBox>          

        <Grid   Grid.Column="1" Background="Transparent" Name="ContentArea" Margin="7"/>
        </Grid>
    </s:SurfaceWindow>

    cs:代码片段

        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                SurfaceListBoxItem selectedItem = (SurfaceListBoxItem)ContentSelector.SelectedItem;
                Grid content = selectedItem.Tag as Grid;
                if (content != null)
                {

                    ContentArea.Children.Clear();
                    ContentArea.Children.Add(content);
                    ContentSelector.Visibility = Visibility.Hidden;

                }
            }

        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
            {

        //初始化
                SurfaceListBoxItem selectedItem = (SurfaceListBoxItem)ContentSelector.SelectedItem;
                Grid content = selectedItem.Tag as Grid;
                if (content != null)
                {

                    ContentArea.Children.Clear();
                    ContentArea.Children.Add(content);
                    ContentSelector.Visibility = Visibility.Hidden;

                }
            }

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                ContentSelector.Visibility = Visibility.Visible;
              
            }
            private void Button_Click2(object sender, RoutedEventArgs e)
            {
                ContentSelector.Visibility = Visibility.Visible;
               
            }
            private void Button_Click3(object sender, RoutedEventArgs e)
            {
                ContentSelector.Visibility = Visibility.Visible;         
            }

  • 相关阅读:
    sqlserver和Oracle内部的错误数据修复(DBCC、DBMS_REPAIR)
    通过Oracle补充日志,找到锁阻塞源头的SQL
    禁用sqlserver的锁升级
    [转]SQLServer2008日志文件无法收缩处理方法
    Oracle警告、跟踪文件(10046、死锁等跟踪)
    dbms_stats包更新、导出、导入、锁定统计信息
    BulkCopy频繁执行产生的性能问题
    Oracle表空间不足
    组合索引字段顺序引发的死锁问题
    如何清除某条SQL的执行计划
  • 原文地址:https://www.cnblogs.com/DeepBlues/p/2932383.html
Copyright © 2011-2022 走看看