binding

Binding WPF ComboBox to enum and hiding certain values

大憨熊 提交于 2020-01-05 17:38:53
问题 I have a WPF combobox that is bound to an enum like this: <Window.Resources> <local:EnumDescriptionConverter x:Key="enumDescriptionConverter"/> <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="cityNamesDataProvider"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="local:MyModel+CityNamesEnum"/> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> </Window.Resources> <ComboBox x:Name="cityNameComboBox" ItemsSource="{Binding Source={StaticResource

Binding WPF ComboBox to enum and hiding certain values

二次信任 提交于 2020-01-05 17:37:50
问题 I have a WPF combobox that is bound to an enum like this: <Window.Resources> <local:EnumDescriptionConverter x:Key="enumDescriptionConverter"/> <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="cityNamesDataProvider"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="local:MyModel+CityNamesEnum"/> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> </Window.Resources> <ComboBox x:Name="cityNameComboBox" ItemsSource="{Binding Source={StaticResource

Two-way binding with Windows Forms ComboBox throws NullReferenceException when changed

不问归期 提交于 2020-01-05 12:02:32
问题 I have a Windows Forms application, and one of the forms has a couple of ComboBox es that are both bound to the same BindingList of objects I have mapped via Entity Framework. The Form_Load event calls this: private void SetFacilityDropdowns() { dbContext.Facilities.Load(); var bindingSource = dbContext.Facilities.Local.ToBindingList(); Dictionary<ComboBox, string> selectedDropDownsAndBoundFields = new Dictionary<ComboBox, string> { {FacilityId, DataConstants.Facility.FacilityId},

Two-way binding with Windows Forms ComboBox throws NullReferenceException when changed

时间秒杀一切 提交于 2020-01-05 12:01:53
问题 I have a Windows Forms application, and one of the forms has a couple of ComboBox es that are both bound to the same BindingList of objects I have mapped via Entity Framework. The Form_Load event calls this: private void SetFacilityDropdowns() { dbContext.Facilities.Load(); var bindingSource = dbContext.Facilities.Local.ToBindingList(); Dictionary<ComboBox, string> selectedDropDownsAndBoundFields = new Dictionary<ComboBox, string> { {FacilityId, DataConstants.Facility.FacilityId},

Is there any way to temporarily detach a binding in WPF?

谁说胖子不能爱 提交于 2020-01-05 08:22:52
问题 Background: I have a ListView / GridView with several columns. In some situations, only some of the columns are shown. Since there is no Visible property for GridViewColumns in WPF, I set the width of the columns I want to hide to zero. Visually, this achieves the desired effect (and I actually modified the ControlTemplate for the GridViewColumnHeader so that it's impossible for the user to accidentally expand any hidden columns). Problem: The problem is that the bindings for the hidden

How a command from main window be handled in a usercontrol view model

断了今生、忘了曾经 提交于 2020-01-05 08:18:11
问题 In my application I have several user controls in a window. These user controls need to communicate to each other. My approach is as below user control A fire a command which is to be handled by user control B. main window recieves the command and fire a command to B user control B handles the command. My problem is how the main window can fire a command which can be handled in the VIEW MODEL of user control B? Update: SOLVED: One gloabl static RelayCommand for communication from the

angularjs reuse template and bind to different properties within the same scope

邮差的信 提交于 2020-01-05 08:09:51
问题 I'd like to reuse an express included template multiple times and selectively bind it to different properties of the scope as follows: <div ng-show="isCoApplicant" bind-to="applicant in data.coApplicant"> <% include ../row-templates/applicant-row %> </div> Similar to the behavior of ng-repeat which creates a child scope for the row and sets a property on it according to the expression 'applicant in data.coApplicant', and the row inputs can be bound to 'applicant' via ng-model. I've spent some

Binding #define used as constant

拈花ヽ惹草 提交于 2020-01-05 07:48:43
问题 The code I am trying to bind puts a very important key in one of the .h files: #define xAppKey @"REPLACE_WITH_YOUR_APP_KEY" This value is then reused throughout the ObjC code. I am suspicious that in the binding process, this value does not carry through. Based on a few other threads on SO, that seems to be the case, at least. Is my problem likely something else, or is there a chance this value is not being honored in the wrapped code? I'm sorry if my objective-c terminology is off, I know

Localize currency values in WPF GridView with different cultures for each row based on XAML bindings to culture name property

可紊 提交于 2020-01-05 07:27:51
问题 First time poster here but have been reading SO for ages and finally have run into a question that I've not been able to answer. I've got a ListView hosting a GridView with multiple columns. One displays a price and another displays a currency code (CAD, USD, GBP, etc). This is all pulled out of SQL server using Entity Framework so the GridView is databound to a IEnumerable which stores the result of my query. The currency code is stored in a separate table with a localization string (en-US,

Monotouch binding - “Cannot cast from source type to destination type.”

亡梦爱人 提交于 2020-01-05 06:54:04
问题 I am a newbie on Monotouch. Recently, I am working on a Monotouch binding project that binds a custom iOS framework that developed myself into a .NET framework library. I follow the instructions on Xamarin but currently I am having an issue that cannot be resolved. This is my code. **HEADER FILE IN OBJECTIVE C** *GRG.h* @interface GRG: NSObject {} // Shared instance + (GRG*) sharedG; // Preference class @property (nonatomic, readonly) GRGPreferences *preferences; // Driver version @property