如何以编程方式将数据加载并分配给xaml模板 [英] How to load and assign data to a xaml template programically

查看:61
本文介绍了如何以编程方式将数据加载并分配给xaml模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要动态创建xps报告,我尝试了不同的方法.

但是现在我需要为所有部分(例如页眉,正文,页脚等)创建XamlTemplate

而且我需要以编程方式调用这些模板,并需要为其设置数据.

假设我创建一个Header模板.中心具有TextBlock的矩形

我需要在代码中访问此模板,并需要为
分配text属性
textblock.并且我需要将此xaml转换为xps报告,也需要使用flowdocument尝试.

我尝试了几个msdn链接,但这对我没有帮助.所以请提供一个很好的示例.

问候,

sajith



i need to create xps report dynamically i tried different ways .

but now i need to create XamlTemplate for all section like header,body,footer etc

and i need to call these templates programically and need to set data to it.

suppose i create a Header template. a rectangle with TextBlock at it center

i need to acess this template in the code and need to assign text property for the

textblock.and i need to convert this xaml to xps report also i need to try this with flowdocument.

i tried several msdn links but this is not helping me.so please give a good sample.

Regards,

sajith

推荐答案

您可以通过按名称访问文本块来设置代码中的文本.我确定您找到了 [
You can set the text in your textblock in code, by accessing it by name. I''m sure you found blog posts like this[^] one, if you can''t get them to work, you need to post specific questions here, not ask us to start from scratch and do your work for you


这篇关于如何以编程方式将数据加载并分配给xaml模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆