databinding

How can I bind a custom object in code-behind to a Grid in XAML?

In the following example, the Message property binds correctly but the FirstName, LastName and Age properties of the Customer object are blank. Why is that? XAML: <Window x:Class="TestBinding9922.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...

Databinding with WPF User Control...

I've been Googling for it; but without any luck. I think this is fairly simple. I have a user control named 'TicketGroup'. TicketGroup is the visual representation of a List object I have. The XAML code I've got looks like this. <c:TicketGroup Grid.Row="1" /> <c:TicketGroup Grid.Row="2" /> <c:TicketGroup Grid.Row="3" /> ...

Maintaining usercontrol state on dynamically added usercontrols

I have a page that dynamically creates multiple usercontrols on the page_init event, and adds it to a placeholder on the page. The usercontrols themselves databind to a repeater on page_init to a collection of about 10 strings, which outputs a div for each item. There's also a "view more" link button on the user control. When I click ...

(MVVM) Model View View Model And Threading

Hello, I'm playing around with the (MVVM) Model View View Model design pattern but I ran into a problem with the pattern. In my scenario I'm using a DataTable as the View Model. This View Model is set as the DataSource of a DataGridView. Normally, when the Presenter adds a new row to the View Model, a new row is added to the DataGridVie...

Binding ObservableCollection items to UserControl in WrapPanel?

I may just be missing something obvious here, so I apologize if this is a really dumb question. I have a WrapPanel in a view that I need to bind to an ObservableCollection on the ViewModel. This ObservableCollection contains a different type of ViewModel that needs to be bound to another type of view when displayed in the WrapPanel. The ...

Updating DataTrigger manually or run synchroniously

Hello, I hope you can help me, I have a problem with WPF DataBinding in a FlowDocument. Here's a short description what I want to do: My aim is to print or export a XPS-Document which is build from a FlowDocument. In the FlowDocument I set some XML-Bindings which should represent the content of the XMLNode. In my XMLSource i'm storing v...

Detecting when a row has changed in a dataset/datatable

I'm trying to add some extra logging to my C# winforms application. I have a few data bound forms that all the database stuff is managed by a binding source and some typed datasets/adapters. With this setup, it's kind of difficult to tell when something is changed, I'd have to manage each field and keep it's previous value. Is there a w...

Having trouble binding list/grid to collection

I have set up a grid and bound it to a collection. I can edit the items in the collection through my grid and the changes get propagated to the collection. And, the GUI is showing everything in the collection at the time the ItemSource is set. But, I am programmatically changing some of the items in the collection (after the ItemSourc...

Binding a POCO to an html document and generating the result to a string

I am trying to return an html string from a method in a class library (don't ask why). What i would like to do within the method is get an instance of a POCO from my domain, then open an html document (maybe from a file or maybe it is a string from somewhere else), then pass the POCO to the document (which has bindings to the POCOs prop...

Get public string in codebehind into LayoutTemplate of ListView

Hi guys, A doubt in ASP.NET(VB) I have a public variable in code-behind(ASPX.VB) Public _orderCode As String = "Hello World" At ASPX, I would like to access it inline. That too inside the LayoutTemplate of a ListView <asp:ListView runat="server" ID="listView_OrderReplies" DataKeyNames="ProductID" D...

Have a databound WPF Listbox generate subclassed ListboxItems

I would like to have my WPF Listbox, which is databound, generate subclassed ListboxItems instead of the regular ListboxItems. In this case, a DataTemplate is not sufficient because I need some custom properties for the subclassed ListBoxItems. Is there a way to have the ListBox generated mySubClassedListBoxItem items for the bound data...

recommendations for material on data binding

any good recommendations for databinding. i am starting to look into WPF more and i want to fully understand the how databinding work under the hood here. also, WPF is just one example as i assume there is a common pattern with tech like asp.net mvc data binding, etc. ...

Code Expressions in ASP.NET Themes

Binding expressions (e.g. <%# %>) are only permitted in ASP.NET skins in a very limited manner. It appears that only Eval(“”) statements with literal arguments are accepted. No formatting functions or composite expressions are allowed. Two part question: How does one support Text='<%# Eval(MyEnum.FirstName) %>' inside a skin How ...

Multiple data binding properties on ASP.NET usercontrol

Hi, How can I have multiple properties in my usercontrol that can be databound? For a single property I have found that DefaultBindingProperty Attribute does the trick but I have no idea on how to get databinding with multiple properties. ...

Simple databinding - How to handle bound field/property change. Winforms, .Net.

I have a custom control with a bindable property:- Private _Value As Object <Bindable(True), ... > _ Public Property Value() As Object Get Return _Value End Get Set(ByVal value As Object) _Value = value End Set End Property Any time the field, that Value is bound to, changes, I need to get the type. I ...

Binding to the actual of a UserControl in Silverlight?

Seen some questions on SO but none answers my question. What I want to accomplish: I have a custom control (lets call it A) which moves around the canvas using a storyboard. And I want to bind another custom control's canvas (lets call it B) position onto the first control. Using the TransformToVisual(Application.Current.RootVisual) I...

WPF: Binding with nonstatic parameter? (newbie question)

Hi guys, This will probably be obvious but I can't find the best way. I want to show the user's ToDo's in a listbox. These ToDo's are in the database and consist of an Id, UserId and Description. The user logged in to the app. How can I retrieve the ToDo's for that certain userId and set it up for binding to the listbox? I was tryi...

How can I databind to properties of UIElement items

I can't databind to properties I have added to subclasses of UIElement. Can anyone help? An example: I am displaying a collection of items on a canvas using databinding. I want to include both UIElements and data items (which will have a datatemplate instantiated) in my canvas. The items have properties that determine their position ...

Multiple buttns on a page - not working

Can someone tell me why the following is not working? <head> <script language="javascript" src="/assets/js/jquery-1.3.2.js"></script> <script type="text/javascript"> $("button").bind("click", function() { alert("You clicked " + $(this).attr("id")); }); </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <...

databinding to XML in XAML: How to append new XmlNode?

Hi, all I found so far about databinding to XML always only seems to be binding to a fixed XML structure. Would be nice, if anyone could point me in any direction, everything I tried so far seems very awkward. This is what I would like to do: Binding the Checked state of a Checkbox to a node within the XML. So it is checked if this sp...