databinding

Wpf Data entry Form bound to datatable...

Hi, I was trying my hand on binding in Wpf.I am trying to make a dataenrty screen.for instance,I have a textbox and a combobox and a listview.. users enter pick an item from the combobox,add a comment and add the item to the listview.This is the flow.I have a master table for the combobox,i have its selectedvalue bound to a Item field in...

Silverlight pages binding to dataset(design question)

Hi everyone, I have a legacy dot net application (now migrated to .net 2.0). We need to convert this application to silverlight. Problem here is the datalayer. All the methods from the datalayer return datasets. The entire web application is using datasets for databinding. Now the questions are: Can I use the same datasets for silv...

Silverlight databinding internal workings

Does anyone know how the databinding system works in silverlight technically, I have seen alot of the tuts on databinding and that items must be bound to a Dependancy Object ( and dependants ) using dependancy properties but where are the properties actually managed? what classes should I look at in reflector to understand the internals?...

How do I attach commands to the checking and unchecking of a CheckBox?

In my ViewModel I have two commands: ICommand ExecuteMeOnCheck { get; } ICommand ExecuteMeOnUncheck { get; } I wish to attach these commands to a CheckBox and have one of them execute when it is checked and the other execute when it is unchecked. What's the best way to achieve this without cluttering the View with code-behind? ...

(WPF) How do you bind to IsMouseOver on a usercontrol

Edit: The original premise of the question was incorrect so revised the question: Basically I want a button to be visible only when the mouse is over the containing user control. Here is the simplified versin of what I have: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas....

Binding a wpf listview to a Dataset....Possible..?

Hi, I was struggling moving to Wpf,I am just stuck while trying out databinding to a lsitview.I want to databind a listview to a dataset(dataset because the data i want to display in columns belongs to different tables).I am attaching a sample code that i am trying with.It works alright but the listliew only shows one row.What could be w...

XAML markup to use DecimalConverter?

I've a Decimal retail price property that I'm binding to a TextBox e.g. Text="{Binding Path=RetailPrice}". By default this displays with all 4 decimal places showing "0.0000". I assume I can use the built in DecimalConverter to shorten this to 2 decimal places "0.00", but can't for the life of me figure out the Xaml markup for this. Or...

How do I bind a StackPanel to my ViewModel?

In my view I have this: <TextBlock Text="{Binding Title}"/> which binds to my ViewModel's Title property and this is straightforward and works well: private string _title; public string Title { get { return _title; } set { _title = value; OnPropertyChanged("Title"); } } However my Vi...

ASP.NET Using If statement with Container in a list view

In my ListView I want to use a property of the Container in an if statement on the aspx page as shown below. But I'm getting a "The name 'Container' does not exist in the current context" error. Can I not the Container in an if statement? <ItemTemplate> <tr> <td> <% if (EDIT_INDEX == (((ListViewItem)C...

Can I throw a property changed event for items in a collection bound to my Listbox.ItemSource?

I have a user control that inherits from the ListBox class and displays a list of a custom class I have named DataSeries. Each DataSeries has several dependency properties, like LineColor for example. I can bind my DataSeries collection to the listbox itemsource with no problems, and it displays with the template I have defined (the te...

Inheriting DropDownList and adding custom values using its DataSourceObject

I'm inheriting a DropDownList to add two custom ListItems. The first item is "Select one..." and the second item gets added at the end, it's value is "Custom". I override DataBind and use the following code: Dim data As List(Of ListItem) = CType(DataSource, List(Of ListItem)) data.Insert(0, New ListItem("Select one...", SelectO...

WPF databinding binding error notification

OK, working on WPF(using MVVM) and came across a question, want some input. I have a simple class like below(assume I have IDataErrorInfo implemented): public class SimpleClassViewModel { DataModel Model {get;set;} public int Fee {get { return Model.Fee;} set { Model.Fee = value;}} } I then try to bind to it in xaml: <TextBox Te...

C#: How to handle "self-references" for tables within DataGridView?

Situation: In my database I have a table in which records may reference other records in the same table. Every record has a unique numeric ID (auto-ID column) and a nullable column IDRef which may contain the ID of the record to be referenced. Now, in my C# Windows Forms application I'm using a DataGridView to allow the user to edit th...

Databound controls and best practices

What is the current feeling about the use of databound controls? When I first started using a RAD framework I remember many people on the message boards that I belonged to were very much against the use of databound controls. IMO they greatly speed up development - but are they considered a good practice in the industry? ...

What's the cleanest way to render the results of a method while data binding?

The best way, of course, is to convert the method to a property. But I can't do that here -- We have an API from someone else, and we've added an extension method to one of the objects. We need at the string this method returns in a data-binding situation (a GridView). It doesn't seem that we can add an extension property (man, that ...

Why does one of the paths not bind in this scenario?

Elements and FirstAttribute bind as I'd expect (if I didn't know it's a method), but Attributes does not, despite being a member of XElement, just like the others. I know about IValueConverter, and I'm using that to get the binding I want on attributes, but I'm curious as to why it works on Elements. <Window x:Class="WpfApplication6.Win...

Why can't I set SelectedIndex on a data-bound ComboBox?

I have two ComboBox elements, one with databinding and one without. On the one without I can set the SelectedIndex fine. But on the one that is databound, if I set the SelectedIndex, it says, "AG_E_INVALID_ARGUMENT". But if I set it to a value in the ViewModel (SelectedIndex="{Binding SelectedCustomerIndex}") then it says "Object refe...

Why does WPF databinding swallow exceptions?

I recently wasted a lot of time trying to debug a WPF datagrid (from the WPF Toolkit). I had a column bound to a linq query with a property that was throwing an exception (in a few rows). WPF seems to catch the exception and it just makes the cells blank. I have fixed the bug causing the exception, but I would like to change WPF's behavi...

Databinding with a custom object to datagridview - Column Header Text

Hi, I have an list of objects (PrintJob) that I bind to a DataGridView. Here is a cut down version of the PrintJob object (Don't want to bore you completely!!): public class PrintJob { private long pagesToPrint; public long PagesToPrint { get { return pagesToPrint; } } private long...

Is it possilbe to use attributes to automatically raise an event on a property change

I find myself writing this code a lot: private int _operationalPlan; public int OperationalPlan { get { return _operationalPlan; } set { _operationalPlan = value; RaisePropertyChanged(); } } private void RaisePropertyChanged() { ...