databinding

ObjectDataSource created twice when control is changed

I'm using an ObjectDataSource with a GridView with an OnObjectCreated handler on the code-behind. If I programmatically change a child control value on the GridView, the entire control gets databound a second time in the same request (as shown by the OnObjectCreated handler), which I don't want. This happens on the initial page GET reque...

Dialog with OK/Cancel behavior in C#/WPF with data binding

In my App class, I have a Collection of objects, like this: (the Collection is in the App class because i need to have access to it application-wide in different windows, etc.) public partial class App : Application { public ObservableCollection<Person> Persons { get; set; } public App() { Persons = new ObservableCollection<Person...

How do I pass a property changed event to an ancestor?

I'm sure I am missing some of the basics here so please bear with me. I have a two objects, a SalesOrder and a SalesOrderLineItem. The lineitems are kept in an Observablecollection<SalesOrderLineItem> of SalesOrder, and if I add line items my databound listView knows about the new items. Now where I am having a problem is here: The Sal...

Databind List of Integers

I've got the following list of integers: Dim foo = New List(Of Integer) I set the datasource of my gridview to foo. What do I put in my databinding markup? <%# Eval("???") %> ...

Is it possible to 'refresh' WPF data bindings

I've got a xaml TabControl and on one page, there are 3 RadioButtons each bound to a different property on the selected value of an adjacent ListView. After switching between selected items in the ListView, my radio buttons seem to forget they're bound and don't refresh. So watching it in the debugger, when I switch to a new selected it...

PropertyChanged for indexer property

I have a class with an indexer property, with a string key: public class IndexerProvider { public object this[string key] { get { return ... } set { ... } } ... } I bind to an instance of this class in WPF, using indexer notation: <TextBox Text="{Bin...

OneWayToSource binding from readonly property in Xaml

I'm trying to bind to a Readonly property with OneWayToSource as mode, but it seems this cannot be done in XAML: <controls:FlagThingy IsModified="{Binding FlagIsModified, ElementName=container, Mode=OneWayToSource}" /> I get: The property 'FlagT...

Forms Databinding - DataSet not updating?

I have a Form (Compact Framework, actually) with a few fields, a date and a string, among other things. Both TextBox controls are bound to properties in a BindindSource. The BindindSource has a DataSet as its DataSource property, and the DataMember is a table in a SQL CE database. When I want to add a new row, I call bindingSource.AddN...

Problem with binding Nullable value to WPF ComboBox

I am binding a WPF ComboBox to a nullable property of type MyEnum? (where MyEnum is an enumerated type) I am programmatically populating the ComboBox items like this: // The enum type being bound to enum MyEnum { Yes, No } // Helper class for representing combobox listitems // (a combination of display string and value) class ComboIt...

Data-bound WinForms form - how to format dates?

I have a form with a date value in a TextBox control. The form uses data binding with a BindingSource against a DataSet and a SQL 2005 CE database. Where do I control the formatting of the date? Nowhere in the properties along the way did I see a possibility to strip out the time part, for instance. I could of course do it in the databa...

Serious Flex databinding issue

Ok so this is kind of urgent at this point. I have a large-scale AIR application that is pigging out left and right, and by massive amounts of trace statements and generating my own stack traces (useful for debugging), I have found that each combo-box is getting it's lookup from the LookupManager class multiple times, equating to about 3...

WPF Context menu doesn't bind to right databound item

Hi! I have a problem when binding a command in a context menu on a usercontrol that is on a tab page. The first time I use the menu (right-click on the tab) it works great, but if I switch tab the command will use the databound instance that was used the first time. If I put a button that is bound to the command in the usercontrol it wo...

Updating Binding immediately when DataContext changes

I am trying to measure an object immediately after changing the DataContext, but the binding for the object is not getting updated soon enough. Here's my code: // In MeasureOverride(Size) m_inputWidth = 0.0; Size elemSize = new Size(double.PositiveInfinity, RowHeight); MapElementView ruler = new MapElementView(); // Measure inputs for...

How can I call a bound method in XAML with the parameter of a TabItem's name?

I've got an instance of an object bound in XAML. It's got a method that will return to me a list of other objects (based on the property value I pass this method, it will return all the objects with that property value). <ObjectDataProvider ObjectInstance="_this.DataContext" MethodName="GetListByCategory" x:Key="List"> <ObjectDa...

Updating SilverLight lists when Bound in-memory collection gets a new member.

I'm trying to pupulate one of three listboxes from a (fourth) source list box. The source has a list of school Subjects which are classified as elementary, middle or high school subjects. The source listbox is a list of checkboxes. The user clicks on the checkbox and one of the other three are intended to get a copy of the Subject obj...

data access in silverlight 2.0

i'm new to silverlight and i'm porting from asp.net 2.0. I have done many data binding applications in asp.net where i use sql server 2005 and use it's tables and access them via sqlconnection object and perform all kind of database related functions. Can any one tell does silverlight 2.0 supports such kind of facility. If so can i use a...

Bind to specified XML-element

In short: I want to define what XML ButtonSettings element to use for a XAML-Button, and to use the childs of the selected ButtonSettings-element in a style applied to that Button. Is this possible? A sample of the XML: <Buttons> <ButtonSettings ID="Bye"> <Text lang="NL">Doei!</Text> <Text lang="DE">Tsusch!</Text> <Tex...

How to notify the user about binding errors in silverlight?

To my understanding, binding errors are displayed only during debug mode in Visual Studio's Output window. However, I want to know about broken bindings when the user runs my app, and I want to notify him that something is not working quite right. Is there a way to handle binding exceptions from code, when the datacontext is set, and so...

Databound DataGridView Empty Despite Full DataSource

I have a base form class that contains a method that returns a DataTable: protected DataTable GetTableData(string sql, OracleConnection connection) { DataTable table = null; OracleDataAdapter adapter = null; try { table = new DataTable(); adapter = new OracleDataAdapter(sql, connection); table.Locale = System.Global...

Binding controls to class properties - is this technically possible?

I have yet to find a "nice" way to do two way databinding in .Net. The one thing I don't like for example in the present asp.net two way databinding is doing the binding in the aspx page is no compile time checking, ie: <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title_oops_spelled_wrong") %>'>...