<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
+ <RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
- <StackPanel Orientation="Horizontal" Grid.Row="0">
- <ComboBox ItemsSource="{Binding DocumentList}" SelectedItem="{Binding CurrentDocument,Mode=TwoWay}">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding Title}"/>
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
+ <Pivot ItemsSource="{Binding DocumentList}" Grid.Row="0" SelectedItem="{Binding CurrentDocument,Mode=TwoWay}">
+ <Pivot.HeaderTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Title}"/>
+ </DataTemplate>
+ </Pivot.HeaderTemplate>
+ <Pivot.ItemTemplate>
+ <DataTemplate>
+ <foo:FooTextBox Name="fooTextBox" Document="{Binding }" AllowFocusOnInteraction="True"></foo:FooTextBox>
+ </DataTemplate>
+ </Pivot.ItemTemplate>
+ </Pivot>
+ <StackPanel Grid.Row="1" >
<Button Content="Load" Click="Button_Click"/>
<Button Content="Print" Click="Print_Button_Click"/>
- <foo:FooTextBox Grid.Row="1" Name="fooTextBox" Document="{Binding CurrentDocument,Mode=TwoWay}" AllowFocusOnInteraction="True"></foo:FooTextBox>
+ </StackPanel>
</Grid>
</Page>
{
this.InitializeComponent();
this.DataContext = this.vm;
- this.fooTextBox.Document = this.vm.CurrentDocument;
//this.fooTextBox.AllowFocusOnInteraction = true;
PrintManager.GetForCurrentView().PrintTaskRequested += MainPage_PrintTaskRequested;
InputPane currentView = InputPane.GetForCurrentView();
void currentView_Hiding(InputPane sender, InputPaneVisibilityEventArgs args)
{
- this.fooTextBox.Margin = new Thickness(0);
+ this.Margin = new Thickness(0);
args.EnsuredFocusedElementInView = true;
}
void currentView_Showing(InputPane sender, InputPaneVisibilityEventArgs args)
{
- this.fooTextBox.Margin = new Thickness(0, 0, 0, args.OccludedRect.Height);
+ this.Margin = new Thickness(0, 0, 0, args.OccludedRect.Height);
args.EnsuredFocusedElementInView = true;
}
{
IAsyncAction async = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
- var source = new DocumentSource(this.fooTextBox.Document, new FooEditEngine.Padding(20, 20, 20, 20), this.fooTextBox.FontFamily.Source, this.fooTextBox.FontSize);
+ var doc = this.vm.CurrentDocument;
+ var source = new DocumentSource(doc, new FooEditEngine.Padding(20, 20, 20, 20), this.FontFamily.Source, this.FontSize);
source.ParseHF = (s,e)=> { return e.Original; };
source.Header = "header";
source.Fotter = "footer";
- source.Forground = this.fooTextBox.Foreground;
- source.Keyword1 = this.fooTextBox.Keyword1;
- source.Keyword2 = this.fooTextBox.Keyword2;
- source.Literal = this.fooTextBox.Literal;
- source.Comment = this.fooTextBox.Comment;
- source.Url = this.fooTextBox.URL;
+ source.Forground = new Windows.UI.Color() { R = 0, A = 255, B = 0, G = 0};
+ source.Keyword1 = new Windows.UI.Color() { R = 0, A = 255, B = 255, G = 0 };
+ source.Keyword2 = new Windows.UI.Color() { R = 128, A = 255, B = 255, G = 0 };
+ source.Literal = new Windows.UI.Color() { R = 128, A = 255, B = 128, G = 0 };
+ source.Comment = new Windows.UI.Color() { R = 255, A = 255, B = 0, G = 0 };
+ source.Url = new Windows.UI.Color() { R = 0, A = 255, B = 255, G = 0 };
PrintTask task = null;
task = args.Request.CreatePrintTask("test", (e) =>
using (var ws = await file.OpenAsync(FileAccessMode.Read))
using (var fs = new StreamReader(ws.AsStream()))
{
- await this.fooTextBox.LoadFileAsync(fs, null);
+ await this.vm.CurrentDocument.LoadAsync(fs, null);
}
+ this.vm.CurrentDocument.RequestRedraw();
}
}