databinding

Silverlight data binding from VM issue

I have a SL 3.0 page with a lot of textblock controls laid out. Each textblock is bound to a property of the Account class. The XAML page codebehind (mypage.xaml.cs) has a OnNavigatedTo method in which the VM instance is created and set to the data context like this: this.DataContext = new VM(); In the VM there is a public property of d...

GridView to refresh when button click updates data

I have a button click event on a page which ultimate updates a table using: protected void Button2_Click(object sender, EventArgs e) { this.AccessDataSource6.Insert(); } A GridView bound to a different AccessDataSource, displays data that is updated by the Insert. What do I need to include in Button2_Click fo...

Why does a string INotifyPropertyChanged property update but not a List<string>?

In the following WPF application, when you click the button, why does TheTitle TextBlock update but FilesCopied ListBox not update? XAML: <Window x:Class="TestList3433.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300...

Is there any way to bind a method to a DataTemplate of a ListBox?

The following example successfully shows the property Title in the ListBox, but is there a way to show method GetTitle() so that I don't have to turn all my methods into properties? e.g. neither of these seem to work: <TextBlock Text="{Binding GetTitle}"/> <TextBlock Text="{Binding GetTitle()}"/> XAML: <Window x:Class="TestBindMetho...

XAML binding doesn't seem to set if the property is initialized in the constructor

Hello, everybody! I've run into a problem with data-binding inside control template while the property is initialized inside the constructor. Here is the show-case (you can also download sample solution): CustomControl1.cs public class CustomControl1 : ContentControl { static CustomControl1() { DefaultStyleKeyProperty...

Why is Linq To Sql databinding to gridview much slower than pass-through SQL?

Hello, I have compared two queries which fetch some fairly large data from a database table. For query one I used Linq To Sql and for the other I use passthrough SQL via ADO.NET. I know that Linq To Sql has to do a lot of work behind the scenes, but what is it actually doing? The two queries fetches the same amount of data but the Linq...

Why does ObjectDataSource.DataBind() return rows, while ObjectDataSource.Select() doesn't?

Hi I thought calling ObjectDataSource.Select() gives the same results as calling ObjectDataSource.DataBind(), but in some cases that doesn’t seem to be true: <asp:ObjectDataSource ID="ODS1" TypeName="PersonDB" SelectMethod="GetPeople" runat="server"></asp:ObjectDataSource> <br> <asp:ListBox ID="ListBox1" DataSourc...

Binding a specific DataRow to a ComboBox?

I have Datatable with two Rows, and on the form I have two Combox Boxes - I want to bind comboBox1 to DataRow 1 and ComboBox2 to DataRow 2. How do I do this? ...

How to bind Flex Effects to the effects target properties?

Hi, I'm trying to reuse effects. To achieve this, i was hoping that i could bind some of the effect's properties to the effect's target. Here's what i wanted to do: <mx:transitions> <mx:Transition toState="Ready"> <mx:Parallel targets="{[b1, b2, b3]}" perElementOffset="200" duration="500"> <mx:Move xFrom="{target.x-1...

How can I change styles of XAML file using Data Binding?

I'm binding a collection of objects to a listbox in WPF, for simplicity we'll say the object i'm binding has 3 propertys: Name, URL, IsBold. What I want to do, is have it displayed different if the IsBold is set to true, again as an example I want to set the TextBlock that Name appears in, to be bold. Is something like this even possib...

Databound Listview in UpdatePanel

Hello I am using a Listview in a usercontrol that I databind to a list of object in the page load event. protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; BindListViews(); } private void BindListViews() { MyListView.DataSource = IncludeExpressions; ...

How do I create a bidirectional data binding in Flex 3?

I need to bind a property to an edit control and have the control write its value back to the same property. The problem is, I'm setting the source value before the control is created: <mx:Panel> <mx:Script> <![CDATA[ [Bindable] public var editedDocument: XML; ]]> </mx:Script> <mx:TextInput id="d...

GridView.EditIndex property

hi 1) If we first set DropDownList.SelectedIndex to some value and then rebind control to data source, it’s SelectedIndex property will be reset to default. So why doesn’t something similar happen with GridView.SelectedIndex and GridView.EditIndex? It seems that unlike DropDownList, GridView doesn’t reset these two properties ( to their...

Data Binding using DataBinder.GetPropertyValue()

Hi – I have a pretty straight forward data binding question (from the side of writing data bindable controls) that has me confused. Looking at the .NET source code, it seems that most data binding is abstracted via the DataBinder.GetPropertyValue() method. This method takes an object and a property name, and the method will find the va...

wpf error validation when binding is not two-way

Hi Guys I have a read only control that displays a calculation from other information in a datagrid. The binding it has works as far as displaying updated data as cell entries are made. I do need to show visually when the calculation is above a given threshold. It is a read-only control (label, actually) though. How can I go about doin...

WPF Object send itself as MultiBinding path.

Basically what I need to know is how to send the source of an HierarchicalDataTemplate into a binding, this is what I have: <HierarchicalDataTemplate DataType="{x:Type myModel:Person}"> <StackPanel Orientation="Horizontal"> <Image Source="Images\User.gif" /> <TextBlock Margin="5,0,0,0" Text="{...

Exposing DataGrid SelectedItem in parent UserControl in WPF

Hi there, I have a User Control with a Data Grid inside it which i re-use in a couple of different Pages and am using M-V-VM. How can I / is it possible to expose the Data Grid's SelectedItem dependancy property as a dependancy property on the User Control which contains it??? The goal being that in a Page using the control, i could ...

Better Practice: CheckBox DataBindings vs CheckedChanged event

I have a CheckBox that, when checked/unchecked will toggle the Enabled property of some other controls. I did have my code looking something like this: checkBox.CheckedChanged += new EventHandler((o, e) => { control1.Enabled = checkBox.Checked; control2.Enabled = checkBox.Checked; }); But today I started playing with DataBin...

wpf: name in one column, TextBox/ListBox/Slider in the other

I would like to display a bunch of settings in a window and offer different ways for the user to set them (TextBox, ListBox, etc). One column has the names of the settings, and the other has the controls. Should I use a ListView for that? Can I use data binding? How do I specify a different control per row in the ListView? ...

wpf data binding for novice

Hi! While learning c# and wpf, i am trying to get grasp of data binding. So far unsuccessful. All the help i could find on the net, even if described as "for beginners", is too complicated for me to begin to understand. I would appreciate if someone can provide a code for binding in a very simple example: namespace BindingTest { cl...