<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="FlowDocReader Load/Save Sample" Width="640" Height="480">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="22"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Menu Grid.Row="0">
<MenuItem>
<MenuItem.Header>File</MenuItem.Header>
<MenuItem Click="LoadFile">
<MenuItem.Header>Load</MenuItem.Header>
</MenuItem>
<MenuItem Click="SaveFile">
<MenuItem.Header>Save As...</MenuItem.Header>
</MenuItem>
<MenuItem Click="Clear">
<MenuItem.Header>Clear Content</MenuItem.Header>
</MenuItem>
<MenuItem Click="Exit">
<MenuItem.Header>Exit</MenuItem.Header>
</MenuItem>
</MenuItem>
</Menu>
<FlowDocumentReader Name="FlowDocRdr" Grid.Row="1"/>
</Grid>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Windows.Forms
Imports System.IO
Imports System.Windows.Markup
Namespace WpfApplication1
Public Partial Class Window1
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub LoadFile(sender As [Object], args As RoutedEventArgs)
Console.WriteLine("load")
End Sub
Private Sub SaveFile(sender As [Object], args As RoutedEventArgs)
Console.WriteLine("save")
End Sub
Private Sub Clear(sender As [Object], args As RoutedEventArgs)
FlowDocRdr.Document = Nothing
End Sub
Private Sub [Exit](sender As [Object], args As RoutedEventArgs)
Me.Close()
End Sub
End Class
End Namespace
|