databinding

WPF: Bindings - Object not updated

I have a an object which is set to the DataContext in a Window. I have textboxes in the window which are bound to the properties on the object. There seems to be a delay however before the properties on the object are updated. <TextBox x:Name="txtPropertyOne" Text="{Binding Path=PropertyOne,Mode=TwoWay,UpdateSourceTrigger=PropertyChange...

WPF TabControl Databinding

I'm trying to build a WPF user interface containing a TabControl, and a TextBlock. I want to bind these two controls to an underlying collection of instances of the following class: class PageModel { public string Title {get;set;} public string TabCaption {get;set;} public FrameworkElement TabContent {get;set} } The tab control...

How to get Binding value of current cell in a WPFToolkit DataGrid

Hello, I want to change the foreground color of cells that hold negative numbers, but I don't know how to specify the DataTrigger that would let me. I'm using something like this: <Style x:Key="NumberCellStyle" BasedOn="{StaticResource CellStyle}"> <Style.Triggers> <DataTrigger Binding="{Binding Converter={StaticResourceExtension Sig...

ASP.NET: Databinding and updating objects with nested collections

Hi, I've made a small example with a "Person" class, which contains a list of Pets. In addition, there'se a simple repository that can save / delete / select Person objects. Now I put a form view (or details view) on my form, choose an object data source which points to my repository. So far it works perfectly, I can create, update, de...

How do I bind a Byte array to an Image in WPF with a value converter?

I'm trying to bind a Byte array from my databse to a WPF Image. My XAML: <Window.Resources> <local:BinaryImageConverter x:Key="imgConverter" /> </Window.Resources> ... <Image Source="{Binding Path=ImageData, Converter={StaticResource imgConverter}}" /> I've modified code published by Ryan Cromwell for a value converter: Class Bi...

ADO.Net databinding bug - BindingSource.EndEdit() changes current position

What is the correct order of processing an insert from a data-bound control using BindingSource, DataSet, and TableAdapter? This is causing me eternal confusion. I have a form that is used to add a new row. Before showing the form, I call: bindingSource.AddNew(); bindingSource.MoveLast(); Upon Save, I call: bindingSource.EndEdit();...

WPF GridViewRowPresenter in an ItemsControl

I'm just starting learning WPF and I'm trying to use a GridViewRowPresenter inside of an ItemsControl to essentially duplicate the functionality of a simple table in HTML. The ListView is not appropriate since it is interactive (which I don't want). I am binding to a generic List of objects of an unknown quantity. I have a List of a cus...

How to convert a DataTable/DataSet into a ObjectDataSource

I have a GridView that's tied to an ObjectDataSource. I have a method that returns a DataTable. How do I feed the DataTable to the ObjectDataSource so that the GridView is updated in code? Example: protected void Page_Load(object sender, EventArgs e) { MyClass obj = new MyClass(textbox.Text); DataTable dt = obj.GetData(); ...

Silverlight Databinding one control to another

I'm working in Silverlight. I've got a ListBox that's being loaded dynamically. In the listbox, i want to put a checkbox that's tied to the listbox's "selected" property. I can't quite figure out how this is done. Can anyone point me in the right direction? If this were a winform thing, I would, create "OnChecked" handler for the chec...

Is there a way to iterate in a ListBox Items templates?

I have a list box that contains items that are represented by a single textbox. When the user clicks a button, I want to iterate thru all these text boxes and check if their binding expressions are clean of errors; Should be something like: Dim errCount = 0 For Each item In MyListBox.ListBoxItems 'There is no such thing ListBox...

Binding a datacontext string property to a StaticResource key

I have an List values with a ResourceKey and a Caption, these values are both strings. The Resource is the name of an actual resource defined in a resource dictionary. Each of these ResourceKey Icons are Canvas's. <Data ResourceKey="IconCalendar" Caption="Calendar"/> <Data ResourceKey="IconEmail" Caption="Email"/> I then have a list v...

Dropdown binding in WinForms

Imagine these two classes: class Part { public string Name { get; set;} public int Id { get; set; } } class MainClass { public Part APart { get; set;} } How can I bind MainClass to a combo box on a WinForm, so it displays Part.Name (DisplayMember = "Name";) and the selected item of the combo sets the APart property of the MainClas...

Databinding sub classes

Say I have these 3 classes: public class ClassParent { public string TestParent { get; set; } } public class ClassChild1 : ClassParent { public string TestChild1 { get; set; } } public class ClassChild2 : ClassParent { public string TestChild2 { get; set; } } Say, I've created plenty of objects of type ClassChild1...

Grails date binding

In Grails, one can 'bindData' in controller: Book b = new Book() bindData(b, params) What if I have a date field with specific format (e.g. yyyy-MM-dd) from user input? In Spring, we can use registerCustomEditor(). How about Grails? ...

ASP.net weekly schedule control

Can anyone recommend a free asp.net control that I can use for the following: Weekdays Monday-Saturday along the top row Time of day along left hand side Template fields for the actual data Databindable Cells span the rows based on the start time and end time Here is a control that I found that is pretty good, but I am trying to find...

How do I: Implement a n-level nested gridview ?

I am not the gratest when it comes to implementing UX. I looked around on the internet for an implementation of a nested gridview or nested reapeater control. Most of the demos used an sql datasource object. Nowadays I dont see anyone using an sqldatasource. In my scenario I will be using Object Datasource or would be databinding manuall...

WPF: "Value of type 'String' cannot be converted to 'System.Windows.Media.ImageSource'."

I'm trying to set a WPF Image's source. XAML works: <Image Name="ImageThing" Source="images/Thing.png"/> Visual Basic fails: ImageThing.Source = "images/Thing.png" with this exception: Value of type 'String' cannot be converted to 'System.Windows.Media.ImageSource'. How do I create the System.Windows.Media.ImageSo...

Entity Framework - Bind Combobox to Normalised Table Field

I am currently trying to bind an entity to a form however I want to have DataConfidenceLevel (see below) bound to a combobox with ConfidenceDescription as the display member. What is the correct way to populate the combobox? (I am currently using WPF but a Winforms answer is acceptable) Thanks ...

Is possible to use a data source control in ASP.NET MVC?

I want to use a LinqDataSource or ObjectDataSource with ViewData.Model, where ViewData.Model is an string array. I don't want to bind the datasource on view's PageLoad event. Is it possible? How? ...

Binding complex properties in Silverlight/WPF

Lets say I have a custom data type that looks something like this: public class MyDataType { public string SimpleProp1; public string SimpleProp2; public List<SomeType> ComplexProp; } now I hava a data bound control (i.e. ItemsControl or DataGrid), that is created dynamically. How would the binding defined in xaml code look like...