转自 http://blog.csdn.net/lassewang/article/details/6928897
测试环境: Windows XP/Windows 7
开发环境: Microsoft Expression Blend 4 + Microsofot Visual Studio 2008 + .Net FrameWork 4.0
步骤一:
使用Blend4建立一个WPF应用程序
步骤二:
将窗体上的窗体布局控件换成Canvas控件
步骤三:
在Canvas控件上增加两个按钮以及一个ListView控件,分别命名为DMItem, FileManager, RemoteManager, 这三个按钮的位置为竖形排放(最上面为Button,中间为ListVIew, 下面为Button), 默认情况下ListView是不可见的
步骤四:
给DMItem按钮增加一个鼠标点击事件,并按照如下代码编写
private void DirectoryManager_Click(object sender, RoutedEventArgs e) { double dtop = 14; if (!b_IsShowDMP) { this.DMItem.Visibility = System.Windows.Visibility.Visible; this.DMItem.SetValue(Canvas.LeftProperty, (double)10); dtop += this.DirectoryManager.Height; this.DMItem.SetValue(Canvas.TopProperty, dtop); dtop += this.DMItem.Height + 3; this.FileManager.SetValue(Canvas.TopProperty, dtop); dtop += this.FileManager.Height + 3; this.RemoteManager.SetValue(Canvas.TopProperty, dtop); b_IsShowDMP = true; } else { this.DMItem.Visibility = System.Windows.Visibility.Hidden; dtop += this.DirectoryManager.Height + 3; this.FileManager.SetValue(Canvas.TopProperty, dtop); dtop += this.FileManager.Height + 3; this.RemoteManager.SetValue(Canvas.TopProperty, dtop); b_IsShowDMP = false; } }
步骤五:
编译
转自 http://blog.csdn.net/lassewang/article/details/6928897