在我的应用程序中托管一个简单的 XAML 编辑器?
在我们的应用程序中,我们允许安装管理员为从自助服务终端办理登机手续时打印的姓名标签设计模板(有点像在自助服务终端办理航班登机并打印登机牌)。
例如,模板可能如下所示:
[FirstName] [LastName]
[Company]
[PersonImage]
[BarCode]
现在,我们使用 Reporting Services 来允许管理员设计姓名标签模板(有些人可能需要人员的照片、打印的条形码、组织名称等) )。 这工作正常,但是 1) Reporting Services 渲染速度很慢,2) 它没有很好地与我们的应用程序集成 - 他们必须加载 Visual Studio 并在我们的应用程序外部设计名称标签。
XAML 似乎非常适合设计名称标签模板。 事实上,任何设计都可以使用该格式进行处理,我们可以使用 XAML 到 XPS 进行打印。
我遇到的问题是如何集成使用可用 XAML 控件子集的可视化设计器。 我们实际上只需要简单的控件,如 Canvas、Grid、TextBlock、Image 等,并支持拖放。 我没有找到太多关于是否可以将 Visual Studio 或 Sparkle 的 XAML 设计器托管到单独的应用程序中的信息。 有人有什么想法吗? RichTextBox 看起来几乎可以工作,但 FlowDocument 并不是我们真正想要的。 我们需要能够拖动项目并绝对定位它们(就像在报表设计器中一样)。
In our application, we allow administrators of an install to design templates for name tags that are printed when they check-in from a kiosk (sort of like checking in for a flight at a kiosk and printing out a boarding pass).
For example, the template might look something like this:
[FirstName] [LastName]
[Company]
[PersonImage]
[BarCode]
Right now, we use Reporting Services to allow our administrators to design templates for name tags (some might want a picture of the person, a bar code printed out, name of their organization, etc). This works ok, but 1) Reporting Services is slow to render and 2) it's not integrated with our application very well -- they have to load up Visual Studio and design the name tag outside of our application.
XAML seems like a good fit for designing the template for name tags. Virtually any design could be handled with the format and we could use XAML to XPS to print.
The problem I'm seeing is how to integrate a visual designer that uses a subset of available XAML controls. We'd really only need simple controls such as Canvas, Grid, TextBlock, Image, etc with drag/drop support. I'm not finding much info on whether or not it's possible to host Visual Studio or Sparkle's XAML designer into a separate application. Anyone have any ideas? The RichTextBox looks like it would almost work, but a FlowDocument isn't really want we're wanting. We need to be able to drag items around and absolutely position them (like in a report designer).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您是否可以托管 MS 设计师(尽管我对此表示怀疑),但我认为您可能能够相当简单地制作自己的迷你编辑器。 从
Canvas
开始,以编程方式添加Label
、TextBlock
或任何您想要的其他内容(使用Click
将它们连接起来) > 处理程序通过Canvas.Top
/Canvas.Left
移动它们)。 您可以相当轻松地将 Canvas 渲染为图像以进行打印,或者如您提到的 Xaml-Xps。查看 Kaxaml 作为已经创建了迷你 Xaml 编辑器的示例(它最近更新为 SL2) 。 可能还有其他人。
2009 年 1 月 26 日编辑:另请查看 Charles Petzold 的 XamlCruncher (示例) - 当然比加载更好启动 Visual Studio - 似乎
XamlReader.Load
可能值得尝试?I'm not sure whether you can host the MS designer/s (although I doubt it), but I think you might be able to produce your own mini-editor fairly simply. Start with a
Canvas
and programmatically addLabel
s,TextBlock
s or whatever else you want (wire them up withClick
handlers to move them around viaCanvas.Top
/Canvas.Left
). You can render theCanvas
to an image fairly easily for printing, or Xaml-Xps as you mentioned.Check out Kaxaml as an example of someone who has already whipped up a mini Xaml editor (it was recently updated to SL2). There may be others out there as well.
EDIT 26-Jan-09: also check out Charles Petzold's XamlCruncher (example) - certainly beats loading up Visual Studio - seems like
XamlReader.Load
might be worth trying out?