草庐IT

TOPLEVEL_BINDING

全部标签

c# - Windows Phone 8.1 Binding only "Left"Margin 属性

我有一个静态资源:9.6我想将此资源分配给样式中的Margin.Left属性。我试过这个:但它不起作用。我不能像下面这样将Thickness声明为资源,编译器会提示它。我无法从类Thickness派生,所以我不得不制作一个构建Thickness的自定义类(CustomThickness类)我该如何解决这个问题? 最佳答案 您不能只设置TopMargin。您应该设置Thickness实例的所有值。如果您不想更改其他边距,只需将它们设置为零即可。XAML并且您应该创建返回Thickness实例的转换器类:publicclassMyCon

c# - Binding 没有 Clone 方法,复制它的有效方法是什么

我想复制一个绑定(bind),这样我就可以在不影响原始绑定(bind)的情况下为其设置不同的源属性。这只是将新绑定(bind)的所有属性设置为与旧绑定(bind)相同的情况吗? 最佳答案 这是我对问题的解决方案:publicstaticBindingBaseCloneBinding(BindingBasebindingBase,objectsource){varbinding=bindingBaseasBinding;if(binding!=null){varresult=newBinding{Source=source,Async

c# - 警告 : Assembly binding logging is turned OFF

我遇到了这个错误,WRN:AssemblybindingloggingisturnedOFF.Toenableassemblybindfailurelogging,settheregistryvalue[HKLM\Software\Microsoft\Fusion!EnableLog](DWORD)to1.Note:Thereissomeperformancepenaltyassociatedwithassemblybindfailurelogging.Toturnthisfeatureoff,removetheregistryvalue[HKLM\Software\Microsoft

c# - WPF 数据网格 : DataGridComboxBox ItemsSource Binding to a Collection of Collections

情况:我在XAML中创建了一个DataGrid,并且ItemsSource绑定(bind)到包含属性的特定类的ObservableCollection。然后在C#中,我创建了一个DataGridTextColumn和一个DataGridComboBoxColumn,并将它们绑定(bind)到ObservableCollection中对象的属性。我可以将DataGridComboBoxColumn绑定(bind)到一个简单的Collection,但我想要做的是将它绑定(bind)到一个字符串集合的集合,这样对于每一行,DataGrid中的ComboBox都有一个不同的字符串集合。我没有这

c# - WCF Web 服务错误 : "Service endpoint binding not using HTTP protocol"?

我有一个简单的WCF服务,在我的开发机器上测试时它运行良好。现在我已将Web服务移至Web服务器,并在http://mydomain.com:8005运行该服务(在Debug模式下).打开Web浏览器访问该URL会显示预期的服务页面,如果我在我正在调用的界面内的服务器上放置一个断点,它会命中断点并返回预期的数据......但在客户端它会返回出现以下错误:AnerroroccurredwhilereceivingtheHTTPresponsetohttp://mydomain.com:8005/.Thiscouldbeduetotheserviceendpointbindingnotus

c# - XAML 设计器显示属性名称而不是设计器数据 (d :DataContext) when Binding

上下文我希望我的UserControl(RepositoryContainer)在XAMLDesigner上填充数据。我创建了一个名为RepositoryContainerDesignData.xaml的文件(它与RepositoryContainer.xaml位于同一文件夹中)并将其设置为d:DataContext到UserControl。但XAML设计器不显示数据,而是显示属性名称。这是一个最小的例子:设计数据(RepositoryContainerDesignData.xaml)用户控件(RepositoryContainer.xaml)代码隐藏usingSystem.Windo

C#/WPF : Binding Combobox ItemSource in Datagrid to element outside of the DataContext

我想做以下事情:publicListPreLoadedUserList{get;set;}publicListSomeDataRowList{get;set;}publicclassUsers{publicintAge{get;set;}publicstringName{get;set;}}publicclassSomeDataRowList{publicintUserAge{get;set;}现在我的(WPF工具包)DataGrid看起来像这样:现在我的问题是,PreLoadedUserList在ItemSource(SomeDataRowList)之外,我不知道如何绑定(bind)

c# - MVC3 全局化 : need global filter before model binding

目前,我有一个名为GlobalizationFilter的全局过滤器,它检查路由值、cookie和浏览器语言header以确定请求的正确文化设置:publicoverridevoidOnActionExecuting(ActionExecutingContextfilterContext){//determinecultureInfoThread.CurrentThread.CurrentCulture=cultureInfo;Thread.CurrentThread.CurrentUICulture=cultureInfo;}一切正常,但模型绑定(bind)过程似乎发生在全局过滤器之

c# - Autofac - 自动注册错误 : No constructors can be found with 'Public binding flags'

这是我的Global.asax.cspublicvoidRegisterContainersUsingAutofac(){//http://elegantcode.com/2009/01/07/ioc-libraries-compared///http://www.codeproject.com/Articles/25380/Dependency-Injection-with-Autofac//https://code.google.com/p/autofac///http://api.autofac.org/varbuilder=newContainerBuilder();build

c# - WPF MVVM : Binding a different ViewModel to each TabItem?

我有一个带有选项卡控件的主窗口,其中包含2个tabItem:我目前有1个ViewModel为Tab1和Tab2提供服务。此ViewModel因SOC模糊而变得有点臃肿。我想将逻辑拆分为2个View模型:ViewModel1和ViewModel2。我的理解是,您可以将主窗口DataContext设置为包含ViewModel集合的BaseViewModel,然后您可以将每个TabItem声明为不同的ViewModel。我看到的这些基本ViewModel的示例公开了一个ObservableCOllection,如下所示:privateObservableCollection_viewMode