databinding

Close SQLDataSource Connection

I bind a SQLDataSource to a GridView using GridView.DataBind() and these queries often take a significant time to execute. What code would cancel an in-progress DataBind()? I can't seem to find any method to stop the DataBind() or even close the DB connection. Rebind Attempt: myConn.ConnectionsString = "" myConn.SelectCommand = "" ...

C# BindingNavigator Issue

I built a form to allow users to edit database records and all the data binding works and the saving works. However, when I add a new record to the underlying bindingSource with the "Add" button on the bindingNavigator and I try to navigate to the new record the "Next" and "Last" buttons on the navigator don't work, yet the "Count" was ...

Data bound WPF ComboBox with choices defined in XAML?

On my viewmodel I've got an int property and I want to expose it for editing with a ComboBox, with a limited set of choices, such as 16, 8, 4 and 2. Is there a way to specify the choices in the XAML, while still binding the value back to the viewmodel? I'd want to do something like this: <ComboBox SelectedValue="{Binding MyIntProperty}"...

What control should you databind a List<string> to?

I have an object with a simple property: public class obj { /* ... */ public List<string> EMails { get; set; } /* ... */ } All of the other properties on the object are simple strings or ints, and they databind well to textboxes/updowns and so forth, but I'm having trouble binding this List. The UI doesn't have any control...

Binding-Target never gets set in custom objects declared in *.resources; binding evaluation fails

I have a xaml view like this: <Tv:TvPanel xmlns:Tv="..."> <Tv:TvPanel.Resources> <Tv:Parameters x:Key="parameterList"> <Tv:ParameterDefinition ParameterName="MyParam" InitialValue="123abc"> <Tv:ValueBinding Value="{Binding ElementName=myTextBox, Path=Text}"/> </Tv:ParameterDefinition> </Tv:Parameters> <Tv:TvXmlDataPr...

DomainDataSource, binding and cursors

Databinding in WPF/Silverlight revolves around dependency properties, DataContext objects and DataSource objects. As far as I can tell, dependency properties are the same thing as ambient properties and their significance to binding is basically that if you put a bunch of widgets in a container then you only need to specify a DataContext...

Silverlight TextBlock Visibility property inital value before binding is applied

I Have a TextBlock on Silverlight Page. XAML <TextBlock Text="*" x:Name="HasChangesTextBlock" Foreground="Red" FontSize="14" Visibility="{Binding Path=HasChanges, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="5,0,0,0"> </TextBlock> Page loading takes few moments. And before binding i...

How to enforce jsf to create new instance of bean instead of throwing NullPointerException?

I'm almost sure that I do something wrong and thus the question's title is a bit incorrect. I have a form with several fields for creating a new User-objects (fields like login, password, birthday etc). And I have 2 buttons - Cancel and Create. I didn't finish Create yet :) , but when I press Cancel I see NullPointerException. Here is s...

WPF: displaying XML attribute as a checkbox

I have this XmlElement, and add some attributes to it: xmlElemMux.SetAttribute("test1", "1"); xmlElemMux.SetAttribute("test2", "0"); I can display those in a window using a textbox like this in the xaml, after setting the DataContext of my grid to xmlElemMux: TextBox Text="{Binding XPath=@test1}" TextBox Text="{Binding XPath=@test2}" T...

WPF Listview databinding to generic List, dynamically filled by WCF service

In WPF app I have a WCF service which dynamically fills a generic List object from a backend database. How in this case (List created in runtime), I could bind List items to a ListView object items? It is the Data contract for my Web service: .... [DataContract] public class MeetList { [DataMember] public string MeetDate; ...

Using a Dictionary in a propertygrid

I'd like to edit a list of key value(string, string) items using a propertygrid. When I use a Dictionary<string,string> as type the propertygrid will show a GUI, but it does not seem "enabled", ie. I can't add any items. Is the Dictionary object supported, or is there any other object with which I could solve this problem? ...

Using Windows Forms Combo Box with List<KeyValuePair<UserEnum,String>> as DataSource - C#

I'm currently working on a Windows Forms GUI and I have a Combo that I need to display a list of string values as the DisplayMembers and use a list of user defined enum values as the ValueMember. I'm currently returning a List> from my database access function and I would like to bind this to my Combo box. I've tried assigning the list t...

Basic WPF databinding question

I have another WPF databinding question... one that I haven't found an answer to anywhere, and this surprises me since it seems like it is very basic. Essentially, I have a string in code behind that I would like to establish a two-way binding with with a textbox in my GUI. I thought it was a simple matter of creating a DependencyPrope...

How can I bind a property of a user control to a properties of that same control in WPF?

Inside my user control I have a collection call Solutions public List<string> Solutions { get; set; } I want to bind that property to a combobox in xaml of that same user control? I tried <ComboBox HorizontalAlignment="Left" Margin="21,0,0,41" Name="cbAddSolution" Width="194" Height="21" VerticalAlignment="Bottom" It...

Passing complex object from view to controller/view in ASP.NET MVC

In my MVC application I have a problem with passing data from view to controller. I have fairly complex domain classes: public class TaskBase : PersistableObject { public virtual TaskCategory Category { get; set; } public virtual IList<TaskNote> Notes { get; set; } public virtual string TaskTitle { get; set; } public vir...

Silverlight MVVM: how to avoid polluting my model while still implementing "add new item" for my datagrid?

I have a DataGrid. Right now it's binding to an ObservableCollection<Foo> in my model just great. But now I want to implement a user-friendly way to add a new item to the datagrid. It seems like I'll need to modify Foo to inherit from IEditableObject and INotifyPropertyChanged, which is kind of icky from a MVVM perspective in my mind---...

Binding to CurrentItem in a ItemsControl

The XAML below is basically trying to make a list of Buttons (rendered from the 'Name' property of objects in the "Views" collection in the current data context. When I click on a button the CurrentItem property of CollectionView source should change and the associated View should be displayed in a content presenter. OK. If I click in...

Binding to a const field in Silverlight

I have a situation where some application wide values are stored as constants - this is a requirement as they are needed in attribute definitions (attributes must resolve at compile time, so even static members don't work). I wish to also be able to also reuse these values in XAML files. So if I have my constants like this: public clas...

wpf how to tell when databinding has finished?

Hi, I've got a custom control which has a DependencyProperty MyAnimal - I'm binding an Animal Property on my ViewModel to the MyAnimal DependencyProperty. I've stuck a TextBox on the Control so I can trigger an Event - whenever I trigger the event the MyAnimal property has been set - however if I put a break point on the Setter of the ...

Wpf Combobox DataBinding

hello everyone it is me again! i've got few problems too. i am deveoping an training software that's why i am asking lots of questions.i hope you help me. thanks in advance. my problems are as follows: First of all: i have a register window that has a combobox. i have binded it an access datasource. the problem is when i select an it...