databinding

WPF Non-Nullable Databinding to default a cleared TextBox?

I have a WPF Textbox, with the Text property bound to an int value (non nullable). When the form loads, the text box has a 0 in it. Is there any way to make this textbox default to empty? I was setting the value to null in the code behind when the form loads, but it seems that in places, this is throwing errors that are being hidden t...

Sync services doesn't always update dataset

Hi, I am building an occasionally-connected WinForms application and have been following link text tutorial. When using a datasheet to edit data, as the tutorial has me do, everything works fine. If, however, I bind the data to other controls on my form, the data is not saved. For example, I am tracking StaffID, FName, and LName. ...

How to bind datagridview, combobox and bindingnavigator?

Hello! I have a small/big problem... I'm tring to bind some comboboxes, datagridview and bindingnavigator. My situation: I load all table and data from different tables into ONE DataSet! Let's say there are tables "MAIN_TABLE" and "COMBO_TABLE". then I'm doing this: DataViewManager dsView = dataSet.DefaultViewManager; ...

WPF binding set before application starts does not notify?

In theory this code should provide me with a 300x300 window with a blue background from having the window's content bound to an object of type AstRootViewModel, however this doesn't seem to be the case. I'm wondering it this is happening because I don't call astApplication.Run() until after I set the mainWindow.ViewModel property. Usin...

How to Put One WinForms User Control on Three Forms and Update All Three Simultaneously?

How to Create a UserControl which for example 3 winforms and 1 UserControl, adding UserControl to all forms but if user by click in one of the forms changed UserControl content, all forms display the same changes. Edited I think it working now. the dark area is the usercontrol with some content ...

How to style different items differently when using data template in xaml?

I would like my elements generated from datatemplate to look differently depending on some properties in the model. For example I want to display the text in various colors or present different images or path drawing for each generatred element. I know how to do it in general, but I'm looking for a solution that would allow editing the v...

Best practices for sharing a property among items of an items control

Lets say I have an ItemsControl in a Canvas. Each Item will have its own position, but I want all items to share that same width. So if the user changes it in one place, all items get updated. What is the cleanest way to do this? Right now I see 2 solutions. Whenever the settings change, I update the width property for each item. Th...

DataBinding Problem

Hello all, Im having this strange problem with DevExpress LookUpEdit.DataBinding.Add(), while i tried it at first was working in a couple of controls, then started to programming for all the controls i have and everything stopped woriking. The DataSource is a BindingSource of 1 object and the lookupedits are populated with different Lis...

WPF data bound ListView/ListVBox won't select if list only has one item

So this is pretty mystifying. I have a databound ListBox (or ListView, it happens with both), and if it has more than 2 items in it, selection works - I get a blue highlight bar and the item looks selected. If I only have 1 item, the selection does not work - I do not get a blue highlight bar, but the selection events all fire as normal....

Why isn't this Silverlight attached property working?

I'm trying to use the MVVM pattern in my Silverlight 3 application and am having problems getting binding to a command property of a view model working. First off, I'm trying to add an attached property called ClickCommand, like this: public static class Command { public static readonly DependencyProperty ClickCommandProperty = ...

Ajax data two-way data binding strategies?

I'd like to 1) Draw create form fields and populate them with data from javascript objects 2) Update those backing objects whenever the value of the form field changes Number 1 is easy. I have a few js template systems I've been using that work quite nicely. Number 2 may require a bit of thought. A quick google search on "ajax data bi...

Databinding with WPF

I want to bind a button's width to some textbox's text value, although I want to always have a button width's that's twice what is written on the textbox. This is: textBox1.Text = 10 will set button1.Width = 20 Can I only do this through ValueConverters or is there other way to do it? Thanks ...

Using Value Converters in WPF without having to define them as resources first

Is it possible to use value converters without having to define them beforehand as resources? Right now I have <Window.Resources> <local:TrivialFormatter x:Key="trivialFormatter" /> </Window.Resources> and <Button Width="{Binding Width, ElementName=textBox1, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource trivialF...

Flex: How can I Make changes to an ArrayCollection bound to data grid live?

Hi guys, I have an ArrayCollection bound to an editable DataGrid, another component needs to know when the ArrayCollection changes (as a result of changes in the DataGrid) so it can also update itself, so is listening to the COLLECTION_CHANGE event of the ArrayCollection. The problem is that the DataGrid only updates the ArrayCollectio...

Databinding to a method in WPF

I am having trouble databinding a TextBox.Text property to a object's method. The ideia is allowing the user to write in a textbox a file name and then have a TextBlock output that file's extension. class GetFileInfo { public string GetFileExtension(string fileName) { return Path.GetExtension(fileName); } } Here is...

Sorting a databound Silverlight DataGrid

I have a databound Silverlight DataGrid control that I am trying to sort. I am using RIA services (beta) for my data source, if that makes any difference. I am quite new to databinding in Silverlight, so this might be something really obvious that I've missed, but I can't seem to find any info on it. I want to be able to set the binding...

Best way to link UI elements with backing javascript objects

This is a rephrase of a post I made last week. I was surprised I didn't get more of a response, thinking maybe I didn't describe/title it very well. Simplest possible way to describe it: Is there something like spring:bind for javascript/dhtml? The high level view of what I want: In my app, I have a list of "subscriber" objects whic...

ObjectDataSource databinding: Getting object properties following Select Method call.

I am using an ObjectDataSource control to call a MapInfo object. This object has two properties: public IList Visits public int TotalAvailable The select method returns an IList but the TotalAvailable property is also populated. I have set the TypeName in the ObjectDataSource to the MapInfo object but because the Select method only r...

Why is binding refresh delayed until completion of delegate Command? (MVVM)

I'm applying the MVVM pattern. I've got a button which, when clicked, invokes a delegate Command in my ViewModel. At the very start of that delegate method, I set a property value (WaitOn) that should notify the user back in the UI to wait by displaying an animated control. However, the binding to display that animated control doesn...

ListBox not updating in non debug

Does anyone have any idea why my ListBox would not populate when running in non Visual Studio Debug version? When running in debug version(F5) it perfectly fine without any breakpoints, but when I run in non debug(Ctrl+F5) it doesn't get populated. I don't even know where to start regarding this as google shows nothing useful and I can...