zoukankan      html  css  js  c++  java
  • Silverlight 子窗口文件和导航项目

    子窗口文件

    在Silverlight3的项目中已经添加了ChildWindow 的文件,用来建立一个子窗口,一个模态窗口,用来相识更加丰富的信息交互。

    image

    默认我们会得到以下的Xaml内容,可以看到他的ns是controls,我们可以在其中包含你想要包含的XAML元素

    <controls:ChildWindow x:Class="Sample.chapter12.ChildWindow1"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
               xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
               Width="400" Height="300" 
               Title="ChildWindow1">
        <Grid x:Name="LayoutRoot" Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
    
            <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
            <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
        </Grid>
    </controls:ChildWindow>
    

    弹出子窗口的主窗口代码很简单

    private void Button_Click(object sender, RoutedEventArgs e)
            {
                //实μ例y化ˉ子ó窗°口ú对?象ó
                MyChildWindow myWin = new MyChildWindow();
                //设è置?标ê题a和í内ú容Y
                myWin.Title = "这a是?我ò的?窗°口ú!?";
                //子窗口的内容
                myWin.Content = new TextBlock()
                {
                    Text = @"大ó家ò好?,?这a是?Silverlight 3的?子ó窗°口ú界?面?!?",
                    TextWrapping = TextWrapping.Wrap,
                    Width = 380,
                    FontSize = 23
                };
                //显?示?子ó窗°口ú
                myWin.Show();
            }
    冯瑞涛
  • 相关阅读:
    探索Java8:(二)Function接口的使用
    Vue 动态图片加载路径问题和解决方法
    小工具:使用Python自动生成MD风格链接
    解决Navicat Premium 12 连接oracle数据库出现ORA-28547的问题
    Beetl模板引擎入门教程
    JSON.stringify()的深度使用
    nvm 查看node版本
    去掉点击a标签时产生的虚线框
    html 设置input框的记忆功能(联想内容)
    php post和get请求
  • 原文地址:https://www.cnblogs.com/finehappy/p/1669243.html
Copyright © 2011-2022 走看看