binding

WPF - Bind UserControl visibility to a property

我怕爱的太早我们不能终老 提交于 2019-12-18 18:54:19
问题 I have a ListView bound to ObservableCollection. Data are loaded from the internet and then added to collection. The download takes few seconds and I want to indicate user that the data is loading. I created an UserControl that indicates activity. I placed it inside of ControlTemplate. <ControlTemplate x:Key="ListViewControlTemplate1" TargetType="{x:Type ListView}"> <Grid> <local:ActivityIndicatorControl HorizontalAlignment="Center" Height="Auto" Margin="0" VerticalAlignment="Center"/> </Grid

How to find a socket's local port number? (Windows C++)

白昼怎懂夜的黑 提交于 2019-12-18 17:34:13
问题 I'm new to Windows networking, and I am trying to find out which PORT number my socket is bound to (C++, Windows 7, Visual Studio 2010 Professional). It is a UDP socket, and from what I understand, using the following initial setup should bind it to a random available port/address: sockaddr_in local; local.sin_family = AF_INET; local.sin_addr.s_addr = INADDR_ANY; local.sin_port = 0; //randomly selected port int result = bind(clientSock, (sockaddr*)&local, sizeof(local)); //result is always 0

Binding TabControl ItemsSource to Collection of ViewModels

旧城冷巷雨未停 提交于 2019-12-18 16:19:12
问题 For some reason I am having a heck of a time getting my TabControl to display properly when binding the ItemsSource to a ObservableCollection of view models. I'm basing my design off of the tutorial found here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx. I did find a few questions like mine here but none addressed my particular situation. This is my TabControl in xaml. <TabControl ItemsSource="{Binding Workspaces}" SelectedIndex="{Binding ActiveWorkspaceIndex}" ItemTemplate="

Spring binding values in a Map

混江龙づ霸主 提交于 2019-12-18 15:27:21
问题 Is there a way to Spring bind values in a map? For instance, I have a Map<String,String> and I want to spring bind specific values in it. The user will type something into a input element, and the value of that input element will get bound to the value associated with a specific key in the map. 回答1: Yes, you can do it with [...] syntax. The Map itself, however, should be a property of the command object: public class Form { private Map<String, String> values = ...; ... } Then you submit a

JGoodies Binding vs. JSR 295

末鹿安然 提交于 2019-12-18 14:45:57
问题 What is the practical difference between JGoodies Binding and JSR 295, Beans Binding? They both seem to be intended for the same purpose and get their job done (with slightly different approaches). JGoodies Binding is more mature, but JSR 295 is eventually getting part of JDK in Java 7. Using a standard part of JDK is surely preferable to using a separate library for the same function, but are there other factors to consider? Are there yet some other alternatives? Choosing between these is

XAML : Binding textbox maxlength to Class constant

旧时模样 提交于 2019-12-18 14:42:10
问题 I am attempting to bind a WPF textbox's Maxlength property to a known constant deep within a class. I am using c#. The class has a structure not too dissimilar to the following: namespace Blah { public partial class One { public partial class Two { public string MyBindingValue { get; set; } public static class MetaData { public static class Sizes { public const int Length1 = 10; public const int Length2 = 20; } } } } } Yes it is deeply nested, but unfortunately in this instance I can't move

ContextMenu in MVVM

痞子三分冷 提交于 2019-12-18 13:24:28
问题 I want to bind a contextmenu to a list of commands. <Grid.ContextMenu> <ContextMenu ItemsSource="{Binding ItemContextCommands, Converter={StaticResource commandToStringConverter}}"> <ContextMenu.ItemTemplate > <DataTemplate DataType="MenuItem"> <MenuItem Command="{Binding}"></MenuItem> </DataTemplate> </ContextMenu.ItemTemplate> </ContextMenu> </Grid.ContextMenu> The commandToStringConverter simply converts a list of commands to a list of strings calling the ToString() on each command in the

What's a good library to do computational geometry (like CGAL) in a garbage-collected language?

こ雲淡風輕ζ 提交于 2019-12-18 12:59:12
问题 I need a library to handle computational geometry in a project, especially boolean operations, but just about every feature is useful. The best library I can find for this is CGAL, but this is the sort of project I would hesitate to make without garbage collection. What language/library pairs can you recommend? So far my best bet is importing CGAL into D. There is also a project for making Python bindings for CGAL, but it's very incomplete. 回答1: I would still recommend to proceed with Python

WPF Radiobutton (two) (binding to boolean value)

风流意气都作罢 提交于 2019-12-18 11:18:23
问题 I have a property of type boolean presented with checkbox. I want to change that to two radiobuttons that bind on the same property presenting the value true/false. How can that be done? 回答1: <RadioButton GroupName="Group1" IsChecked="{Binding PropertyValue}" Content="Yes" /> <RadioButton GroupName="Group1" Content="No" IsChecked="{Binding PropertyValue, Converter={StaticResource BoolInverterConverter}}" /> public class BoolInverterConverter : IValueConverter { #region IValueConverter Members

WPF Radiobutton (two) (binding to boolean value)

雨燕双飞 提交于 2019-12-18 11:17:04
问题 I have a property of type boolean presented with checkbox. I want to change that to two radiobuttons that bind on the same property presenting the value true/false. How can that be done? 回答1: <RadioButton GroupName="Group1" IsChecked="{Binding PropertyValue}" Content="Yes" /> <RadioButton GroupName="Group1" Content="No" IsChecked="{Binding PropertyValue, Converter={StaticResource BoolInverterConverter}}" /> public class BoolInverterConverter : IValueConverter { #region IValueConverter Members