databinding

Keep same selected Item in a ListView when the collection it is bound to is refreshed

I have a ListView that is bound to an ObservableCollection which is itself derived from an IQueryable. When I refresh the collection, after items are added, edited or a button is clicked (to see if the database has new items from other users). The listbox refreshes and selects the first item in the collection. I want to keep the same s...

ASP.NET: Postback processed without events being fired

I have a GridView with dynamically created image buttons that should fire command events when clicked. The event handling basically works, except for the very first time a button is clicked. Then, the postback is processed, but the event is not fired. I have tried to debug this, and it seems to me, that the code executed before and afte...

ASP.NET Databinding Template: Escape Tags in a Server Tag

I'm doing some databinding inside a ListView ItemTemplate, but I suspect this is a problem for any databinding/template situation. I want to write something like: <asp:HiddenField runat="server" ID="hidPositionID" Value="<%#Eval("PositionID") %>" /> But I get a YSOD with an error message that the server tag is not well formed. How d...

XamlParseException when databinding a ComboBox to a statically-defined array in XAML

I've been trying to solve this problem for over an hour now, and can't figure it out. Hopefully someone can see what I'm doing wrong. I have two separate projects, both of which populate a combobox with an array of Doubles in the UserControl.Resources section, then databind to it in the GUI. What I'm doing is essentially just this, wh...

WPF - Have a list source defined at runtime but still have sample data for design time

I have some ListBoxes in my WPF app. I would like to be able to view how the design looks with out having to run the app. But I still want to be able to bind to ItemsSource to my View Model. I know I saw a blog post on how to do this, but I cannot seem to find it now. To reiterate, I want dummy data at design time, but real data at ...

LINQ to SQL and Windows Forms Binding.

Could anyone suggest the proper way for binding LINQ to SQL queries in Windows Forms controls? Should i follow the standard way with BindingSource and handle the events to have change tracking while various values changing from the controls. This kind of binding will involve hierarchical object binding too, EntityRef<>, EntitySet<>. Now...

Infinite recursion error using DependencyProperty (C#)

Here's the C# code directly from the website (http://jobijoy.blogspot.com/2007/10/time-picker-user-control.html) that everyone refers to when someone asks about TimePicker for WPF, although I moved it around a little bit to be more organized. (Please note, if you're trying to run this code to work with it: you must change the XAML code ...

Databinding collection of collections

Hello I looked for on the web during a long time and I can't find my answer. I have two classes: 1) Customer: Customercollection which inherits from ObservableCollection. It contains dependency property: String Cname; String Cemail; OrdersCollection Orders; 2) Orders: OrdersCollection which inherits from ObservableCollection. ...

C# DataBinded ListBoxes - Sorting Issue

I have these ListBox es.. all of them are DataBind ed to same table and they are in a table type of manner, every row corresponds to its actual value in the datbase. When i switch selection(SelectedIndexChange) on any of these ListBoxes i change the SelectedIndex of all the other ListBox es. Now i cannot simply select "Sort = true" f...

IObservable<T> and INotifyPropertyChanged - is there a connection...

I understand the IObservable & IObserver are implementations of the observer pattern and can be used in similiar circumstances to .Net events. I was wondering if there is any relationship to INotifyPropertyChanged? I currently use INotifyPropertyChanged for data binding in winforms & WPF applications and was wondering if I'll be able t...

Binding two UserControls to the same DataContext, or ViewModel?

I am working on a UserControl, which is composed of a Chart panel and another area which manipulates some of the chart data i.e. the chart controls (change color of graph, enable or disable stuff on the chart, etc.). I use a ViewModel to manage the chart and its data, but was thinking maybe it would be nice to make a separate usercontro...

Silverlight Databind to a parametrized DataService

Hi, I'm building a Silverlight app using RIA Services. I want to implement a master/detail behaviour. The trick here is that the "detail" grid can not be filled directly with the "SelectedItem" property of the master grid, and what I have to do is get one of the fields from the master grid and use it as a parameter to the DataService. Ho...

WinForm DataBinding Hide Property in business object C# .NET

My datagrid (DevExpress) automatically will populate a grid based on the public fields of a business object. What attribute can I place on the field to tell WinForm databinders to ignore it? [???HideFromDataBindingSources???] public bool IsSecurity { get { return _isSecurity; } set { _isSecurity = value; } } ...

Data binding causing WPF designer error

Hey guys Does anyone know why this binding is causing an error in the WPF designer? ("Exception has been thrown by the target of an invocation.") XAML (partial): <Window xmlns:local="clr-namespace:MyAppNamespace"> <DataGrid ItemsSource="{Binding Source={x:Static local:Clients.Instance}, Path=Cli...

Need additional help with binding multiple CommandParameters using MultiBinding

I need to have a command handler for a ToggleButton that can take multiple parameters, namely the IsChecked property of said ToggleButton, along with a constant value, which could be a string, byte, int... doesn't matter. I found this great question on SO and followed the answer's link and read up on MultiBinding and IMultiValueConverte...

WPF - Temporarily Stop Data Binding (databinding)

I have a textbox that is bound (oneway) to a datatable that updates a couple of time a second. So the textbox value continually reflects changes in datatable. When I enter the textbox to manually set a value, the binding causes the value to continually be overwritten. How do I stop this? When I have entred a value (textbox lost focus) I...

Silverlight application resources for global access to a singleton

I have a singleton which once hit will load user profile information, I want to make it an application level resource in my SL3 application so that elements across the application can bind to it. My code version of the instantiaion is a simple UserProfile x = UserProfile.GetInstance(); I want to be able to do this in xaml in the app...

How to add data into RichTextBox from two datasourses in WPF

I need to put data from two different datasourses in the same textbox. The text that comes from the first one have to be bolded and the secound normal. It's there a possibility to do this in WPF? ...

Can I bind a WPF TreeView to a single root node?

Say I have a binary tree, where the root of the data structure is just a tree node. For each node, the children are accessible through the Children property. Here's what I tried. The TreeRoot is a property of the inherited data context, but it's a single node (not a collection). <UserControl.Resources> <HierarchicalDataTemplate x:Ke...

ConvertEmptyStringToNull=”false” and yet the conversion still happens

hi DetailsView is bound to ObjectDataSource. Inside Detailsview’s EditItemTemplate are two TextBoxes ( T1 and T2 ). T1 is mapped to update parameter of type String, while T2 is mapped to update parameter of type DateTime. Assuming both TextBoxes contain an empty string, then when I try to update the data source by clicking on Details...