databinding

Dependency Property causing XamlParseException AG_E_PARSER_BAD_PROPERTY_VALUE

I've created two UserControls, the first of which displays a list of objects, the second of which displays details about an object that is selected from the first. I've created a dependency property on the first control and am binding each UserControl to an object declared in my Resources collection. I've seen blog posts describing this,...

Automatically creating child objects during Silverlight DataBinding?

I have a parent object of type Parent and it currently has a null property called Foo of type Child and that Child class has a property of type string called Name. If the user types into a Text Box for that Name property then I want to automatically create an instance of Child and set it as the Foo property of Parent before finally sett...

Binding Silverlight UserControl custom properties to its' elements

Hi. I'm trying to make a simple crossword puzzle game in Silverlight 2.0. I'm working on a UserControl-ish component that represents a square in the puzzle. I'm having trouble with binding up my UserControl's properties with its' elements. I've finally (sort of) got it working (may be helpful to some - it took me a few long hours), but w...

What is the best way to get and set selection when using databinding in winforms?

I use binding in a win-forms application (.Net 2.0), and I try to find the best way to maintain the selected items in my data bound controls. I read that the best way to access the selection is by using CurrencyManager's (or bindingSource's) "Current" and "Position" properties. The problem is that I can't find a way to select nothing (Po...

Winforms DataBind to Control's Visible Property

WinForms, .NetFramework 3.5 Are there any known issues when databinding to a control's visible property? The control is always NOT visible regardless of what my property is. Public ReadOnly Property IsRibbonCategory() As Boolean Get Return True End Get End Property I tried the control's text property and other properti...

IBindableComponent ToolStrips

I'm trying to get the code example from here to work but using a ToolStripMenuItem instead of a ToolStripLabel. However, When I do the following toolStripMenuItemInstance.DataBindings.Add("Checked", SingletonInstance, "Enabled") (where Enabled is a boolean property of the SingletonInstance) nothing happens. Checking the toolStripMenu...

How do I link autocomplete on a textbox to a database table? C# 2.0

I'm using Visual Studio 2005, C# with Framework 2.0. I'd like to use auto complete, but would like the list to come from a table in my database. Is there a way to databind the AutoCompleteSoure? ...

Is it possible to customize the DisplayMember of a DataBound ComboBox?

Solution This is what I came up with: Public Class IndexedDropDownItem Private _KeyCode, _Display As String Public Property KeyCode() As String Get Return _KeyCode End Get Set(ByVal value As String) _KeyCode = value End Set End Property Public Property Display() As...

Can I add a binding rule to a Silverlight element?

Hopefully I phrased the question correctly. If not, let me explain. I want to bind an Image element's Source property to a the ImageUrl property of my DataContext object. Here is the XAML: <Image x:Name="EmployeeImage" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Source="{Binding Path=ImageUrl}" Stretch="Uniform...

Sys.InvalidOperationException: ImageError error #4001 in control 'Silverlight1': AG_E_NETWORK_ERROR

I'm getting the following error every time my Silverlight application load and cannot figure out how to get around it. This error occurs right when the UserControl is loaded (but before the Source is bound). I've tried handling this error during the ImageFailed event, but it is not fired when this exception is thrown. What can I do? <Im...

How are you handling the deletion of an item with the new complex binding syntax?

Many of you may have noticed that since RC1 you don't have to include the .Index hidden field to enable complex model binding. However one of the drawbacks is that now you have to have the index starting from 0 and it cannot break. eg. skip from 4 to 6 etc. With the old syntax I was able to just remove the item from the DOM and when th...

Databinding expression for retrieving value of related collection using LINQ

I have a GridView that is bound to a LINQDataSource control that is returning a collection of customers. Within my DataGrid I need to display the home phone number of a customer, if they have one. The phone numbers of a customer are stored in a separate table with a foreign key pointing to the customer table. The following binding exp...

Is there a better way of filling a generic List from a SQL DataAdapter?

I have an existing application that uses Active Record for its data retrieval. It's in VB.NET (first time I'm doing VB.NET; I usually work in C#). And I'm building a method to return a List(Of T) of an object. The current pattern uses a SQLDataAdapter to populate a datatable. I COULD add the record to the List(Of T) as I fill the datat...

Why can’t GridView extract child control’s values directly?

Hello using Bind in a GridView control template enables the control to extract values from child controls in the template and pass them to the data source control. The data source control in turn performs the appropriate command for the database. For this reason, the Bind function is used inside the EditItemTemplate or InsertItemTem...

Can you use LINQ extension method operators in an ASP.NET databinding expression?

Is it possible to use a LINQ extension method within an ASP.NET databinding expression? Within a GridView that is bound to a Customer collection which in-turn has a related Phones collection the following Eval expression fails: <%# Eval("Phones.Single(p => p.PhoneTypeId == 2)") %> The error message I receive is: 'First(p => p' is not...

Editable WPF ListBox

I have a ObservableCollection that's bound to a ListBox in WPF. I want the ListBox to be editable, and for the editing changes to be saved to the collection. Since WPF doesnt provide an editable listbox, I've tried creating my own by changing the ListBox.ItemTemplate. <ListBox.ItemTemplate> <DataTemplate> <TextBox Name="E...

WPF Binding Converters

I am currently stuck at a dead end with the following situation: I have a List<Category> collection with each Category containing an Id, Name and a List<string[]> property called Subcategory (where array contains the Name and Id of that subcagtegory - I didn't feel like creating another class). I have a TreeView with HierarchicalDataTe...

Data Binding Is More Complicated Than I'd Like

I have a form that will be populated by a bunch of information from a template, and then handed over to the user to fill out the rest. The thing is, the template and the object that holds the eventual result are DataRows, because it's all going into and out of a database (that I have no schema control over), so this seems like a great pl...

Retrieve DataItem from RepeaterItem after databinding (during an event handler)

I'm trying to find a way to to do something that I think must be possible but I'm just missing the point on - so hopefully someone can give me a bit of a nudge :) I'm utilising databinding in ASP.NET (viewstate turned off - so using controlstate for a few things here and there) to render a repeater (repeaterPriceClasses) that has a repe...

jgoodies bindings + indirect changes

I'm having a brain cramp trying to understand the appropriate way to use JGoodies bindings in my application. I have a class Article which is a bean that has read-only properties. Article is a "plain" bean, and doesn't manage property listeners, since the properties don't ever change. I have a Swing JPanel which I would like to use to d...