ii数据如何将TextBlock绑定到进度条? [英] How do Ii data bind a TextBlock to a progress bar?
本文介绍了ii数据如何将TextBlock绑定到进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将TextBlock绑定到进度条.即,TextBlock应该显示进度条的值,即progressbar.value属性.我尝试了绑定,但是我猜我做错了,因为它不起作用.谁能帮我吗?
干杯,
Roshini
Hi,
I need to bind a TextBlock to a progress bar. I.e., the TextBlock should show the value of the progress bar, which is the progressbar.value property. I tried binding, but I guess I am doing it the wrong way as it does not work. Can anyone help me??
Cheers,
Roshini
推荐答案
将ProgressBar
的Value
属性绑定到TextBox
控件的Text
属性非常容易.
示例Xaml:
---------------
It''s fairly easy to bind aProgressBar
''sValue
property to aTextBox
control''sText
property.
Example Xaml:
---------------
<ProgressBar Value="{Binding X}"
Height="28" HorizontalAlignment="Left"
Margin="62,40,0,0" Name="progressBar"
VerticalAlignment="Top" Width="332" />
<TextBox Text="{Binding ElementName=progressBar, Path=Value}"
Height="23" HorizontalAlignment="Left" Margin="62,86,0,0"
Name="textBox" VerticalAlignment="Top" Width="120" />
注意:TextBlock
的作用与TextBox
相同(因为您在问题中要求输入TextBlock
).
Note: TextBlock
would work the same as TextBox
(since you asked for TextBlock
in your question).
这篇关于ii数据如何将TextBlock绑定到进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文