databinding

Need help databinding an ArrayList of ListItems - .NET 1.1

I am databinding a dropdown list with the following array list: ArrayList al = new ArrayList(); al.Add(new ListItem("Service Types", 1)); al.Add(new ListItem("Expense Types", 2)); al.Add(new ListItem("Payment Terms", 3)); al.Add(new ListItem("Classes", 4)); al.Add(new ListItem("Project", 5)); al.Add(new ListItem("Employees", 6)); al.A...

datagrid issue

I hav a datagrid in which the first row comes selected by default.Moreover i make a row visible on the selection of all the rows in a grid thaving the binded data.But due to the selected row i am not even able to do any action s on the first row.Not even selection on my own. Please look forward to this and reply me. ...

Flex databinding a function

Does anyone know how to programmatically bind a property to a function that isn't a getter? IE: I have a function that returns a translated string based on the identifier you pass it. How do I do this in AS3 rather than MXML? (reason being - I have a dynamic layout that I render based on XML and so have create and add all children progr...

Bind StackPanel.Visibility to the Visibility property of its children

I'm relatively new to DataBinding and just reading into it. What I want to do is the following: I have a StackPanel with a number of child controls: <StackPanel Orientation="Horizontal"> <TextBox x:Name="textbox1" Width="100">1</TextBox> <TextBox x:Name="textbox2" Width="100">2</TextBox> <Tex...

WPF DataBinding - Fire event from a repeated control button

Following from my question on binding in general, I'd like to ask for help on the following scenario. I have a collection of objects (imageFileData) displayed via a DataTemplate in a ListBox control. The control is bound to an ObservableCollection. Both the collection and the template are defined within my application xaml and xaml.cs...

Does WPF databinding make things more of a pain than it is worth?

Ok, So I have been stalled in my latest non-work project, trying to use WPF. I am just frankly annoyed at databinding. I thought it was supposed to make things simpler by binding data directly to the UI. But the more I learn about having to implement INotifyPropertyChanged to get things to notify the UI if they changed, seems to make...

What should I do with INotifyPropertyChanged when a child list changes

I have a set of data objects that I am using for databinding that implement the INotifyPropertyChanged interface and I'm trying to figure out what to do with properties of complex type. If I have something like class C { private string text; public string Text { get { return text; } set { if(Text != value) { text = value;...

Silverlight bound TextBox loses data when browser closes

When I bind a TextBox control to a string property of a object using two way binding, it works fine - as long as the user moves off the control before he closes the browser window/tab. But what about the user who makes a change to the contents of a text box then closes the window expecting the data to have been saved? While it is possi...

LINQ to Objects - binding to a ListView

Hi, I've been having a problem binding a ListView to an Object using LINQ. It's best explained with a testcase I've created: C#: using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Windows; using System.Windows.Controls; namespace WpfApplication1 { public partial c...

When using the XPath binding expression, can you get back InnerXml rather than InnerText?

I'm binding a control to an XmlDocument and using the "XPath" binding expression to output the data: <div class="Bio"><%# XPath("Biography") %></div> However, this returns the InnerText property of the "Biography" element, not the InnerXml. This means it strips all inner tags from it, which is not what I want. I looked through the X...

ASP.NET ListView, custom DataSources, and editing items

The MSDN walkthroughs provide a number of examples where you can drag a DataSource from the toolbox, run through some simple configuration steps, then drag a ListView onto the screen, point it at the DataSource, and hey - you've got full table editing. Now I'm trying to write my own DataSource class (a class that implements System.Web....

ASP:DropDownList in ItemTemplate: Why is SelectedValue attribute allowed?

This piece of code <asp:DropDownList runat="server" ID="testdropdown" SelectedValue="2"> <asp:ListItem Text="1" Value="1"></asp:ListItem> <asp:ListItem Text="2" Value="2"></asp:ListItem> <asp:ListItem Text="3" Value="3"></asp:ListItem> </asp:DropDownList> yields this error: The 'SelectedValue' property cannot be set ...

WPF Dependency Property Data Binding Problem

I created a UserControl in WPF. This user control has several text boxes that are bound to properties on a database object which is referenced by proptery on the UserControl. The xaml looks like: <TextBox Name="_txtFirstName" Text="{Binding Path=Contact.FirstName, UpdateSourceTrigger=PropertyChanged}"/> This worked properly until I...

How to bind to an Image using a dynamic URL in WPF?

I am new to WPF so hopefully I phrased the question correctly. What I'd like to do is bind my <Image> to an image online. However, the image I would like to bind to changes depending on the state of the application. For example, if I wanted to bind to an Employee selected from a list, I'd retrieve a base URL from my App.config and append...

Databinding Generic Collection vs Datatable,

How costly is databinding a collection of objects to a grid (telerik gridview to be specific) vs a regular datatable, I wouldnt have thought it was an issue but I am doing the databinding via a webservice AJAX callback and if the grid has more than 20 rows it starts to take a noticable time to bind, ...

Binding to a command in a datagrid

I am using the M-V-VM pattern in a WPF app. I am binding a ViewModel to a COntentControl and using a data template defined int eh window resources to render the view (a UserControl) for that ViewModel. In the ViewModel, I have a collection of items. I'm binding that collection to the data grid provided in the WPF toolkit. Also in the...

WPF Databinding in XAML

Hello I have little problem with databinding in my current project. I have an ObservableCollection I want to bind to an ListBox. public ObservableCollection<GeoDataContainer> geoList = new ObservableCollection<GeoDataContainer>(); ...later... geoListBox.ItemsSource = geoList; This code works fine. The Listbox has a datatemplate an...

Dictionary<T> of List<T> and ListViews in ASP.NET

Preamble I'm asking this question because even though I've read through a lot of ListView resources, I'm still not 'getting' it. Background I have a bunch of Foo's that have a list of items associated with them (known as Bar), and I'm pulling them from the Data Access/Business Logic layer as Dictionary that holds a Foo and its associ...

ASP.NET - No Datakey on Gridview RowDeleting event!

I have a GridView just like this: <asp:GridView ID="gvwStudents" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" ShowHeader="False" onrowdeleting="gvwStudents_RowDeleting"> <Columns> <asp:BoundField DataField="FirstName" /> <asp:BoundField DataField="LastName" /> <asp:BoundField DataFiel...

What type of object should I be binding to my WPF form in an n-tier app?

I am currently working on a small N-Tier application in C# which uses Linq-to-Entities (SQL Express 2005 for the DB) and WPF and I am wondering what type of data collection my business logic layer should be supplying to the user interface. Are there downsides (performance, validation etc) to binding form objects like datagridviews to an...