databinding

adding columns and mid binding a dataset for gridview etc

not sure of what to put as the title here, but basically I am using subsonic in asp.net forms C# and I have an instance where I need to loop through a recordset and for each one call the Database to get specific information from a view about that record. in this instance it is a venue, loop through and for each venue I show there spend ...

Is it possible to data bind to a method in Silverlight?

We have a dynamic languaging system that doesn't use conventional resource files; fetching resources from a database, via a language manager library instead. Based on a legacy (VB6) solution, it languages controls according to the resource name in the control's tag property. After the page has initialised we fire off a method that takes ...

Binding array of struct to the ToolStripCombobox

Hi guys. I am trying to bind array of structs to the ToolStripCombobox but with no success. I've tried to use it like in this example but I am getting error when I try to setup a value member. My code looks like this: public struct PlayTimeLength { public string Description; public double Seconds; public PlayTimeLength(st...

ItemsControl - Bind Control's and Backing Collection's Sort Orders Together

Hello, Is there a way to bind an ItemsControl (like ListView or DataGrid) to a sorted collection such that: whenever the collection is resorted via code, the ItemsControl automatically reflects the new sort order, AND whenever the ItemsControl is sorted, it re-sorts the collection? Thank you, Ben ...

ASP.NET Binding with EVAL

Hi, I'm trying to do the following for asp.net combobox: Text='<%# IIf(Eval("Name").ToString().Equals(""), Bind("Other"), Bind("Name") %>' What I'm trying to do is if the "Name" column is empty then bind to "Other" column, otherwise bind to "Name" column. Anyone know the right syntax, keep getting object not set to reference. I'...

ASP.NET data binding on postback

Hi, Working on an ASP.NET 4.0 project, which uses user controls to dynamically generate a form based on definitions stored in the database. One form field would look like this: <usc:RefControl ID="ctrlUser1" ReferenceFieldId='product.user1' ValidationFormat="^\d+\.?\d{0,2}$" runat="server"/> Behind the scenes the contro...

Getting the ListItem of a Databound list in Silverlight

Hi folks, in my Silverlight 4 Application, I have an observable list of a user defined class ObservableCollection<MyClass> myList; public class MyClass { public string Name { get; set; } public string Value { get; set; } } I display this list in a ListBox, using databinding and a Template for the ListBoxItems: <ListBox x:Name="...

Why Microsoft add Design-time Attributes (d:DataContext ...) and do not use the current DataContext instead

In WPF-XAML, determining DataContext at designtime vs runtime. Why do we have to add "d:DataContext" while we already have set the "DataContext" ? Why Microsoft introduced DesignTime attributes (code that we have to add, a little bit complex) when it could already be determined automatically by itself using "DataContext" attribute. The ...

Simple databinding between textbox and form title

I am new at C# and databinding, and as an experiment I was trying to bind the form title text to a property: namespace BindTest { public partial class Form1 : Form { public string TestProp { get { return textBox1.Text; } set { } } public Form1() { InitializeComponent(); this.DataB...

WPF pass data-generated parameter to Method through XAML

I am writing a "problem resolver" for a despatch app. The despatch app prints labels using a piece of software supplied by the UKs Royal Mail postal service. The software ensures that the addresses on the labels are "correct" as per the Royal mail's database of valid addresses, it renders a trackable code in alphanumeric and barcoded fo...

WPF TextBox separate Validation source

I am trying to find a solution to let a TextBox show and validate data from two different sources as this little example shows: <TextBox Text="{Binding Port.Name}" ValidationSource="{Binding Ship.PortFK}"/> Here the Ship data object contains a property that functions as a Foreign Key to a Port, the property has its own validators. I...

TwoWay binding in SL4 stops working when I add RIA Services to the mix. Solution?

Environment: VS2010, SL4, RIA Services I have an SL4 UI that I developed against data objects that were instantiated from an XML file (so that I didn't have to worry about the back end of the app while I worked on the front end). In this UI, I have a data grid that shows properties for each object in the collection of data. I also ha...

How to data-bind TreeViewItem.IsExpanded to a node data objects

I have a hierarchical data classes like public class MyNode { public string Name { get; set;} public bool IsExpanded { get; set;} public List<MyNode> Nodes { get; set;} } I could define a HierarchicalDataTemplate to bind MyNode classes to the TreeView. <sdk:TreeView ItemsSource="{Binding RootNodes}"> <sdk:TreeView.ItemTem...

WPF databinding to TextBox - problem updating source on LostFocus when loss of focus causes DataTemplate change

I have a ContentControl bound to a PhoneNumber object, and the control's Style.Triggers applies different ContentTemplates when the control has or doesn't have keyboard focus. <Setter Property="ContentTemplate" Value="{StaticResource DisplayPhoneNumberDataTemplate}" /> <Style.Triggers> <Trigger Property="IsKeyboardFocusW...

Unable to databind a Silverlight4 DataPager control with MVVM

Hi all, I have a data driven Silverlight 4 business application with a fairly standard user interface. There's a side section that allows you to enter your search criteria, a standard Silverlight 4 datagrid control in another section that contains your search results (if any), and then a "details" section of the screen which shows the i...

Dynamic Pop-up Menu (Select box) in Dashcode

I'm trying to use Dashcode to create a drop-down list for an iPhone Web app. I want the list to be set dynamically based on a data source, and for the selected item to be set by a separate data source. I've figured-out how to set the parameters on the data source to get it to alter the contents, and have the data in valid JSON, but can'...

Problem with data binding (Using the MVVM pattern) to a WPF Combobox within a DataGrid's RowDetailsTemplate ...

I'm trying to bind a view model property to the 'SelectedItem' attribute of a WPF combobox. This combobox resides within a RowDetailsTemplate of a DataGrid. The binding is partially there because the view model's property getter and setter each get called once when a row is selected (And thus causes the details view to expand). However t...

XAML inline data binding doesn't work; code behind binding works

Greetings folks! I'm running into a problem with WPF databinding that I hope you can help out with. I'm new to WPF but an expereienced developer (VB 3.0-6.0, C#). Here's the scenario: I have a C# project called MasterPartsData which contains a number of classes which reprsent different types of parts (capacitor, diode, etc). They inhe...

rebind dataGridView

Hello My Project include dataGridView Control, and i change the property: gridview1.columns.DataPropertyName at run time Now, i need rebind my gridView, how i do this. in asp.net is simple gridView1.DataBind(), bun how in c#. Thanks.. ...

java swing addTaskListener

I am new to java and have a swing task question. Can I add a listener to a currently running task? For instance if something happens in doInBackGround I want to add a listener for finished and display a dialog. I have tried but the compiler doesnt like me. :) Something like. private class MyTask extends Task<Void, Void>{ @Override...