databinding

Non-trivial data binding

Trivial data binding examples are just that, trivial. I want to do something a little more complicated and am wondering if there's an easy, built in way to handle it. public partial class Form1 : Form { public Form1() { InitializeComponent(); List<DataStruct> list = new List<DataStruct>() { new DataStruct(){Name =...

How do I handle foreign keys with WPF databinding?

I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows: <ListView Canvas.Left="402" Canvas.Top="480" Height="78" ItemsSource="{Binding}" Name="lsvViewEditCardPrint" Width="419"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{...

How to develop a WPF datagrid control which supports databinding?

I am fairly new to WPF. I want to develop a datagrid control which supports databinding. There is a lot of information available about databinding to existing controls, but I cannot find any information how to develop a control from scratch which supports databinding. I do not expect a simple answer to this question, a link to get me ...

How to dynamically set which properties get bound to a DataGridView?

My DataGridView needs to support a number of types and these types may have any number of public properties, not all of which I want to display. Can anyone suggest a way to dynamically customise a DataGridView's columns when binding a class a datasource? Is there an attribute that will tell a control whether to use a property as a colum...

Is there really no way to follow up dataset parent relation in xaml binding?

Suppose I have a dataset with those two immortal tables: Employee & Order Emp -> ID, Name Ord -> Something, Anotherthing, EmpID And relation Rel: Ord (EmpID) -> Emp (ID) It works great in standard master/detail scenario (show employees, follow down the relation, show related orders), but what when I wan't to go the opposite way (s...

How do I discriminate between data binding and user actions on WinForm controls

I have what must be a typical catch-22 problem. I have a .NET WinForm control that contains a textbox and a checkbox. Both controls are data bound to properties on a data class instance. The textbox is for price, the check box to indicate that the price is a price override. Also on the data class is a property that holds the item's o...

How does Databinding work with Structured Software

Hi. I've been doing some Web-Projects lately that rely on heavy Data-Binding and have been quite happy with the results. Databinding Webforms works mostly the way I need it and I spared myself tons of code. One thing that still feels weird is that I have application logic and database logic mixed throughout the application. Datasources...

WPF Databinding and cascading Converters?

hi there, i wonder if it is possible to cascade converters when using wpf databinding. e.g. something like <SomeControl Visibility="{Binding Path=SomeProperty, Converter={StaticResource firstConverter}, Converter={StaticResource secondConverter}}"/> is it possible at all or do i have to create a custom converter that combines the fu...

Databinding Fail - Help me get started with simple example

OK... I'm a VB.NET WinForms guy trying to understand WPF and all of its awesomeness. I'm writing a basic app as a learning experience, and have been reading lots of information and watching tutorial videos, but I just can't get off the ground with simple DataBinding, and I know I'm missing some basic concept. As much as I'd love it, I ha...

Bind NameValueCollection to GridView?

What kind of collection I should use to convert NameValue collection to be bindable to GridView? When doing directly it didn't work. Code in aspx.cs private void BindList(NameValueCollection nvpList) { resultGV.DataSource = list; resultGV.DataBind(); } Code in aspx <asp:GridView ID="resultGV" runat="server" AutoGener...

Data-bound TextBox: can't exit

Hi, I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the case - when editin...

For those of you using SubSonic, what kind of performance are you seeing in large applications?

I've used SubSonic in a few POC projects, but nothing large. It's so easy to use, and it's possible to abstract away the fact that it uses the active record pattern (can move it toward a more domain driven approach). Has anyone on here used SubSonic on larger applications, and what kind of performance did you witness? Was your experienc...

ASP.NET Repeater ItemDataBound happening AFTER PreRender event?

I have a repeater control on an ASP.NET 2.0 web form. As I understanding it, all of the page's data-bound controls fire their binding events somewhere in between the Page_Load and the Page_PreRender events. However, my repeater's ItemDataBound event appears to be happening AFTER the PreRender event. How is this so and is there any ...

How can tooltips be added to a vb.net winforms datagrid row(s)?

I'm looking to add a tooltip to each row in a bound datagrid in vb.net winforms. How can this be done? ...

Cannot bind to the property or column Name on the DataSource. Parameter name: dataMember

This is the exception that I'm getting when I'm trying to bind to a System.Type.Name. Here is what I'm doing: this.propertyTypeBindingSource.DataSource = typeof(System.Type); /* snip */ this.nameTextBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.propertyTypeBindingSource, "Name", true)); Is there some trick with...

WPF: Changes to textbox with focus aren't committed until after the Closing event fires.

I have a WPF window for editing database information, which is represented using an entity framwork object. When the user closes the window, I'd like to notice in the Closing event whether the information has changed and show a message box offering to save the changes to the database. Unfortunately, changes to the currently focused edi...

WPF: ListBox vs. ListView - how to choose for data binding

I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to search/sort/filter based on user input. The data binding demo (http://msdn.microsoft.com/en-us/library/ms771319.aspx) uses a ListBox with ...

How can I sort a DataSet before doing a DataBind?

I have data coming from the database in the form of a DataSet. I then set it as the DataSource of a grid control before doing a DataBind(). I want to sort the DataSet/DataTable on one column. The column is to complex to sort in the database but I was hoping I could sort it like I would sort a generic list i.e. using a deligate. Is this ...

.Net DataBinding a new object with value type properties

Using data binding, how do you bind a new object that uses value types? Simple example: public class Person() { private string _firstName; private DateTime _birthdate; private int _favoriteNumber; //Properties } If I create a new Person() and bind it to a form with text boxes. Birth Date displays as 01/01/0001 and ...

How do I make the IsEnabled property of a button dependent on the presence of data in other controls? (WPF)

I have a "Login" button that I want to be disabled until 3 text boxes on the same WPF form are populated with text (user, password, server). I have a backing object with a boolean property called IsLoginEnabled which returns True if and only if all 3 controls have data. However, when should I be checking this property? Should it be ...