我知道我的问题很常见,但我找到的每一个解决方案都不是我真正需要的。这是我的问题:我希望能够在主窗口中的不同用户控件之间切换。我找到的所有解决方案都包括在主窗口中有一个菜单,每个按钮都会带来相应的用户控件,例如: https: //rachel53461.wordpress.com/2011/12/18/navigation-with-mvvm-2/
但我想要的更像是:一开始,主窗口中有 UserControl1 。在 userControl1 中,将有 1 个按钮,它们使用新的 userControl 更改 mainWindow 的内容(例如 userControl2)
mainWindow的xaml
<Window x:Class="DataTemplateSO_Learning.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DataTemplateSO_Learning"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<DataTemplate DataType="{x:Type local:EmployeeViewModel}">
<local:EmployeeView/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:DepartmentViewModel}">
<local:DepartmentView/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:MenuViewModel}">
<local:MenuView/>
</DataTemplate>
</Window.Resources>
<DockPanel LastChildFill="True">
<ContentControl x:Name="Pages" DockPanel.Dock="Right" Content="{Binding SelectedViewModel}"/>
</DockPanel>
</Window>
Run Code Online (Sandbox Code Playgroud)
我的 mainWindow 的 cs :
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Pages.Content = new MenuView();
this.DataContext = new NavigationViewModel();
}
}
Run Code Online (Sandbox Code Playgroud)
我的第一页的 xaml :
<UserControl …Run Code Online (Sandbox Code Playgroud) 我在现有的PDF上画了一些麻烦,我找到了一个代码来在现有的PDF上添加文字,我试图让它适应画圈,但结果只是一个空白页有没有人知道如何解决这个问题?
我的代码:
string oldFile = @"C:\...6166-21.pdf";
string newFile = @"C:\...NEW.pdf";
// open the reader
PdfReader reader = new PdfReader(oldFile);
Rectangle size = reader.GetPageSizeWithRotation(1);
Document document = new Document(size);
FileStream fs = new FileStream(newFile, FileMode.Create, FileAccess.Write);
PdfWriter writer = PdfWriter.GetInstance(document, fs);
document.Open();
// the pdf content
PdfContentByte cb = writer.DirectContent;
cb.Circle(150f, 150f, 50f);
cb.SetColorStroke(iTextSharp.text.BaseColor.GREEN);
// create the new page and add it to the pdf
PdfImportedPage page = writer.GetImportedPage(reader, 1);
cb.AddTemplate(page, 0, 0);
// close the streams and voilá the file …Run Code Online (Sandbox Code Playgroud) 我在使用C#使用pdfium显示pdf时遇到了一些麻烦。我读了另一个问题:
我下载了pdfiumViewer程序包,但是在编译时,它说找不到pdfium库。因此,我下载了软件包“ pdfium.net SDK”,它可以运行,但不是免费的,它是受限版本。我想知道的是:我们必须拥有软件包“ pdfium.net SDK”才能使“ pdfiumViewer”正常工作吗?