binding

What's the simplest way to bind a list of checkboxes to a list of checked values

I have a list of AvailableItems that I want to display as a list of checkboxes, so that users can pick which items to generate, which are then stored in another list called ItemsToGenerate (my lists are actually just lists of strings). Showing all available items with corresponding checkboxes is easy: <ItemsControl ItemsSource="{Bindi...

Custom property descriptor and flattening hierarchies

I have a custom property descriptor that I use to support flattening object hierarchies. To accomplish this I subclassed PropertyDescriptor and I store a linked list to the "next" (child) property that I want to retrieve the value for. This enables me to bind subproperties to a grid(export to excel, whatever) in a "flat" manner. eg. ...

WCF web service error

Hi guys,i give an error when connect my wcf service, The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8) My wcf service config file below this: <?xml version="1.0"?> <configuration> <customErrors mode="Off"> </customErrors> <system.serviceMod...

WPF - What conditions must be met to use data binding in a custom control's content items?

I'm in the process of making a custom control -- specifically a pie chart. I want the markup to look something like this example: <c:PieChart> <!-- These dependency properties are never set --> <c:Slice Value="{Binding RedCount}" /> <c:Slice Value="{Binding BlueCount}" /> <c:Slice Value="{Binding GreenCount}" /> </c:Pie...

Binding effect properties inside effect tags not working?

We're trying to do this: <rollOverEffect> <AnimateProperty property="scaleX" toValue="{originalWidth + scaleFactor}" /> </rollOverEffect> However, it seems as though the effects toValue is always NaN. If I set the value to a constant the effect works. Isn't it possible to use databinding for effects like this? Addendum: Both or...

WPF MVVM Correct way to fire event on view from ViewModel

Hello, In my WPF application I have 2 Windows (both Windows have their own ViewModel): Application's Main Window that displays list with bunch of words (bound to MainViewModel) Dialog Window that allows users add new items to the list (bound to AddWordViewModel) MainViewModel has Articles property of List(this collection is populat...

Double Click a list item

Hello, I have a listbox in my wpf window that binds to an observable collection, now I want to open the browser if someone clicks on an element of the listbox (just like a link). Can someone tell me how to do this? I found something with listboxviews, does it only work this way or is there a way by just using the lisbox? Yours Sebast...

How can I overridding a bound property with a DataTrigger

I've got the following XAML used to display detailed information about an item selected in a list view. I want the rectangle to show the standard info color behind the text except when the selected item represents an error message. The code below doesn't work as is and always shows the info color. It works great if I don't specify a Fill...

NullReferenceException calling RegisterName() from control in DataTemplate

I've created a custom WPF control that performs some animations on dynamically created objects. I use SetTargetName() to set animation target. (I know about SetTarget() but I need to support .NET 3.5 without SP1.) Obviously before that I need to register object names with RegisterName(). Everything works fine when my control is placed no...

bind dynamicly added form too submit event with jquery

What would be the best way to handle the submit event when you have multiple forms dynamicly created with the same form id in jQuery? So far this line makes that jquery only handles the first form. $("form#noteform").submit(function(){ // do stuff }); Kind of confusing, because I really need to catch the submit of a particular form...

WPF Data Binding to changing object

Hi, I have a user control which displays the currently logged in user's name. I have bound a TextBlock in the control to the UserId property of a User obejct in my application. The issue I have is that the User object my binding has as a source changes each time a new user logs in. I can think of a solution where I fire an event when ...

WPF: Binding to ComboBox SelectedItem

Hi all I have a UserControl with ComboBox that based on XML data: <Root> <Node Background="Yellow" Foreground="Cyan" Image="1.ico" Property="aaaa" Value="28" /> <Node Background="SlateBlue" Foreground="Black" Image="2.ico" Property="bbbb" Value="2.5" /> <Node Background="Teal" Foreground="Green" Image="3.ico" Property="cccc" Value="4.0...

How do I use reflection to get the nested property

I am writing a TwoWay Binding control for ASP.NET. I finally got things working. I'm rebinding using the following code: private void RebindData() { // return if the DataValue wasn't loaded from ViewState if (DataValue == null) return; // extract the values from the two-way binding template IOrderedDictionary v...

Why does WPF support binding to properties of an object, but not fields?

I've got a WCF service that passes around status updates via a struct like so: [DataContract] public struct StatusInfo { [DataMember] public int Total; [DataMember] public string Authority; } ... public StatusInfo GetStatus() { ... } I expose a property in a ViewModel like this: public class ServiceViewModel : ViewModel { ...

WPF: Bind to a value defined in the Settings

In WPF, Can I use binding with values defined in Settings? If this is possible, please provide a sample. ...

How can I bind a string to double in WPF?

I want to set a binding. The problem is that the target is of type string but the source is of type double. In the following code VersionNumber is of type double. When I run this, the textblock is empty, without throwing any exceptions. How can I set this binding? <Style TargetType="{x:Type MyControl}"> <Setter Property="Template"> ...

Get DataContext of ListView Ancestor

I am developing a WPF app using MVVM and need some help. for the View of my AddressesViewModel I have a usercontrol with a listview. I would like to execute a command found in the AddressesViewModel from the contextmenu of the listViewItem. Because I'm opening a ContextMenu it is not found in the visual tree(I read that somewhere). He...

GroupStyle sum not updated when multiple items

Hi everyone, First question here. I hope I won't mess it. Also excuse my English. I have successfully applied the trick explained here. But I still have one problem. Quick recap : I display users in a ListView. Users are regrouped by Country, and in the GroupStyle DataTemplate I display the sum of all group related Users.Total, using ...

WPF - Multibinding from Two Sources inside the ListBox DataTemplate

Hello everyone, I tried to look around to see if I am missing something basic, but I can't seem to understand what I am doing wrong. I have a listbox where I would like to bind the itemssource to a collectionview of photos from a dataset. The problem is, I need to take the directory where the images exist from the MasterView Collectio...

How to display validation error on Image.Source?

I am binding an Image's Source property to a URI string property on the model: <Image Validation.ErrorTemplate="{StaticResource validationTemplate}"> <Image.Source> <Binding Path="LargeImage.ImageUri"> <Binding.ValidationRules> <ExceptionValidationRule/> </Binding.ValidationRules> </Binding> </Image.Sourc...