databinding

What's the difference between Databinder.Eval and Container.DataItem?

When you're using asp.net databinding expressions: <asp:Label Text='EXPRESSION' runat="server" /> What's the difference among: Container.DataItem("Property") and Databinder.Eval(Container.DataItem, "Property") and Eval("Property") and Bind("Property") ...

Any advantages of binding a list of objects to a grid instead of to a datatable? (.NET)

I have a business object let's say a Customer. I have a DAL method which brings back a datatable of customers. I have a UI which has a grid which will display a list of customers. My question is.. is it OK to bind the grid to the datatable, which means the UI will have a reference to System.Data or should the datatable be converted firs...

Binding to BindingList<T> - choose what to bind?

Say I have an business object called Sample and I have BindingList of Samples. A sample has 4 properties. Can I select which properties are bound to DataGrid or there no option to customize such a thing? NOTE: I am using Compact Framework, where is NO DataGridView, as well as Autogenerate property and DataMember property. Please keep...

is it possible to read the colum name of a cell in gridview ?

Hi i want to find the column name of the cell in the below event of a datagridview. protected void grvDetailedStatus_ItemDataBound(object sender, DataGridItemEventArgs e) { for (int i = 0; i <= e.Item.Cells.Count - 1; i++) { System.DateTime cellDate = default(System.DateTime); if (System.DateTime.TryParse(e.Item...

Implementing a simple Master-Detail scenario for WPF in MVVM

I have a WPF application using MVVM. I have some user controls that should show a Person FirstName, LastName and email in 3 Textbox controls using simple databinding. The User Control has a simple combobox where the user selects the ID for the user and therefore the Person Record with that ID should be loaded (its data fetched from the ...

Binding to function in custom control in flex

Cannot seem to get the binding to work between the user control and the Model. This is my first attempt as I am just playing around with flex as an alternative to Silverlight This is my model <mx:XML format="e4x" id="searchCriteria"> <searchCriteria> <surname>{ surNameCtl.currentSearchTypeValue }</surname> <surname_criteria>{surN...

Is it wise to use ‘databinding’ and the ‘Data Sources’ window in Visual Studio?

Is it wise to use ‘databinding’ and the ‘Data Sources’ window in Visual Studio? It seems to me that dragging and dropping objects from the data sources window is so easy and seamless just until something breaks, then you have to spend hours trying to figure out what went wrong with the code generated by Visual Studio. Do serious program...

XAML - How Do I Bind an Element of a Derived <UserControl> to an Element of the Base <UserControl>?

How do I bind an element of a derived <UserControl> to an element of the base <UserControl>? I have defined a UserControl called Tile as my base class. This would be an abstract base class, if XAML wouldn't balk when I tried to instantiate an object derived from it ... Anyway, so far Tile only contains a single dependency property:...

What makes WPF databinding so powerful?

Just a simple question really, might be to simple really but hey here goes. What makes WPF binding so powerful vs say Winforms databinding? What are you likes and dislikes about it? Any code example that show it's power would be cool. ...

C# - Can I Data Bind between a value and an expression?

Hi, I have a List and a Button. When the Lists Count == 0, I would like the button Visibility to = false. How do I do this using Data Binding? Thanks in advance, Added I have asked this so that I can try to avoid checking the Count on the list in code every time I add or remove an item to or from the list. But if there is no solution...

Getting at the "parent" of a databound object?

Hi, I have an object with two arrays of strings. The object is data bound to a listbox. One list is bound as the list's ItemsSource. The other, which is the thing causing me trouble, needs to be bound to a combobox that's part of a DataTemplate that is set to the list's ItemTemplate. Basically each item on the listbox has the correspond...

ITypedList alternative?

I have a helper class that implements ITypedList, to provide objects for databinding against custom collections. My implementation allows me to easily specify that I want sub-properties of objects to be available for data binding, for instance I can bind to "Id", "Name", and also "Children.Count". Now, my problem now is that in order t...

WPF, two-way binding to a hash table

Hi, I am binding to the values of a hash table from within a datatemplate and the values display fine, but the changes are not persisted to the object when I make changes in a text box for example. Any idea why this is? <DataTemplate x:Key="ResponseItemTemplate"> <StackPanel Orientation="Horizontal" > <TextBox Wi...

WPF: Bind DisplayMemberPath in a combobox to the Item

Ok, this is kind of odd but this is basically what I need to do. I have a WPF control that is bound to a Document object. The Document object has a Pages property. So in my ViewModel, I have a CurrentDocument property, and a CurrentPage property. Now, I have a combobox that I have bound to the CurrentDocument.Pages property and updates...

FlowDocumentReader Document doesn't get notified when bound source changes, why?

So I have this XAML in the .xaml file <StackPanel> <Button Width="200" Height="30" Content="Change Words" Click="Button_Click"/> <FlowDocumentReader ViewingMode="Scroll" Zoom="90" Focusable="True" Background="White" IsFindEnabled="True" IsPageV...

I feel like a rat in a pipe factory. Stratergy for designing WPF binding solutions?

So many dead ends! I'm trying to achieve two way binding between a visualization and an array of about 300 single bytes of data. It sounds simple but it turns out not. Even Bea Stollnitz, it seems, took three goes at binding a polyline to data: Part 1 Part 2 Part 3 What hope does a beginner have? So my question is: Is there a se...

In a BoundColumn in a DataGrid, how do I format a byte[] column as a string?

I'm passing a datebase reader object to a DataGrid and it sees one of my columns as type byte[] but I happen to known that it should always be a printable string. How can I force the .NET DateBinding system to do that conversion? The only place I can see to put anything is in BoundColumn.DataFormatString but I can't find any indication h...

How to use DataBinding to set the ID of asp:CheckBox controls

I have some ASP that I want to look kinda of like this: <asp:DataGrid ID="dgEnum" runat="server" AutoGenerateColumns="false"> <Columns> <asp:TemplateColumn> <ItemTemplate> <asp:CheckBox ID="<%# some big DataBinder expression %>" runat="server" /> </ItemTemplate> </asp:TemplateC...

Data input for many to many relationship in windows forms

I'm developing a windows form application ported over from a very basic lotus notes database app. As an example of There is a "Jobs" table a "Parts" table and a many to many relationship table "Job_Parts" with JobID and PartID. When adding a new job record I need a input method for the user to select from the parts list and I envision t...

How to achieve databinding with an user control in wpf?

Hi! I'm fairly new to WPF and I have some problems getting databinding to work as I want. I've written a user control which contains a TextBox whose Text-Property I want to bind to a property of my UserControl, which I want to bind again to something else. What am I missing? XAML <!-- User Control --> <TextBox Text="{Binding Path=The...