databinding

WPF dependency property setter not firing when PropertyChanged is fired, but source value is not changed

I have an int dependency property on my custom Textbox, which holds a backing value. It is bound to an int? property on the DataContext. If I raise the PropertyChanged event in my DataContext, and the source property's value is not changed (stays null), then the dependency property's setter is not fired. This is a problem, because I w...

ToolStripComboBox.SelectedItem change does not propagate to binding source

My binding is set up as this: _selectXAxisUnitViewModelBindingSource = new BindingSource(); _selectXAxisUnitViewModelBindingSource.DataSource = typeof(SelectXAxisUnitViewModel); _selectedUnitComboBoxBindingSource = new BindingSource(); _selectedUnitComboBoxBindingSource.DataSource = _selectXAxisUnitViewM...

Grails - Removing an item from a hasMany association List on data bind?

Grails offers the ability to automatically create and bind domain objects to a hasMany List, as described in the grails user guide. So, for example, if my domain object "Author" has a List of many "Book" objects, I could create and bind these using the following markup (from the user guide): <g:textField name="books[0].title" value="...

WPF: Is it possible to nest TreeView items with a binding expression?

Lets say I have the following data: <XmlDataProvider x:Key="Values"> <x:XData> <folder name="C:"> <folder name="stuff" /> <folder name="things" /> <folder name="windows"> <folder name="system32" /> </folder> </folder> </x:XData> </XmlDataProvider> How can I get that into a treeview? I can't...

Setter for Canvas.Left and Canvas.Top readwrite in WPF but not in Silverlight 4, why ?

Hi, I have the following XAML, which works fine in WPF, but not in Silverlight 4 <ItemsPanelTemplate x:Key="ContentListBoxItemsPanelTemplate"> <Canvas/> </ItemsPanelTemplate> <DataTemplate x:Key="ContentListBoxItemTemplate"> <Border CornerRadius="15" Width="150" Margin="3" Height="300"> ...

ASP.NET Repeater datasource bound to a function. Would it call the function twice?

In the code behind I have a function that returns a List(Of SomeClass): rptRepeater.DataSource = SomeFunction(SomeVariable) rptRepeater.DataBind() In the html I have a basic repeater layout and am using the below code to get the Properties of each object returned. <%#Databinder.Eval(Container.DataItem, "Parameter1")%> My question is...

How to Bind Data to an ASP.NET ListBox Control?

How can I bind data from a database to a ListBox control in ASP.NET? ...

Eval(), can only be used in the context of a databound control Error. Why it happens? What can I do about it?

Hi there, I am getting the following error, Using asp.net and nHibernate. Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I have this listview <asp:ListView ID="CurrentHourList" runat="server" ItemPlaceholderID="itemPlaceholder"> <LayoutTemplate> ...

Customize WPF databinding: How to add custom logic?

Hi, i have a question regarding some complex data-binding. I want to be able to update a grid (which has the property "IsItemsHost" set to true) dynamically whenever a data-binding occurs. Actually i am using a CustomControl which is an ItemsControl and this has the Grid in its ControlTemplate. To be more specific, i bind the grid to ...

ListBox SelectedItems Binding

I want to bind Listbox selectedItems to array. But .NET throw exceprion in runtime. d.SetBinding(ListBox.SelectedItemsProperty, new Binding { Source = SomeArray }); Where "d" some ListBox from XAML. Exception: Selected Item cannot be bound. Why? ...

Databinding question: DataGridView <=> XDocument (using LINQ-to-XML)

Learning LINQ has been a lot of fun so far, but despite reading a couple books and a bunch of online resources on the topic, I still feel like a total n00b. Recently, I just learned that if my query returns an Anonymous type, the DataGridView I'm populating will be ReadOnly (because, apparently Anonymous types are ReadOnly.) Right now, ...

WPF: Selecting the Target of an Animation

I am trying to create a simple (I think) animation effect based on a property change in my ViewModel. I would like the target to be a specific textblock in the control template of a custom control, which inherits from Window. From the article examples I've seen, a DataTrigger is the easiest way to accomplish this. It appears that Windo...

Master Detail Detail with Business Objects (2 Questions) Win Forms

I have a ListBox and 2 DataGridViews. I have an Object which has [Serializable] public class Process { ... public string ProcessName { get; set; } public List<Step> Steps { get; set; } } [Serializable] public class Step { ... public List<StepEvent> StepEvents { get; set; } } [Serializable] public class StepEvent { ... ...

How to use SqlDataSource for filling combobox as well as datatable or Dataset

I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="C...

Image Source binded to missing file

How can I display a default image when the binded path file is missing? <Image Source="{Binding DisplayedBook.ImagePath}" /> My solution: Used a converter, which check if the image exists and returns the appropriate path. ...

C# ASP.NET Binding Controls via Generic Method

I have a few web applications that I maintain and I find myself very often writing the same block of code over and over again to bind a GridView to a data source. I'm trying to create a Generic method to handle data binding but I'm having trouble getting it to work with Repeaters and DataLists. Here is the Generic method I have so far: ...

Cannot edit values of DataGridView bound to a BindingList

Hello community, I have trouble editing a databound bindinglist. Let me illustrate it with the following: Say I have the Person class: public Class Person{ private string m_firstname; private string m_lastname; public string FirstName{get;set;} public string LastName{get;set;} public Person{ ... } } I then have a containin...

Parent-Child relation while using object data source

Hello guys I am experiencing with a class generator I've written, which generates a class for each table in database with each table field as a property and such. Before that, I used to add a typed dataset to the project and add some tables to it. It automatically detected the relationship between tables and when I added a parent table a...

how to bind ComboBox with DataTable

Hi, I have the DataTable with following columns: id, Name, Description, ParentId and would like to create a WPF control (.NET 4.0 framework) which implements a combobox which displays the names which are bound to values of id. So when the user selects a name displayed in the combobox the behind logic has to retrieve its id value. I w...

Manipulating DisplayMember before it is displayed

Let's say I am using databinding like this: List<Entity> Entities = <some data> entityBinding.DataSource = Entities; lstEntities.DisplayMember = "Description"; which works fine. However, I want to manipulate the string coming back as the Entity's "Description". How can I call a function on DisplayMember? ...