zoukankan      html  css  js  c++  java
  • WPF Demo1

    <Window x:Class="Demo1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:sys="clr-namespace:System;assembly=mscorlib"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <StackPanel>
                <!--资源-->
                <StackPanel.Resources>
                    <sys:String x:Key="myString">
                        菩提本无树,明镜亦非台。
                        本来无一物,何处惹尘埃。
                    </sys:String>
                </StackPanel.Resources>
                <!--
                注意大小写,Slider默认大小为 10
                TextBox Text属性中用到了标记扩展
                -->
                <TextBox Text="{Binding ElementName=slider1,Path=Value,Mode=OneWay}" Margin="5"/>
                <TextBox x:Name="txtValue" Margin="5"/>
                <Slider x:Name="slider1" Margin=" 5" Maximum="100"/>
    
                <!--静态资源-->
                <TextBlock x:Name="txttest" Margin="5" TextWrapping="Wrap" Text="{Binding Source={StaticResource ResourceKey=myString}}"/>
    
            </StackPanel>
    
        </Grid>
    
        <x:Code>
            <!--WPF中实现了代码后置操作
            x:code可以将 后置的代码写入其中-->
    
            <![CDATA[
            
        
            
            ]]>
        </x:Code>
    </Window>
    
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    
    namespace Demo1
    {
        /// <summary>
        /// MainWindow.xaml 的交互逻辑
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
    
                this.txtValue.SetBinding(TextBox.TextProperty, new Binding("Value") { ElementName="slider1"});
            }
        }
    }
    
    <Application x:Class="Demo1.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 StartupUri="MainWindow.xaml">
        <Application.Resources>
             
        </Application.Resources>
    </Application>
    

    运行效果如下:

  • 相关阅读:
    some tips
    ORA00847: MEMORY_TARGET/MEMORY_MAX_TARGET and LOCK_SGA cannot be set together
    Chapter 01Overview of Oracle 9i Database Perfomrmance Tuning
    Chapter 02Diagnostic and Tuning Tools
    变量与常用符号
    Chapter 18Tuning the Operating System
    标准输入输出
    Trace files
    DBADeveloped Tools
    Chapter 03Database Configuration and IO Issues
  • 原文地址:https://www.cnblogs.com/YYkun/p/6866209.html
Copyright © 2011-2022 走看看