English 中文(简体)
• 如何从世界森林论坛的守则中激发具有约束力的来源更新?
原标题:How to trigger binding source update from code in WPF?

In My ViewModel 我有财产:

class ViewModel : INotifyPropertyChanged
{
public string FileName {get;set;}
}

页: 1 观点 我将标签内容与《FileName联系起来。

现在 当我对我的看法做一个文件时,我如何能够更新标签<条码>/<条码>,以便观察Mode s条码。 还可以通过具有约束力的方式更新?

直接贴出标签<代码>Content 财产赢得了t work,只是明确了约束力。

最佳回答

如果你在守则背后必须这样做,你可以做这样的事情:

ViewModel vm = (ViewModel)this.DataContext;
vm.FileName = path;

(btw, You ViewModel类别需要执行INotificationpropertyChanged)

问题回答

暂无回答




相关问题
Get DynamicResource Binding in WPF

Can any one help me to get DynamicResource Binding in WPF by code? I have set binding Like follow, TextBlock Background={DynamicResource ColorA} Name="TB" in Xaml. and i need to get the - TB s ...

WPF Binding to specific items in collection

I m currently trying to bind to certain items in a collection in wpf. This is best explained by an example. My XAML is below: <Canvas Name="TaskCanvas" Width="467.667" Height="414"> <...

WPF Dynamic Binding X and Y Co-ordinates

I have a question on WPF dynamic positioning. I want to place Elipses on the screen based on X and Y co-ordinates that i have stored in a collection in C#. I have been made aware of the drawing ...

WPF Data Binding Error in ListBox

I have a ListBox: <ListBox x:Name="HistogramListBox" Grid.Column="1" Margin="8,2,8,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Template="{StaticResource ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签