databinding

How to store selected value from DataGridViewComboBoxColumn?

VB.NET 2008 .NET 3.5 Using WinForms. I have a class that is bound to a DataGridView through a BindingSource. This class contains a List as one of it's properties. The List contains another custom class. Both classes are part of an automated shipping program: Class OrderShipment Public Property OrderID as String Get ...

Databinding in ASP.NET

Is it possible to do data binding on the fields of an object just like in WPF? Something like this: <TextBlock Text="{Binding ElementName=lbColor}" /> just for an asp:TextBox element. What I want is that on submit to have the new values inside the binded object and I don't want to manually read and set the values. ...

WPF Applying a trigger on binding failure

This question is a follow on from this one... I am binding to a heterogeneous collection of objects, not all objects have the same set of properties. I am doing this in a datagrid. I would like to gray out the cell if the binding fails. Is there a way to apply a trigger if a binding fails? EDIT: The answer below was suitable for my pur...

WPF: Trigger on DependencyProperty.UnsetValue

in an answer to this question the following statement was made "In theory it might be possible to .... trigger on {x:Static DependencyProperty.UnsetValue}, which would be much cleaner, but this doesn't appear to work in practice." Has anybody had any luck in doing this? ...

C# WPF XAML binding to DataTable

I have the following tables: Company {CompanyID, CompanyName} Deal {CompanyID, Value} And I have a listbox: <ListBox Name="Deals" Height="100" Width="420" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Sel...

Black Magic in Grails Data Binding!?

As described in http://n4.nabble.com/Grails-Data-Binding-for-One-To-Many-Relationships-with-REST-tp1754571p1754571.html i'm trying to automatically bind my REST data. I understand now that for one-to-many associations the map that is required for the data binding must have a list of ids of the many side such as: [propName: propValue, m...

WPF - data binding trigger before content changed

How do i create trigger, which fires BEFORE binding changes value? How to do this for datatemplate? <ContentControl Content="{Binding Path=ActiveView}" Margin="0,95,0,0"> <ContentControl.Triggers> <--some triger to fire, when ActiveView is changing or has changed ?!?!? --> </ContentControl.Triggers> public Object...

WPF MVVM Picklist Example

Hi, I am looking for a way of easily maintaining a list of Users belonging to a particular Group. I have thought about using a Picklist, where I have 2 listboxs, the first contains a list of Users the second a list of Users belonging to the Group. There will be buttons to allow the adding and removing of selected Users from the Group. As...

How do you bind SQL Data to a .NET DataGridView?

I am trying to bind a table in an SQL database to a DataGridView Control. I would like to make it so that when the user enters a new line of data in the DataGridView that a record is automatically added to the database. Here is my current attempt... BOMClassesDataContext DB = new BOMClassesDataContext(); Form_Load() { ...

EntityFramework EntityState and databinding along with INotifyPropertyChanged

Hello, all! I have a WPF view that displays a Shipment entity. I have a textblock that contains an asterisk which will alert a user that the record is changed but unsaved. I originally hoped to bind the visibility of this (with converter) to the Shipment.EntityState property. If value = EntityState.Modified Then Return Visibility...

java swing frame excellent for resultset from database

sir, l want to display resultset in jframe.i get output last record in the database displayed. Lam intrested to place next button,back button in the frame.when i was click in the back button previosly viewed record is displayed and vice-versa.i don't know it will be possible.plz help me ...

.NET 3.5 DataGridView Wont Save To Database

I have created a test Winforms application in Visual Studio 2008 (SP1) to see just how "RAD" C# and .NET 3.5 can be. So far I have mixed emotions. Added a service-based database to my application (MyDB.mdf) and added two tables - Contact (id [identity], name [varchar] and number [varchar] columns) and Group (id [identity] and name [var...

WPF ComboBox drop-down (data bound) values not changing

I bind the ItemsSource of a ComboBox to an ObservableCollection<MyClass>. In code I change the collection (e.g. edit the MyClass.Name property). The problem: the change is not reflected in the dropdown box if the ComboBox, yet when I seled the item from the dropdown it is displayed correctly in the selected item box of the ComboBox. Wh...

Is there a way to chain multiple value converters in XAML?

I've got a situation in which I need to show an integer value, bound to a property on my data context, after putting it through two separate conversions: Reverse the value within a range (e.g. range is 1 to 100; value in datacontext is 90; user sees value of 10) convert the number to a string I realise I could do both steps by creati...

Databing literal controls from BLL

It seems like such an easy thing to do, but im stumped. I have a DAL & BLL. Within my BLL i have a the following function returning one video by its id Public Function GetTrainingVideoById(ByVal id As Integer) As TPSupportDataSet.TraningVideosDataTable Return Adapter.KB_TRAININGVIDEO_S_ID(id) End Function Now on my aspx page i ha...

Databinding an enum to a ComboBox in WPF + MVVM

I've read this very related question here on SO, and it was extremely helpful because of the link in the answer. I'm just having a problem now going the extra step and making it all work with the MVVM pattern. Let's say I have my ViewModel, and it (or even the Model) could have an enum defined: public enum MyTypes { Type1, Type2, Type...

Locating binding errors

I'm dealing with a large WPF application that is outputting a large number of binding errors. A typical error looks like this: System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=Horizon...

Handling Optional Query Parameters

I have a GridView bound to an DataSource query with parameters tied to form controls. What is the standard / best-practices way to handle optional query parameters? ...

WPF MenuItem.Command binding to ElementName results to System.Windows.Data Error: 4 : Cannot find source for binding with reference

I have the following XAML: <UserControl x:Class="EMS.Controls.Dictionary.TOCControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:EMS.Controls.Dictionary.Models" xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly...

Databinding between 2 Dependency Properties

Hello, I'm trying to do databinding between 2 Dependency Properties. I guess this should be quite easy, anyways I just don't get it. I already googled but I couldn't really find out what I'm doing wrong. I'm trying to bind the ControlPointProperty to the QuadraticBezierSegment.Point1Property, however it doesn't work. Thanks for any hint...