精通C#---WPF和XAML

1.WPF之前功能和解决方法
控件表单 Windows Forms
2D 图形API
3D DirectX API
流视频 Windows Media Player API
流文档 PDF

简单UI元素
交互的二维,三维图像
动画
多媒体

2.Application

Current
MainWindow
Properties
StartupUri
Windows

//
class MyApp : Application
{
    [STAThread]
    static void Main()
    {
        MyApp app = new MyApp();
        app.Startup += (s, e)=>{};
        app.Exit += (s, e)=>{};
    }
}

//
static void MinimizeAllWindows()
{
    foreach(Window wnd in Application.Current.Windows)
    {
        wnd.WindowState = WindowState.Minimized;
    }
}

3.System.Windows.Controls.Control
Background, Foreground, BorderBrush, BorderThickness, Padding, HorizontalContentAlignment, VerticalContentAlignment

FontFamily, FontSize, FontStretch, FontWeight
IsTabStop, TabIndex
MouseDoubleClick, PreviewMouseDoubleClick
Template

4.System.Windows.FrameworkElement
ActualHeight, ActualWidth, MaxHeight, MaxWidth, MinHeight, MinWidth, Height, Width
ContextMenu
Cursor
HorizontalAlignment, VerticalAlignment
Name
Resources
ToolTip

5.System.Windows.UIElement
Focusable, IsFocused
IsEnabled
IsMouseDirectlyOver和IsMouseOver
IsVisible, Visibility
RederTransform

6.XAML属性语法

<Button Height = "43">
Button>

等价与
<Button>
<Button.Height>
43
Button.Height>
Button>

7.窗口或任何ContentControl的子类的Content属性只能设置一个对象。
如果窗口需要包含多个元素,那么这些元素须被安排在多个面板中。
面板可以容纳所有表示窗口的UI元素,而面板本身将作为唯一的对象,赋给窗口的Content属性。

8.

// XAML
"WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        WindowStartupLocation="CenterScreen">

    
        "ApplicationCommands.Open" Executed="OpenCmdExecuted" CanExecute="OpenCmdCanExecute"/>
        "ApplicationCommands.Save" Executed="SaveCmdExecuted" CanExecute="SaveCmdCanExecute"/>
    

    
        "Top" 
              HorizontalAlignment="Left" Background="White" BorderBrush="Black">
            "_File">
                "ApplicationCommands.Open"/>
                "ApplicationCommands.Save"/>
                
                "_Exit" MouseEnter="MouseEnterExitArea" MouseLeave="MouseLeaveArea" Click="FileExit_Click"/>
            

            "_Edit">
                "ApplicationCommands.Copy"/>
                "ApplicationCommands.Cut"/>
                "ApplicationCommands.Paste"/>
            

            "_Tools">
                "_Spelling Hints"
                    MouseEnter="MouseEnterToolsHintArea"
                    MouseLeave="MouseLeaveArea"
                    Click="ToolsSpellingHints_Click"/>
            
        

        "Top">
            

9.Document API
System.Windows.Documents
List
Paragraph
Section
Table
LineBreak
Figure
Floater
Span

块元素:
System.Windows.Documents.Block
内联元素:
System.Windows.Document.Inline
文档布局管理器:
FlowDocument
FixDocument

FlowDocumentReader
FlowDocumentScrollViewer
RichTextBox
FlowDocumentPageViewer

10.

Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:a ="clr-namespace:System.Windows.Annotations;assembly=PresentationFramework"
        Title="MainWindow" Height="350" Width="525"
        WindowStartupLocation="CenterScreen">
    "110,75,7,4.5">
        "myTabSystem" HorizontalAlignment="Left" Height="280"
            Margin="10,0,-96,0" VerticalAlignment="Top" Width="489">
            "Ink API">
                "0,0,98,36" Orientation="Vertical">
                    "myInkCanvas" Height="210"/>
                
            
            "tabDocuments" Header="Documents" VerticalAlignment="Bottom" Height="20">
                
                    
                        

你可能感兴趣的:(Language-c#)