binding

Binding a wpf listview to a Dataset…Possible..?

人走茶凉 提交于 2020-01-13 04:15:29
问题 I was struggling moving to Wpf,I am just stuck while trying out databinding to a lsitview.I want to databind a listview to a dataset(dataset because the data i want to display in columns belongs to different tables).I am attaching a sample code that i am trying with.It works alright but the listliew only shows one row.What could be wrong.Can anyone guide me through.All the samples available are using datatables.None specifies about binding to a dataset.Pls help..any input will be highly

Bind listbox in WPF with grouping

冷暖自知 提交于 2020-01-12 10:14:51
问题 I've got a collection of ViewModels and want to bind a ListBox to them. Doing some investigation I found this. So my ViewModel look like this (Pseudo Code) interface IItemViewModel { string DisplayName { get; } } class AViewModel : IItemViewModel { string DisplayName { return "foo"; } } class BViewModel : IItemViewModel { string DisplayName { return "foo"; } } class ParentViewModel { IEnumerable<IItemViewModel> Items { get { return new IItemViewModel[] { new AItemViewModel(), new

wpf binding property in ValidationRule

断了今生、忘了曾经 提交于 2020-01-12 08:28:28
问题 i'm having a form with 2 text boxes: TotalLoginsTextBox UploadsLoginsTextBox i want to limit UploadsLoginsTextBox so the maximum input for the text will be the value of the TotalLoginsTextBox. i am also using a value converter so i try to bound the Maximum value: this is the XAML: <!-- Total Logins --> <Label Margin="5">Total:</Label> <TextBox Name="TotalLoginsTextBox" MinWidth="30" Text="{Binding Path=MaxLogins, Mode=TwoWay}" /> <!-- Uploads --> <Label Margin="5">Uploads:</Label> <TextBox

Implementing INotifyPropertyChanged for nested properties

旧街凉风 提交于 2020-01-12 06:39:29
问题 I have a Person class: public class Person : INotifyPropertyChanged { private string _name; public string Name{ get { return _name; } set { if ( _name != value ) { _name = value; OnPropertyChanged( "Name" ); } } private Address _primaryAddress; public Address PrimaryAddress { get { return _primaryAddress; } set { if ( _primaryAddress != value ) { _primaryAddress = value; OnPropertyChanged( "PrimaryAddress" ); } } //OnPropertyChanged code goes here } I have an Address class: public class

How to use Ext5 combobox with data bindings

纵然是瞬间 提交于 2020-01-12 05:45:06
问题 I want to use a combobox which receives the preselected value from a data binding and also the possible options from a data binding of the same store. The panel items configuration looks like this: { xtype: 'combobox', name: 'language_default', fieldLabel: 'Default Language', multiSelect: false, displayField: 'title', valueField: 'language_id', queryMode: 'local', bind: { value: '{database.language_default}', store: '{database.languages}' } } If I use this configuration, the store of the

Bind Image.Source according to Boolean without a converter?

…衆ロ難τιáo~ 提交于 2020-01-12 04:35:31
问题 I want to have an image bound to a boolean and have the source of the image to depend on the boolean value i.e. true source="image1" false source="image2" I was wondering if there is a way to do it inline without need for a converter. 回答1: You can create a style on the Image which uses a DataTrigger to swap the image source depending on a binding. In this example the image changes depending on the value of a boolean called simply "Value". <Image Width="16"> <Image.Style> <Style TargetType="{x

How do I stop binding properties from updating?

杀马特。学长 韩版系。学妹 提交于 2020-01-12 03:31:29
问题 I have a dialog that pops up over the main screen (it's actually a user control that appears on the page as per the application demo from Billy Hollis) in my application that has data from the main screen to be edited. The main screen is read only. The problem I have is that when I change the data in the dialog, the data on the main screen updates as well. Clearly they are bound to the same object, but is there a way to stop the binding update until I click save in my dialog? 回答1: You could

how do you implement Async Operations in C# and MVVM?

感情迁移 提交于 2020-01-12 02:12:10
问题 hi what is the easiest way to implement asynch operations on WPF and MVVM, lets say if user if user hits enter when on a field i want to launch a command and then return back while a thread will do some search operations and then come back and update the properties so notification can update the bindings. thanks! 回答1: How about a BackgroundWorker instance to call your command on the VM ? Update: Scratch the above suggestion.. There's an online video on MVVM by Jason Dolinger.. I recommend you

Binding DataContext to ValidationRule

女生的网名这么多〃 提交于 2020-01-12 02:12:06
问题 I have a custom ValidationRule that requires access to the ViewModel in order to validate a supplied value in conjunction with other properties of the ViewModel. I previously tried to acheive this by using a ValidationGroup, but abandoned this idea as the code I am modifying would need a lot of refactoring in order to enable this route. I found a thread on a newsgroup that showed a way of binding the DataContext of a control in which the ValidationRule is being run to that ValidationRule by

WPF: How to set bool to true from DataTemplate for Button?

谁说我不能喝 提交于 2020-01-11 14:07:14
问题 I know it is possible to do this by working with ICommand, but since this is the only place in my whole project where this is needed, I am asking myself, if there is maybe a better solution than implementing RelayCommand and ICommand and an additional method in my otherwise property-only class? Maybe my scenario may help here: I have a ListView which is bound to a list of properties (this is a custom-class I made to display those). I have a button in eacht row of entries, that I want to set