databinding

SQL datasource for gridview

Hi I want to use a gridview with sorting and paging to display data from an SQL server, the query uses 3 joins and the full text search containstable. The from part of the query uses all 3 tables in the join. What is the best way to do this? I can think of a stored procedure, SQL directly in the SQLDataSource and creating a view in the...

Are there any open source C# libraries for binding the properties from one class to another?

I don't remember which blog I was reading, because it seemed academic at the time, but there was a library being discussed where you could take a two concrete classes and bind the properties together if the names matched. Think ASP.NET MVC model binding. ...

ObjectDataSource firing twice, or on its own

Can someone explain exactly how/when an ObjectDataSource fires? I have an ASP.NET page, with a GridView, which is referencing an ODS. I put a breakpoint in the method the ODS is using, and noticed it was firing twice. I looked into the code and the answer seemed obvious at first. I had Page_Load() { if(!Page.IsPostBack) ...

DateTime Property not firing PropertyChanged event when changed

I'm working on a WPF MVVM application and I've got a TextBox on my view that is bound to a DateTime property on the ViewModel. Seems simple enough, but when I clear the text in the TextBox, the property never changes. In fact, it never even fires until I begin typing "4/1..." and then it fires. What can I do to fix this? Obviously I ...

Setting nested object to null when selected option has empty value

Hello, I have a Class which models a User and another which models his country. Something like this: public class User{ private Country country; //other attributes and getter/setters } public class Country{ private Integer id; private String name; //other attributes and getter/setters } I have a Spring form where...

[Actionscript] How to make bindable property in Actionscript Project

I have seen a lot of codes regarding how to bind property in Flex project. Such as this code in Flex Help: var watcherSetter:ChangeWatcher = BindingUtils.bindSetter(updateMyString, myTI, "text"); However, I am creating Actionscript class within Actionscript Project, and I cannot import mx.binding.uti...

WPF - Setting ComboBox.SelectedItem in XAML based on matching object

Hi, so, I have templated combobox that is basically acting as a simple colour palette. It is populated with a list of SolidColorBrush objects. Fine. Now, I have some data that holds the hex value of the current colour. I have a converter that converts the hex into a SolidColorBrush. Also fine. Now, I want to set the SelectedItem prop...

Force WPF to Commit Changes on Focused Element

I'm working with VS2010, WPF and EF. I've placed controls on my window by dragging an entity out of the Data Sources toolwindow. I used the "details" setting so my entity is represented by several labels and textboxes. I've also added a button with the following code: _context.SaveChanges(); When I'm editing data, the changes in wh...

Wpf SelectedItem wont work for a Combobox in a ListView

Hi there, I´ve got a problem with a Combobox in a ListView. I´ve got a class called "Substrate". This class contains an object of a class called "SubstrateType". I want to show the objects of the class "Substrate" in a Listview. Each property of the "Substrate" is presented in the columns of the Listview. For the different "SubstrateTyp...

Mainaining radio selection after item source change

Setup: I have a combo-box, it's itemsource bound to an ObservableCollection<T> of a custom class, one property is a List<myenum>. I have an itemscontrol which is databound to the combo-box's selected item List<myenum> property. The itemscontrol datatemplate creates a list of radiobuttons, each representing the individual enum values i...

Populate checkboxes via database

I have to populate checkboxes with data coming from database, but no checkboxes are showing on my page. Please let me know the correct way to do that. In C#, the page_load method I've written is this: public partial class dbTest1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string Server ...

WPF ItemsControl not binding when I change an item property

<ItemsControl Margin="0,16" ItemsSource="{Binding}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Ma...

WPF: Problem with TreeView databinding

Hi, I have a tree view defined as follows: <HierarchicalDataTemplate x:Key="ChildTemplate" ItemsSource="{Binding Children}"> <TextBlock Text="{Binding TagName, Mode=OneWay}"/> </HierarchicalDataTemplate> <HierarchicalDataTemplate x:Key="NavigationHeaderTemplate" ItemsSource="{Bind...

Trouble databinding in code to wpf listbox from custom IList implementation

I have a class CustomCollection : IList which maintains a list of CustomObject Types. This is what I tried, but it's not working (provider.Data is readonly): CustomCollection collection1 = somesampledata; ObjectDataProvider provider = new ObjectDataProvider(); provider.ObjectType = typeof(CustomObject); provider.Data = collection1; //...

Is there a performance hit to binding a relative source vs a direct object?

I'm currently working on my first WPF application, and I'm curious as to whether I'll hit a snag down the line with performance by doing something like this: Dim binding As New Binding("PropertyOnObject.Property1.Property2.Value") binding.Source = Object vs doing Dim binding As New Binding("Value") binding.Source = Object.PropertyOnO...

How can I simulate the effects of an observable collection in this situation?

I am making a configuration editor for another application and am using reflection to pull editable fields from the configuration class. The following class is the base class for my various "DataTypeViewModels" and shows how I get and set the appropriate properties. public abstract class DataTypeViewModel<T> : ViewModelBase { Func<T...

Databinding gives "System.Data.DataRowView" instead of actual values

This is my code: string SQL = "SELECT email FROM members WHERE subscribe=true"; string myConnString = Application["ConnectionString"].ToString(); OleDbConnection myConnection = new OleDbConnection(myConnString); OleDbCommand myCommand = new OleDbCommand(SQL, myConnection); myConnection.Open(); ...

Simple Windows.Forms binding is failing using framework 4.0.

This works under the .net framework 3.5 client. This fails under the .net framework 4.0 client. Was I doing something that was illegal under 3.5 but just happened to work, or is this a bug? Note that in my project 'PropInt' does not raise change events so using ctx[obj1.PropObj2, "PropInt"] is not an option. public class Obj1 { ...

What's the order of execution in property setters when using IDataErrorInfo?

Situation: Many times with WPF, we use INotifyPropertyChanged and IDataErrorInfo to enable binding and validation on our data objects. I've got a lot of properties that look like this: public SomeObject SomeData { get { return _SomeData; } set { _SomeData = value; OnPropertyChanged("SomeData"); } } Of course, I have an appropr...

How can I bind a custom property of a windows form to a second property?

I want to bind a custom property of a windows form to a second property, so when I update the former the latter gets the same value. This is the simplest example of what I'm trying to do: public partial class Form2 : Form { public string MyTargetProperty { get; set; } public string OtherProperty { get; set; } public...