binding

JAXB, Custom bindings, Adapter1.class and Joda-time

时光怂恿深爱的人放手 提交于 2019-12-19 05:37:46
问题 I have a problem with the way JAXB is generating the bound classes for an XML schema (which, for sake of precision, I cannot modify). I want to map a xsd:date type to a Joda-time LocalDate object and, reading here, here and here, I created the following DateAdapter class: public class DateAdapter extends XmlAdapter<String,LocalDate> { private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyyMMdd"); public LocalDate unmarshal(String v) throws Exception { return fmt.parseLocalDate

WPF binding textbox to dictionary entry

对着背影说爱祢 提交于 2019-12-19 05:21:09
问题 i try to bind a wpf textbox to a dictionary placed in a viewmodel. The viewmodel is used as datacontext for the view. I found a lot of examples and it sounds simple, but it will not work for me. View: TextBox x:Name="txbTest" Grid.Row="10" Grid.Column="2" Text="{Binding MyDict[First]}" ViewModel: public Dictionary<string, string> MyDict = new Dictionary<string, string> { {"First", "Test1"}, {"Second", "Test2"} }; I try all variants i found Text="{Binding MyDict[First]}" Text="{Binding Path

WPF binding textbox to dictionary entry

安稳与你 提交于 2019-12-19 05:20:15
问题 i try to bind a wpf textbox to a dictionary placed in a viewmodel. The viewmodel is used as datacontext for the view. I found a lot of examples and it sounds simple, but it will not work for me. View: TextBox x:Name="txbTest" Grid.Row="10" Grid.Column="2" Text="{Binding MyDict[First]}" ViewModel: public Dictionary<string, string> MyDict = new Dictionary<string, string> { {"First", "Test1"}, {"Second", "Test2"} }; I try all variants i found Text="{Binding MyDict[First]}" Text="{Binding Path

XAML Binding to a CollectionViewSource property on a ViewModel

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 05:17:26
问题 I have a simple ViewModel like: public class MainViewModel { ObservableCollection<Project> _projects; public MainViewModel() { // Fill _projects from DB here... ProjectList.Source = _projects; ProjectList.Filter = ...; } public CollectionViewSource ProjectList { get; set; } } I set the window's DataContext to a new instance of that ViewModel in the constructor: public MainWindow() { this.DataContext = new MainViewModel(); } Then in the Xaml I am attempting to bind the ItemsSource of a ListBox

Binding selection across multiple view controllers in a single window interface

耗尽温柔 提交于 2019-12-19 04:49:06
问题 I am having an issue wrapping my head around how to hook up a few NSArrayControllers across two view controllers. I want to sync the selection in the source list table view to update the values in the second detail view controller. I'm using the Cocoa Dev Central Build A Core Data Tutorial as the starting point, but have broke down the architecture so that there is an NSWindowController that contains two NSViewControllers: one for the posts table on the left and one for the post details on

Create Event Handler for TreeViewItem in WPF

一个人想着一个人 提交于 2019-12-19 04:11:21
问题 Im adding items to TreeView control via ItemsSource property and ItemTemplate property to set the template for TreeViewItem. How can i add an event handler to handle selection change event on TreeViewItems? For now my ItemTemplate looks like this: <Window.Resources><DataTemplate x:Key="PeerDetailTemplate"> <TextBlock Text="{Binding DESCRIPTION}" Tag="{Binding ID}" GotFocus="GetModules"/> </DataTemplate></Window.Resources> But it doesnt work (GetModules is not called). Im new to WPF, so show

Promises in lapply / R

放肆的年华 提交于 2019-12-19 03:40:37
问题 I am not sure what the promises are doing in R If one runs a = lapply(seq_len(2), function(n) { function() {n}}) b = lapply(seq_len(2), function(n) {n}) we can see that a[[1]]() # == 2 b[[1]] # == 1 I understand that R uses promise's object and lazily evaluates an expression in its environment, but I dont understand why the different environments created for each function would not contain their own value for n. [[1]] function () { n } <environment: 0x7f9b2416ad18> [[2]] function () { n }

How to choose a WCF binding?

落花浮王杯 提交于 2019-12-19 03:09:34
问题 WCF binding chooser algorithm I have watched a speak at a TechEd conference that showed a simple algorithm for choosing a WCF binding. I can't find this algorithm but I remember some of the main ideas: If your WCF service will have non-.NET clients choose Http Soap If your WCF will have .NET clients in other machines choose Net Tcp If your WCF will have .NET clients in the same machine choose Message Queue Can anyone provide a link to the full version of this algorithm? 回答1: Something like

Abstract classes and Spring MVC @ModelAttribute/@RequestParam

穿精又带淫゛_ 提交于 2019-12-18 20:01:35
问题 I have a hierarchy of model classes in my Spring/Hibernate application. When submitting a POST form to a Spring MVC controller, is there any standard way of specifying the type of the object being submitted, so Spring can instantiate the correct subclass of the type declared in the receiving method's @ModelAttribute or @RequestParam? For example: public abstract class Product {...} public class Album extends Product {...} public class Single extends Product {...} //Meanwhile, in the

How to use stringformat in multibinding in WPF XAML

梦想的初衷 提交于 2019-12-18 19:01:23
问题 As you know StringFormat is of great importance for data representation in WPF. My problem is how to use StringFormat when multibinding in WPF? If I give a very simple example: We have variables,which are A and B and whose values are 10.255555 and 25.6999999 And we want to show them 10.2,25.6 ? How can I do this with multibinding? Normally it is piece of cake with ValueConverter Any help and ideas on this topic will be greately appreciated 回答1: Just set the StringFormat property on the