databinding

Key press inside of textbox MVVM

I am just getting started with MVVM and im having problems figuring out how I can bind a key press inside a textbox to an ICommand inside the view model. I know I can do it in the code-behind but im trying to avoid that as much as possible. Update: The solutions so far are all well and good if you have the blend sdk or your not having p...

Usercontrol Custom Property Binding

Hi, My question is conceptually simple but seems not working in the xaml Question: I have two usercontrols in my mainPage. My requirement is, In the mainpage, i am using two usercontorls, usercontrol1 is textblock and usercontrol2 is button. In the Usercontrol2.xaml.cs, I have a Button_Click event which gets some value(say ID)as a pr...

Get binded value from class property, DefaultBindingProperty is not working for me!

Hello, I'm creating some entities (class) for my project and I want to set a default binging property for it, here is an example namespace MyNamespace { [System.ComponentModel.DefaultBindingProperty("Name")] public class Person { public int ID { get; set; } public string Name { get; set; } public int ...

FormView not passing a value contained within "runat=server" row

I have the following code in the EditItemTemplate of my FormView: <tr id="primaryGroupRow" runat="server"> <td class="Fieldname">Primary Group:</td> <td><asp:DropDownList ID="iPrimaryGroupDropDownList" runat="server" DataSourceID="GroupDataSource" CssClass="PageText" DataTextField="sGroupName" DataValueField="iGroupID" SelectedValu...

DataRepeater without subcontrols

What is the right way to do this in a datarepeater control? <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <strong><%= Eval("FullName") %></strong><br /> <p> <%= Eval("Summary") %> </p> </ItemTemplate> ...

.NET DataBinding, Confirmation before removing items from the list

Hi, i have a BindingList as a datasource and a grid control, if the user deletes a row in the grid, i want him to get a confirmation (a messagebox for example), the grid control i'm using (and i guess most of them), call the RemoveAt(int index), method of Collection which has a void return value, even if i'll inherit from bindingList, o...

WPF: listview SelectedIndex returns -1 if binded data is updated?

I'm displaying data in a ListView. The data (gotten through a DLL and set in an ObservableCollection) is updated every 3 seconds using a TimerCallback. I'm using data-binding between my ListView and the data. I'm adding right-click menu for the list view items. It seems like when the data gets updated, my listview's SelectedIndex wil...

Silverlight - how to programmatically select items in a data bound ListBox?

Hi all, I have a ListBox (AvailableDevicesListBox), which is populated using data-binding in Silverlight 3. The binding is to a collection of objects of type DeviceDTO. It is set up to allow multiple selections, and this all works fine. However, I'm trying to get a 'Select All' button working, and if I iterate through the AvailableDe...

WPF binding with explicit conversion.

Hello everyone, My question may be a repeat of other conversion question but I feel mine is different. Here goes... [simplified example]. public class DataWrapper<T> { public T DataValue{ get; set; } public DataWrapper(T value) { DataValue = value; } public static explicit operator DataWrapper<T> (T value...

How to bind an Asp.NET details view to an object with a List<string> property

I have the following example entity object class Entity { public string Name { get; set; } public IList<string> Fields { get; set; } } Now I have a details view bound to a datagrid and both can display/edit the name property fine, but I want to be able to edit the fields property as well. I was hoping to use a multi-line textb...

Is binding from two datasources possible?

Hello, I would like to know, if it is possible to do something like this in XAML. <Binding Source="{StaticResource baseData}" XPath="/baseData/nodes[@value={StaticResource actualData},XPath=/actual/node}]/text" /> The code-example ist not possible. But how could I select a node from baseData with the value of the node /act...

Inject Index of Current item when binding to a repeater

I am binding a List<HtmlImage> to a repeater Its actually a nested repeater and the list is one of the properties that the parent repeater is binding to I want to spit out the index of the current dataitem into the id property of the <li> I've put a comment where I want the index to appear below I have the following: <asp:Repeater...

Databinding property of multiple objects

Hello dear programers, how u doin? I have a problem. I want to bind multiple objects to a single textbox for example. Lets say I have a list with many tasks. Each task contains a title. public class Task { public string Title { get; set; } [...] } Now I want to select two tasks in a listbox. If the title of both tasks are the same I ...

A good collection to use when binding to a DataGridView in C#.

What would be the best collection to use when binding a list of data to a DataGridview in C#? I'm currently using just a Generic List but the data grid doesn't update when there is objects added or removed from the list. I've looked at using a BindingList or a ObservableCollection, but can't decide which would be best to use that would...

advancedDataGrid with two providers

I want to have 2 dataproviders for 1 advancedDataGrid: 1 normal and second one for combobox in a one of columns. I want to have this combobox to have data from a column in database (i already have it in arrayCollection). I just don't know how to provide data for comboBox in a way that it doesn't have to read that data from database every...

DataBinding of a UserControl via ControlTemplate

Hello, I'm playing around with the Infragistics xamDataGrid. I'd like to display in a "Field" (= Cell) a custom UserControl and have for it the Field's DataContext. Somehow the DataContext is always null :-) Here is the XAML: <UserControl.Resources> <Style x:Key="MyTestUserControl" TargetType="{x:Type igDP:CellValuePresenter}"> ...

WPF: simple TextBox data binding

I have this class: public partial class Window1 : Window { public String Name2; public Window1() { InitializeComponent(); Name2 = new String('a', 5); myGrid.DataContext = this; } And I want to display the string Name2 is a textbox. <Grid Name="myGrid" Height="437.274"> <TextBox Text="{Binding Path=Name2}"/> </...

Why does .NET read values of unaffected properties on reception of INotifyPropertyChanged.PropertyChanged event?

Hi everyone! I'm new to data binding and encountered the following oddity today which I fail to understand: I have a form with two labels (labelA and labelB) and two buttons (buttonA and buttonB). The form hosts an object (called "formState") with two properties (CountA and CountB). labelA.Text is data-bound to formState.CountA, labelB...

What's wrong with my datatrigger binding?

I have created an attached property to extend a Button class with additional state: <Button v:ExtensionHelper.OperationMode="{Binding MyObject.OperationMode}" Command="{Binding MyObject.Select}" Style="{StaticResource operationModeControlTemplateStyle}" /> Then I want to acces this value in the controltemplate using Datatriggers like ...

Silverlight, databinding on a list and then changing that list, how to update?

Hi i have a List where myclass have a name property, nothing fancy (for now). I have two way binding on the name and want the same on the list, that means that if i remove or add a new item to the list i want my ui to reflect this, how to do this? ...