databinding

wpf observableCollection

I have an ObservableCollection which is dataContext for my treeview when I try to remove an Item from ObservableCollection I will get an error that Object reference not set to an instance of an object . can you please tell me why this error is happening and what is the solution thanks EDIT 1: The code is something like : class MyClass...

Data Binding, DataTemaplates and DataSets... Data Bound TextBox not Updating Underlying Source?

Hi Guys In my WPF App I've got a ListBox. This ListBox is bound to a Dataset(i used the Click-Drag Method onto the Window). The Listbox has a DataTemplate, and the Elements(TextBox's) of this DataTemplate is Bound to the Columns of the Dataset. All works well, the ListBox displays the information correctly. The Problem i'm having is w...

Cannot bind to list<T>.property or list<T>.item.property in details section of Telerik report

I have created a Telerik report and I am setting the datasource on runtime to an object with some properties and a List. I am using the properties in the page and report header sections and i want to use the list as the details. Now the problem is binding to the List's item properties in the details section. I have played around with the...

Custom Repeater with hiractial Databinding

Im using a Custom NestedRepeater Control for ASP.NET which can be found on code project The source is in c# which i have converted to vb and plugged into my solution, so far so good. The problem, im having is databinding to the repeater, my code behind looks like this... '' get all pages Dim navPages As DataSet = Navigation.get...

Can I temporarily prevent manual changes to a DataGridView from updating the underlying data source?

I tried to find another question like this one, since it certainly seems like something that may have been asked before; but I couldn't find it. Basically, I've got a DataGridView, which is bound to a BindingList<T>. I understand that in general, data binding is very nice and saves a lot of (our -- developers') time. However, there is a...

C# data binding to a struct - easily achievable?

Hi, I face the following problem. I want to bind a C# struct with least effort to a grid control. The grid control should show the struct members (the variable names and the value strored in the variable) i.e. let's say I have a struct like the following struct A { string name; int value; } A.name="huhu"; A.value=3; I would want t...

database text field databound to a checkbox

I'd like the field to save as a 1 or 0 instead of 'True' or 'False' in the database and i cannot figure out how to do it without manually setting every property when the record is saved. I have to use this a lot in this project and a bit field is not an option. I would like to solve this issue by extending the CheckBox control if possibl...

How to bind entity model to WinForms DataGridView with specific column names?

Currently I am doing: var items = from t in entity.Items select new { Name = t.ItemName, Description = t.ItemDescription }; myDataGridView.DataSource = items.ToList(); The problem is that when bound to the DataGridView, I get two columns of "Name" and "Description". I want to rename these to "Item Name" a...

How to databind a textbox to a DB field using LINQ to SQL, the right way?

Currently I'm writing an ASP.net webforms app, which works with a table containing 15 fields. I'm using LINQ to SQL which is very good to use and everything, but when i need to bind the fields with the text boxes (15 of em), whats the best way currently I'm doing this ... ... var stud = db.Students.SingleOrdefault(d => d.ApplicationNo =...

ObservableCollection slicing using lambda

I have ObservableCollection<ViewUnit> _myItems field, where ViewUnit implements INotifyPropertyChanged. ViewUnit has Handled : bool property. The main view of WPF application has a ListBox which binds to _myItems. I want a separate view of non-handled items only, that is, to have an IObservableCollection<> depended on existing _myItem...

WPF binding Ancestor object as CommandParameter

I have a Custom usercontrol that I want to enlarge. I tested this whit a function call on MouseDoubleClick and it worked fine. Code: XAML <cc:UserControl ItemsSource="{Binding Path=DataItem}" MouseDoubleClick="UserControl_MouseDoubleClick" /> CodeBehind c# private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs ...

How can I set the SelectedIndex in a ComboBox having element binding?

Hi, I have two ComboBoxes, one for Organisation and one for Region. When selecting Organisation I want the Region combobox to update itself with the related regions. After selecting Organisation and Region I can type in a Site to a textbox and store it to db (ADD mode). I've completed that with this code: <ComboBox x:Name="cbOrganisatio...

C# DataBinding collection question

Assume I have a collection of items and want to bind them to a ComboBox/ListBox. In this case Combo/ListBox will contain all items from the collection. What if I want to add some other items to the ComboBox/ListBox which are not the part of the collection itself. For example, I have a collection of numbers(1,2,3,...,10) and want my Combo...

.Net bindingcontext update method

Hello, I'm using databinding (through LINQ to SQL) in a C# form and I need to know how to update the BindingContext when a new item is added to my Table. More specifically, I have form that displays the properties of a project in various fields. The user can traverse to different projects through the project name combo box. At the ...

Does Silverlight 4.0 support bindings in a style setter?

I am trying to port an application from WPF to Silverlight but it fails on some very simple binding. I have the following simple example: <ListBox > <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="Canvas.Top" Value="{Binding X}"></Setter> </Style> ...

How can I pass data back from my XAML to my binding source?

Hi, I've XAML that looks a bit like this: <UserControl x:Class="MyNamespace.MyClass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas...

Set Shortcut key for ToggleButton with Image content

I've created a ToggleButton to show and hide a piece of UI and I've sent its Content to an icon. I now want to add a shortcut key to the ToggleButton but I'm unsure how to do with without binding a command as well. Since all I am doing is binding to the IsChecked state, I don't need a command to do any other functionality and creating a...

What is the use of ContextBinding in vb.net?

I am trying to bind nested object to a datagridview in vb.net. and somewhere i found referring me contextbinding. I searched but didn't find any good example and desription of it. can anybody help me with this one for binding nested class object to a datagrid Edited: to add link http://msdn.microsoft.com/en-us/library/system.windows.f...

TextBox TextChanged event does not fire when Visible = False?

I have a textbox bound to a datasource. The textbox's TextChanged event updates another textbox. The problem is, I do not want the first textbox to show, so I set its Visible property to false. However, now the TextChanged event does not fire! I can work around it by setting Visible=True, Left=-100000 on form load, but I'd like a pro...

Convert strings to Java objects automatically

I want to convert user input that comes as Map<String, String[]> to objects in Java. More specically I want to convert the params of a HttpServletRequest to the fields of an arbitrary domain object. I'd like to have something like this: Domain d = Converter.convert(params, new Domain()); If there is more than one element in the strin...