binding

Determing what caused a WPF binding's ValueChanged event to fire

It appears that the ValueChanged and SourceUpdated events will fire simply by setting the DataContext. Does anyone know of a way to tell whether the value changed is actually from some user interaction? A simple example is to have a "Save" button on a WPF form that is disabled until the user actually changes the data. Since both Value...

Changing a constructor param type breaks class in another jar

I have the following class in a common jar: public class Common { public Common(List list) { ... } } I then change the constructor parameter from a List to a Collection as follows: public class Common { public Common(Collection collection) { ... } } Rebuilding the common jar and running the system causes a...

Is there an XPath-like syntax in XAML that can get items out of a collection?

I have a Dictionary object in my ViewModel with key/values that translate words on the View. It is possible to get the language information as an XML object and then pick out the translated phrase with XPath, something like this: <TextBlock DataContext="{TranslatorDictionaryXml}" Text="{Binding XPath=/terms/term[key='edit']/value[@lang...

Why does WPF Binding update strings but not objects?

In the following code example, you can move the slider from German to English and see that text block get translated at runtime, however: only the TextBlock bound to a string gets updated the TextBlock bound to a Dictionary does not get updated It seems that the View simply gets the Dictionary object once and then doesn't update anym...

Checkboxes not updating as expected

I have a listbox bound to a list of business objects. The items in the listbox are formatted using an itemtemplate. The itemtemplate includes a checkbox bound to a boolean property of the business object. When I spin up the app, the bool prop on the object in the list is changed when I click the checkbox. so far, so good. The dialog has...

JComboBox getSelectedItem() not changing

I'm binding a JComboBox to an observable List. I clear and add Objects form the observable list. This works fine and reflects the changes in the JComboBox correctly. The problem is I can't select the content of the list using the mouse although the newly added items are correctly displayed in the combobox when expanded. The getSelected...

What is the correct syntax for using StringFormat with single binding?

I can get MultiBinding to work with StringFormat: <TextBlock.Text> <MultiBinding StringFormat="{}{0} {1} (hired on {2:MMM dd, yyyy})"> <Binding Path="FirstName"/> <Binding Path="LastName"/> <Binding Path="HireDate"/> </MultiBinding> </TextBlock.Text> But what is the correct syntax for single binding? Th...

WPF: Read only say TextBox and binding.

Say I have a grid and I click an object and it displays in a detail screen,And I don't want the user to edit some data so I set the TextBox as disabled? then will binding work.Basically what I want is the TextBox to be greyed or disabled ya know? Well how about it in WPF? Can someone explain? ...

How can I tell my ViewModel that the user is changing text in the TextBox?

So let's say I have an MVVM application and I want the user to fill out a TextBox and while he is filling it out, I want to check to see if he has typed in the last name of a customer yet. Here is how I get my ViewModel to know when the user has changed the item in the ComboBox: <ComboBox ItemsSource="{Binding Customers}" Ite...

Can't update textbox property using DataBinding

I have a custom window which have two depencency properties: Boolean? ValidationStatus, and string ValidationMessage. Binding these properties works fine but trigger doesn't seem to be triggered when these values change. What am I doing wrong? <TextBlock x:Name="validationTextBox" Grid.Row="1" Grid.ColumnSpan="2" Text="{...

How can I get this DataTrigger to work?

I want my TextBox to have a red background if the ViewModel property = "invalid". What do I have to change so this works? This version tells me that Background does not have a qualifying type name. <TextBox Width="200" Text="{Binding FieldEmail, UpdateSourceTrigger=PropertyChanged}"> <TextBox.Triggers> <DataTrigger ...

How to do View/ViewModel binding in MVVM apps so Expression Blend can be used?

When you use the MVVM Visual Studio Template, then your ViewModels are bound to your Views' DataContexts in the App.xaml.cs something like this: MainView mainView = new MainView(); mainView.DataContext = new MainViewModel(); mainView.Show(); And if you use Composite Application Library, then you have your Views and ViewModels being bo...

How can I bind a MenuItem to an ObservableCollection?

I've got this menu bound to an ObservableCollection called MainMenuPageItems, in which there are objects that have a Title property: <Menu DockPanel.Dock="Top"> <MenuItem Header="_File"> <MenuItem Command="{Binding ExitCommand}" Header="E_xit" InputGestureText="Ctrl-X" /> </MenuItem> <MenuItem Header="Code _Generatio...

Bind ContextMenu's MenuItem visibility to ListView selection

I have a user control with a ListView containing simple items from an ObservableCollection. I would like the ContextMenu of that ListView to contain items depending on what's selected in the ListView. If no item is selected, some MenuItems should not be visible. My converter isn't even called when I open the ContextMenu. The binding se...

WCF binding not found error?

Hello everyone, I am using VSTS 2008 + C# + .Net 3.0. I am using self-hosted WCF. When executing the following statement, there is the following binding not found error. I have posted my whole app.config file, any ideas what is wrong? ServiceHost host = new ServiceHost(typeof(MyWCFService)); Error message, Configuration binding exte...

WCF wsHttpBinding 'algorithmSuite' cannot be parsed error

Hello everyone, I am using VSTS 2008 + C# + .Net 3.0. I am using self-hosted WCF. When executing the following statement (host.Open()), there is the following binding not found error. I have posted my whole app.config file, any ideas what is wrong? ServiceHost host = new ServiceHost(typeof(MyWCFService)); host.Open(); Error message, ...

Another DataGrid Binding Question

Hello there! I'm hoping that one of your WPF/DataGrid/Binding gurus can help me out here. I've done a bunch of searching on the subject and while datagrid binding tutorials and tips are plentiful (and I feel like I've read every single one of them), I'm still stumped on this piece. My setup is this: I have an application that has a b...

Non-http Protocol Support in windows xp or Windows Server 2003? (net.tcp)

Will it be possible for windows xp or windows server 2003 to support net.tcp for WCF, well it works in windows server 2008 as IIS 7.0 supports net.tcp,but is there anyway for IIS 5.1 or IIS 6.0 to support net.tcp,is there any workaround for this? ...

Dynamic Binding in C++

Why does the derived class have to declare its methods as virtual for dynamic binding to work even though the methods of the base class are declared virtual? ...

In C#, how can I set DataContext on a View from the ViewModel?

I"m trying to wrap my head around MVVM. I understand a lot of it, but I'm having difficulty grasping one aspect: Setting DataContext. I want to show an view with a particular object. The user doesn't get to decide what is visible, so I need to create the view in code. Then, I want to set the DataContext of the view to an object (for b...