databinding

WPF: Databinding - usercontrol not behaving

I have a little databinding-problem. (I usually have...) This is the error I get in the output window at runtime: System.Windows.Data Error: 39 : BindingExpression path error: 'CurrentKlokke' property not found on 'object' ''UIKlokke' (Name='anaKlokke')'. BindingExpression:Path=CurrentKlokke; DataItem='UIKlokke' (Name='anaKlokke'); tar...

Binding to Visible property DataGridCOlumn in WPF DataGrid

Hi, I cannot bind the Visible property of the WPF datagridtextcolumn to a boolean value. My binding expression is, {Binding Path=DataContext.IsThisColumnVisible, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window},Converter={StaticResource vc}} I have checked that the converter works (bool to the visibility enum) ...

ASP.NET MVC: How do I keep a field byte[]

I've got a field which its type is byte[]. This field will hold my entity's RecordVersion property (timestamp in the database). How do I keep this field so that when I save my entity it is available? I've tried two different things and haven't succeeded so far: This renders "System.Byte[]": <%= Html.Hidden("RecordVersion", Model.Record...

When binding with Wpf is there a way to use System.String funcntions without using converters?

When binding with Wpf is there a way to use System.String funcntions without using converters? <TextBlock Text="({Binding Path=Text}).Trim()"/> that's basically my desire. ...

InvalidOperationException using PFX w/ Windows Forms

I have two exceptions here. Not sure why they occur because I use Form.Invoke to run UI updates on the UI thread. So first, using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Xml; using System.Windows.Forms; namespace Toplr { using Sy...

Binding Controls to more than one DataTable

This is probably an odd question but here I go (do let me know if this is a bad database design or just a weird situation I'm in). I have two tables in my database: ProductGroup and Parameters. One contains information about various product groups as per its name and the other one contains information about various parameters that can b...

find parentitem in wpf-treeview

I hoped the answer to my previous question whould help me with this one, but it didn't. the initial situation is pretty much the same: <TreeView ItemsSource="{Binding Groups}" Name="tvGroups" AllowDrop="True"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Participants}"> ...

WPF Databinding Magic

I have ObservableCollection<Foo> that is bound to an ItemsControl (basically displaying a list). Foo mostly looks like this (there are other members but it doesn't implement any interfaces or events): class Foo { public string Name { get; set; } //... } When the user clicks on an item I open a dialog where the user can edit Foo's...

Best way to databind a group of radiobuttons in WinForms

I'm currently working on databinding some of my existing Windows Forms, and I've ran into an issue figuring out the proper way of databinding a group of radiobutton controls within a group box. My business object has an integer property which I want to databind against 4 radiobuttons (where each of them represents the values 0 - 3). I'...

data binding update when value changes, not when tabbing out

Is there a property or setting to force a bound control in Winforms to update the object it is bound to when the input value, either in a textbox or whatever, actually changes? And not after the control is tabbed out of. ...

How to make a ListBox.ItemTemplate reusable/generic

I'm fairly new to WPF and trying to understand how best to extend the ListBox control. As a learning experience, I wanted to build a ListBox whose ListBoxItems display a CheckBox instead of just text. I got that working in a basic fashion using the ListBox.ItemTemplate, explicitly setting the names of the properties I wanted to databind ...

WPF XmlDataProvider TreeView Error

I have a WPF TreeView control that is binding to an XMLDataProvider. The nodes are appearing fine within the Treeview control however the following error is appearing: System.Windows.Data Error: 43 : BindingExpression with XPath cannot bind to non-XML object.; XPath='Text/*' BindingExpression:Path=; DataItem='XmlDataCollec...

Display the selected record

I have a page that display of all News in a database, which I get with function IList<News> GetAll(); I then bind the list to a repeater to display all the news. If a user clicks on news N, he is redirected to page.aspx?id=N If the QueryString["id"] is set, then I get one of my News like this: News news = sNewsService.Get(int.Parse(...

How can I databind a gridview to an arraylist in .NET?

How can I databind a gridview to an arraylist in .NET? I am using .NET 3.5 and Visual Studio 2008. ...

Using a List<UIElement> as the ItemsSource for an ItemsControl causes the DataTemplate not to be applied

I have created a custom panel (MyCustomControl) that can contain other controls and be configurable through dependency properties. Inside a different user control (MyUserControl), I have multiple instances of MyCustomControl configured in XAML. Outside of the user control, I am trying to bind an ItemsControl (myItemsControl) to the l...

WPF binding multiple controls to different datacontexts

I have a scenario where I don't really know how to bind data to controls hosted in a UserControl to multiple datacontexts. The data i want to bind comes from 2 classes UserInfo, UserExtendedInfo The datacontext of the UserControl is set to UserInfo so i can bind most controls easily doing the following <Label Name="LblEmail" Text="...

Why DataBinding doesn't work on second time around?

The error I got when I change the datasource of BindingSource "databinding cannot find a row that is suitable for all bindings row that is suitable for all bindings" this.RemoveAllBindings(); // My work-around for the meantime bdsOrder.DataSource = _ds.Tables["orders"]; // errors here on second time around(first time i...

How to bind nested array element property value to TextBox in ASP.NET MVC

Hi, I have model public class User { public User() { Addreses = new List<Address>(); } public String Name { get; set; } public String LastName { get; set; } public List<Address> Addresses { get; private set; } } public class Address { public String Street { get; set; } public String City { get; ...

Is there a best practice for string replacement in .aspx pages?

I have an .aspx page setup. I have a lot of placeholders that need to be replaced. First name, last name, city, state, etc, etc. How do I go about doing this in an efficient manner? Drop a bunch of... <asp:Label runat="server" id="Label_FirstName" Text="" /> ...everywhere? Or is there a way to use the data binding syntax in the n...

Winforms datagridview databind to complex type / nested property

Winforms, C#, DataGridView, .Net 3.5 Hello, I am trying to databind a datagridview to a list that contains a class with the following structure: MyClass.SubClass.Property When I step through the code, the SubClass is never requested. I don't get any errors, just don't see any data. Note that I can databind in an edit form with the...