Binding.Source属性的正确语法是什么?

时间:2017-10-16 13:45:38

标签: wpf xaml

我有一个简单的WPF应用程序,App类有一个属性Generator,然后有一个ObservableCollection属性DataList。

我想将DataList绑定到ListBox。下面的语法是正确的:

<ListBox ItemsSource="{Binding Property=Generator.DataList, Source="{x:Static local:App:Current}" }" />

但下面是错误的:

<ListBox ItemsSource="{Binding Property=Generator.DataList, Source="TheApp" }" />

其中,TheApp是MainWindow类的公共属性,定义如下:

public App TheApp {get; set;} = (App)Application.Current;

那么Source的语法是什么,我在哪里可以找到最佳解释?感谢。

1 个答案:

答案 0 :(得分:0)

试试这个:

MainWindow

类(TheApp)是源,属性($uploadPath='/'.ucfirst(Yii::$app->user->identity->district->district->district_name).'/'.'temp/'.$model->quick_string; ///district/temp/1508159604x16 this my upload folder if ($FtpClient->mkdir($uploadPath)){ $source_directory=$model->file->tempName; $target_directory=$uploadPath.'/'.$model->file->name; if($FtpClient->putAll($source_directory, $target_directory,FTP_BINARY)){ echo "success";exit; } } )是路径的一部分。

数据绑定概述: https://docs.microsoft.com/en-us/dotnet/framework/wpf/data/data-binding-overview

如何:指定绑定来源: https://docs.microsoft.com/en-us/dotnet/framework/wpf/data/how-to-specify-the-binding-source

Binding.Path属性: https://msdn.microsoft.com/en-us/library/system.windows.data.binding.path(v=vs.110).aspx