Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何简单地“将文本块数据绑定到代码隐藏 C# 变量”?
在我的代码隐藏中,我有一个公共字符串变量,在我的 XAML 中我有,但它不起作用。
提前致谢!
使用BindingOperations类。像这样的东西。
BindingOperations
BindingOperations.SetBinding(myTextBlock, TextBlock.TextProperty, new Binding("Whatever"))
在不了解您要绑定的内容的情况下,这是您将获得的最佳答案。
使用真正的 MVVM 模式几乎总是比在代码隐藏中做这种事情要好。
这很奇怪,也很复杂,我会尽力解释它。我手工制作日历,计划开源等等。我目前正在寻找谷歌日历的外观和感觉,因为它们似乎是最好的,但我确实计划升级它+开源。一切都在完美运行,除非我单击上个月,以查看上个月,然后运行 ajax 查询,php 返回新日历,但是当它呈现时,它呈现没有任何 <table>元素,除了没有遇到任何障碍想法?继承人一些代码/图像:
<table>
html: