databinding

Databinding custom XML serializable Color class in C#

I have a class, SerializableColor, to allow me to XML serialize Colors. public class SerializableColor { // omitted constructors, etc. ... [XmlIgnore] public Color Color { get { return Color.FromArgb(this.Alpha, this.Red, this.Green, this.Blue); } set { this.Alpha = value.A; ...

datagridview databinding to a datasource in vb.net

hi, can someone give me a very detailled tutorial on how to bind datagridview to a datasource. assume I have a datagridgrid view with the following header text: username and password. I selected data from the database doing the following: select username, password from login. now how can i use this query to fill my datagridview? thanks...

How do you use data binding in C# winforms development ?

Recently I use data binding to speed up my development of C# winforms application. But I found that data binding is just useful when the control is Textbox or textare and text kind of controls. If things come to be radio button, image control or datagridview, it's hard for me to use data binding. For example, it's hard for me to...

[WPF/MVVM] Dynamic animation using storyboards

Hello, I develop an application in WPF using the MVVM pattern. I am displaying an oriented graph, with nodes and links (see following picture). http://free0.hiboox.com/images/1110/diapo1c36a4b95802846b8553d2fe9b9e6639.png?26 The user can drag and drop the nodes from one "cell" to another. When the user drops a node, its position is ch...

winforms databinding best practices

Demands / problems: I would like to bind multiple properties of an entity to controls in a form. Some of which are read only from time to time (according to business logic). - Edit: The logic is based on the bound instance, not only on its the type. When using an entity that implements INotifyPropertyChanged as the DataSource, every ch...

Binding DataRow to TextBox

Hi! I want to bind textbox to single DataRow object (passed to dialog form for editing). Here is my code: DataRow row = myDataTable.NewRow(); EditForm form = new EditForm(row); //in EditForm constructor nameTextBox.DataBindings.Add("Text", row, "name"); and I'm gettinh an error: Cannot bind to property or column in DataSource. Do y...

Controlling the Text of a DataGridViewButtonColumn in a Databound DataGridView

I can add a DataGridViewButtonColumn to an existing DataGridView that is databound to a BindingList of my class. (There doesn't seem to be a way to have a DataGridViewButtonColumn auto generated - you apparently have to add manually) Is there a way to control the text that is displayed on the buttons by having it bound to a public prop...

Winforms BindingSource

I have a binding source object that fills some textboxes. In run time, after editing the textboxes I want to be able to retrieve the old values. how can I retrieve the Textbox's old value and refresh the screen ? Maybe the binding source has history or something ?! ...

WPF context menu bound to List<> dependency property

Im trying to make the contents of a List thats a dependency property show up in a WPF context menu. I have a class with the following dependency property, a list of Foo's (data holding class): public List<Foo> FooList { get { return (List<Foo>)GetValue(FooListProperty); } set { SetValue(FooListProperty, value); ...

WPF ListBox Data Binding Works in Designer but not Runtime

I have a maddening problem - I cannot get basic data binding to work even with copied examples. In the designer the listbox has 2 items but at runtime it's empty. <Window x:Class="BasicTables" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Basic...

binding a usercontrol to the opposite of a bool property

Pretty straightforward: I'm looking to do the same as this but in winforms. Everything that google seems to pull up is wpf specific (ie. I don't want to reference presentationframework.dll) Explained if you don't want to read the link: The following is a representation of the intent of what I'd like to do, though it obviously doesn't w...

Select the Initial Text in a Silverlight TextBox

I am trying to figure out the best way to select all the text in a TextBox the first time the control is loaded. I am using the MVVM pattern, so I am using two-way binding for the Text property of the TextBox to a string on my ViewModel. I am using this TextBox to "rename" something that already has a name, so I would like to select the ...

How to trigger on bound item in WPF?

I want to activate a trigger if the bound items property ID is equal to a property in my custom control. But i can't use bindings in my triggers! How would i do this? ...

fix a columns width when a list is bound to a datagridview

I have a list that I have bound to a datagridview. I want the first column to be a fixed size. The data is bound to the dataGridView and I can't seem to find a way to access an individual colums properties. if I try myDatagridview.colums[0] I get an index out of bounds, since it says the columns count is 0. private DataGridView se...

Binding from View-Model to View-Model of a child User Control in Silverlight? 2 sources - 1 target..

Hi there, So i have a UserControl for one of my Views and have another 'child' UserControl inside that. The outer 'parent' UserControl has a Collection on its View-Model and a Grid control on it to display a list of Items. I want to place another UserControl inside this UserControl to display a form representing the details of one I...

How to bind a Listview MaxHeight to the current windows height?

How to bind a Listview MaxHeight to the current windows height? I'd like to limit the height to let's say 3/4 of the windows height. How can I do that? ...

WPF element binding across seperate windows-how to do?

I can do element-to-element binding in WPF: For example, I've got a window that has a slider control and a textbox, and the textbox dynamically displays the Value property of the slider as the user moves the slider. But how do i do this across seperate windows (in the same project, same namespace) ? The reason is that my main applicati...

How to implement Master-Detail with Multi-Selection in WPF?

Hi, I plan to create a typical Master-Detail scenario, i.e. a collection of items displayed in a ListView via DataBinding to an ICollectionView, and details about the selected item in a separate group of controls (TextBoxes, NumUpDowns...). No problem so far, actually I have already implemented a pretty similar scenario in an older pro...

Bind a users role to dropdown?

Hi... I'm trying to bind a selected user's role to a dropdown-list. The purpose of this is to be able to change said user's role. I'm attempting this inside a formview hooked up to a linqdatasource which contains a row from the aspnet_User table. The dropdown list is hooked up to a linqdatasource of all the roles in the aspnet_Roles ...

databinding expression in asp.net

Hi All, I have an VS2005 ASP.Net page with a repeater on it of Customers. The following shows up in the of the repeater: <span><%# Eval(GetAdLinks((Customer)Container.DataItem)) %></span> The GetAdLinks is a protected mehtod in the code behind which returns a control represented as a string. Is this possible? I'm getting an error ...