官术网_书友最值得收藏!

Outputting values to UI controls

One of the simplest ways of working out what values our data bound properties have is to just data bind them to other UI controls that have a textual output. For example, if we have a collection of items and we want to do something with the selected item, but whatever that is isn't working, we need to verify that our binding to that selected item is correct.

To visualize the result of the binding, we can simply copy and paste the binding path to the Text property of a TextBox and run the application. If our binding path is correct, we'll see something output in the TextBox and if not, we'll know that the problem that we're having is, in fact, down to the binding path. We can, therefore, use this method to verify that objects that don't normally have a textual output are at least correctly data bound or not.

This simple technique can help in any situation where the faulty data binding is not already rendered in a text-based UI control. For example, we might need to debug a data bound value because a particular visual effect that is created with a DataTrigger instance is not working and we need to determine whether the problem is related to the UI control or the data binding path.

主站蜘蛛池模板: 永登县| 汤阴县| 巴马| 台江县| 桂林市| 禹州市| 海盐县| 额尔古纳市| 梓潼县| 鲁山县| 台山市| 盐城市| 治多县| 长沙县| 葫芦岛市| 台湾省| 万安县| 根河市| 安岳县| 保德县| 上饶市| 永善县| 手游| 青冈县| 雷山县| 宁国市| 望城县| 娄底市| 柳江县| 崇阳县| 长寿区| 西安市| 固原市| 长治县| 固镇县| 胶州市| 海丰县| 治县。| 若尔盖县| 衡阳县| 屯门区|