databinding

DataSource containing a null value makes ComboBox fail

I've thrown myself headfirst into C# and .Net 2.0 using Linq, and I'm having a few problems debugging some of the problems, namely the following: I have a ComboBox control (cmbObjects) I want to populate with a set of objects retrieved using Linq. I've written a helper method to populate a List<T> generic: class ObjectProvider { p...

TreeListView with Columns generated and populated by ObservableCollection

Does anyone known (or even has an example) of a WPF based TreeListView that can generate its colums by databinding to the ObservableCollection of its tree items? For example the databound model is a tree consisting of Employee instances representing the supervisor hierarchy of a company. Each employee addtionally has a ObservableCollec...

How to call extension methods using Eval in a databound control

I have a simple extension method on the int type so I can do the following: string timeLength = 61.ToTime() // timeLength will be "1:01" This works great in code, but I want to use this extension method in a Repeater Template. When databinding I want to do the following: <%# Eval("LengthInSeconds").ToTime() %> That didn't work so I...

How do you databind to a System.Windows.Forms.Treeview control?

I'm looking at this control, and it seems to be lacking the standard .net "datasource" and "datamember" properties for databinding. Is this control not bindable? I can write some custom function that populates the treeview from a given data source, I suppose, and embed data objects as necessary, but is that the 'best practice'? Or doe...

Where is IsSynchronizedWithCurrentItem property (or equivalent) for a TreeView?

Tell me it ain't so. I have a typical windows/file explorer like setup. Left Side I have a TreeView all data bound showing nodes in a hierachy Right Side I have a ListView showing Node.Properties ListView has a IsSynchronizedWithCurrentItem property, which rocks. e.g. If I had another ListView showing a list of nodes and both listVi...

ASP.Net Localization & Bound controls

When I localize an asp.net page that is using bound controls (DetailsView, etc) that has TemplateFields bound using the <%# Bind() #> syntax, after the localization all of the bindings are removed and I have to go back in & rebind everything. I'm creating the localized resource file by switching to design view, then Tools / Generate Loc...

Why databound ContextMenu items don't hide?

I wan't to hide/show menuitems in a contextmenu using some propery of databound object. But my menuitems don't hide, they behave as if their Visiblity would be set to Visibility.Hidden (not Visibility.Collapsed as it really is), what's the reason of such behaviour? Here's an example: XAML: <Window x:Class="MenuTest.Window1" xmlns=...

Best way to databind a Winforms control to a nullable type?

I'm currently using winforms databinding to wire up a data editing form. I'm using the netTiers framework through CodeSmith to generate my data objects. For database fields that allow nulls it creates nullable types. I've found that using winforms databinding the controls won't bind properly to nullable types. I've seen solutions onl...

MonthCalendar.SelectionRange databinding example

How do you perform databinding against the MonthCalendar.SelectionRange property? Given the property is of type 'SelectionRange' which is a class I am not sure how to go about it. Any examples would be much appreciated. ...

Datacontext Lifetime in WinForm Binding Scenario

This one has been stumping me for a while. But I'm no expert. This is a bit long... I have a WinForms app with an Outlook style UI. That it to say there is a bar on the left hand pane that allows you to select a 'screen' which is a WinForms control, say the customer screen, and on the right hand pane there will appear a list of custo...

In .aspx, how to pass a value from asp:Repeater to code behind function

So, I want to use jquery to set the text of a button, depending on the value of a property in the current row of a repeater. I need to call a function in the code-behind to map the value to the text the button should have. So, I need to pass to my foo function, the string value of the UserStatus property for the current item in the repe...

What is the most efficient way to filter listboxes based on selections of another in c#?

I have several listboxes that get each of their data from a separate stored procedure. If the user selects an option in 1 listbox, it should filter the other listboxes. I have done this before by adding logic to the stored procedure, but sometimes it seems to get very long. Does anyone know of a better way to approach this? T...

Can you add an extra item to a data bound ItemsControl in XAML?

I have an ItemsControl that is data bound to a list of decimals. I need to add one extra control to the ItemsControl (an option to specify the number manually). Is there a way to do this in XAML? I know I can manually add the item in the code behind, but I'm trying to understand WPF a little better and want to see if there is a declar...

How do I implement data binding in an ActionScript Class?

I am having a problem with binding values in my ActionScript components. I basically want to set the value of a a variable in my component to a value in the model, and have the component variable automatically update when the model value is updated. I think that I just don't fully understand how data binding works in Flex - this is not a...

Asp.NET ListView Data Control Dynamically Databind

I am trying to implement a ListView data control for displaying and editing lookup table/ application level variables. There are multiple entity classes which can be bound to the ListView, so the ItemTemplate needs to be dynamically bound to the selected entity object. For example i have: AddressType { AddressTypeId, AddressTypeDescri...

Expanding a node in ASP.Net TreeView through XML Attribute

I have a ASP.Net TreeView control that I am binding to an XML data source. I'm wanting to be able to control which nodes are expanded and which ones are collapsed in the XML definition file. The Expanded='' doesn't work for me though. In the following simple example, I want Node 2 to be fully expanded. ASP Page... <asp:XmlDataSource ID...

I'm new to .NET - what should I concentrate on and what should I ignore?

So, I've had a fair amount of experience programming database driven web apps using php and coldfusion (not together, at different times) and I'm starting to look into the asp.net world (I have a project coming up at work that is all asp.net/c#.) My question is: there seems to be a lot of stuff to get mired in and if I'm just making web...

DataBinding with a DataGridView C#

I have a Database table that I want to display in a DataGridView. However, it has several foreign keys and I don't want to show the integer that represents the other Table to the user. I have this DataTable with a column userId I have another DataTable with a column id, and a column username I want the DataGridView to show the username...

Custom Binding of multiple fileds in Custom DataGridViewColumn(WinForms)

Hello, I have a question regarding a data binding(of multiple properties) for custom DataGridViewColumn. Here is a schema of what controls that I have, and I need to make it bindable with DataGridView datasource. Any ideas or a link to an article discussing the matter? Controls Graph Control(custom): Displayed in the custrom DataG...

How Do I get this ComboBox Hosted in a ListView to update my Collection?

I have a ComboBox hosted in a ListView and I need changes in the CombBox to update the supporing class that the ListView is bound to. Here is my DataTemplate <DataTemplate x:Key="Category"> <ComboBox IsSynchronizedWithCurrentItem="False" Style="{StaticResource DropDown}" ItemsSource="{Binding Source={...