twoway

Two way data binding in a GridView

We have an app that uses simple one way binding with a GridView to display some data. Well, now we need to allow the user to change some of that data, so I've been trying to get two way data binding to work in the GridView. So far everything displays correctly, but editing cells in the GridView seems to do nothing at all. What am I messi...

Why is two-way binding in silverlight not working?

According to how Silverlight TwoWay binding works, when I change the data in the FirstName field, it should change the value in CheckFirstName field. Why is this not the case? ANSWER: Thank you Jeff, that was it, for others: here is the full solution with downloadable code. XAML: <StackPanel> <Grid x:Name="GridCustomerDetails"> ...

How can I bind an ObservableCollection to TextBoxes in a DataTemplate?

I am trying to successfully TwoWay bind an ObservableCollection to TextBoxes in a DataTemplate. I can get the data to display properly, but I am unable to change the list data through the UI. I have a Model class named 'model' which contains an ObservableCollection named 'List'. The class implements the INotifyPropertyChanged interface. ...

WPF two-way binding: how do I update a TextBox with a formatted version of the value it just set?

I have a class, called DateField, that has a string Value property. If you set this property to a string that can be parsed into a valid date, the property setter sets Value to the properly formatted date, e.g.: private string _Value; public string Value { get { return _Value; } s...

How to Get Dictionary TValue from TKey in C#?

Hi, I declared the dictionary obj. Dictionary<string, string> aDict = new Dictionary<string, string>(); aDict .Add("IP", "Host"); As I remembered, The expression of aDict[IP] can return the value (Host). Now if I go in the opposite direction. How to get the Key from Value ? aDict[Host] ? Does the Dictionary is a one-way...

Bind a control to a single value in a collection/array in WPF

Hi there In WPF I have a collection of bool? values and I want to bind each of these to a separate checkbox programmatically. I want the bindings to be TwoWay so that changing the value of the individual item in the collection in code updates the check box and vice versa. I have spent ages trying to figure out how to do this and I am c...

twoway multibinding validation

Hi, i have this case where there is a multibinding for ex, textbox1 which value depend on textbox2 and textbox3 and the binding is two way, all textbox applied the same validation rule for ex error if minus. somehow if textbox1 got updated the textbox2 and textbox3 validation will fire. but when either textbox2 or textbox3 updated, tex...

WPF Bind User Control Coordinates

Another beginner WPF question from me :) Ok, so I have a User Control added to a Canvas. In another area of the application I have two TextBoxes that will get 2 values : X and Y. I need a two-way binding between the user control's top left corner coordinates and those 2 textboxes. I don't mind implementing a Converter or doing some cal...

Can I use ANTLR for both two-way parsing/generating?

Hi all, I need to both parse incoming messages and generate outgoing messages in EDIFACT format (basically a structured delimited format). I would like to have a Java model that will be generated by parsing a message. Then I would like to use the same model to create an instance and generate a message. The first half is fine, I've us...

C# MVVM TreeView TwoWay-Binding of hierarchical data

I googled for an answer to this for more than two weeks now. This usually means either I am blind or the idea is absurd. Anyways: In a middle-sized, quite flexible project I'm storing configuration data in a hierarchical structure in the like of this one: Configuration (collection) Audio (class) BaseDir (struct) PlayMode (enum) Inpu...

Add editing to MVVM in a hierarchical data structure

This question is a follow-up of this older one, and it's more of a confirmation than an open question. My ViewModel instance has a private instance of the Model, _modelInst. The ViewModel has exclusive access to the Model's data during editing (so the Model doesn't need to implement INotifyPropertyChanged). Now there are three ways I c...

Simplify/Neatify this two-way loop?

I've got my wires crossed somewhere (or I had not enough sleep). I need a two-way loop, and my current code is just plain ugly. Problem: I am running along a linear datastructre using an index. I have an starting index, lets say 120. I want to run alternating into both directions. Example: 120,121,119,122,118,123,117,... I have a sto...

wpf twoway binding and update from code-behind...

Hi, I've ToggleButton defined like this in XAML: <ToggleButton IsChecked="{Binding DateFilter, ElementName=myUserControl, Mode=TwoWay}"/> and 'DateFilter' defined like this: public Boolean DateFilter { get; set; } When I click the toggle-button, 'DateFilter' updates accordingly. BUT, if I modify 'DateFilter' in code, the ToggleB...