binding

[WPF] binding another control in DataTemplate

I'd like to show the PixelWidth & PixelHeight of the image (not thumbnail) in tooltip, But I have not idea how to do binding in the datetemplate, I try to use "{Binding ElementName=imgPreview, Path=Source.PixelWidth}"/>, but got nothing. Could anyone explain how to do it? <ListBox.ItemTemplate> <DataTemplate> ...

Silverlight DataGrid - Binding to a Collection of Collections of objects.

Problem: The data I'm trying to display is essentially a collection of collections of some object. So the rows can be any number, normal for a datagrid, and the columns are also any number. That's not so normal for a datagrid. Usually you have a set number of columns and your rows vary. The datagrid cell will be either a string or a valu...

WCF custom context in Message Headers or Context Binding?

What are the pros/cons of sending context state in WCF Message Headers vs. using one of the WCF Context Bindings? Both seem to be able to solve my problem of out-of-band context state. All of the context data that I have can be serialized as string key-value pairs. I'm currently leaning toward Message Headers as it seems like it might ...

WPF Collections and Databinding

I am new to WPF and trying to wrap my head around WPF's framework, what it does and does not do for you. To clarify this, I would like to know what is the difference between this: public List<MyCustomObject> MyCustomObjects { get { return (List<MyCustomObject>)GetValue(MyCustomObjectsProperty); } set { SetValue(MyCustomObjectsP...

In a style, how can I refer to the element on which the style is applied ?

Hi, In a style, how can I refer to the element on which the style is applied ? For instance, in the style I define a RenderTransform, and I would like to add an animation on the RenderTransform : <Style x:Key="myStyle" TargetType="{x:Type FrameworkElement}"> <Setter Property="RenderTransform"> <Setter.Value> ...

asp.net mvc 2 multiple selection listbox. how to read values in controller

I'm having a hard time getting a fairly simple binding to work. When editing an employee I want to display a listbox containing all the available roles in the system, (the employee's roles selected), and when saving the employee I want the selected roles to get populated by MVC into the Employee object which comes as an input param to ...

Is there a way to use a DataTemplate with a parameter?

I need to dynamically add/remove GridView columns, each displaying information from a different element stored in a KeyedCollection (indexed with tn 'int'). The basic technique works, but requires an index, as follows: <GridViewColumn Header="bid"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Width="60...

Silverlight: Can I create a custom button which contains two TextBlocks, each of which binds to a different property on an object?

I want to make buttons similar to those on this website. Lets say that the object I'm working with is ArtPiece, and has a Title and Date. I want both of those to show up on my buttons in two different TextBlocks. I've been trying to modify the button's ContentTemplate, then modifying the button's ContentPresenter inside the ContentTem...

RMI binding same object twice but presenting different interfaces

Hey guys, I have an interesting one for you here! I have one object, called Server, that implements two RMI interfaces, CSCP and ISCP. I need my Clients to be able to communicate on the RMI CSCP interface, but know nothing of the ISCP interface, and I need other servers to communicate with it on the ISCP interface but know nothing of th...

How to setup WPF parent/child listboxes

I need selected item of Listbox1 to provide XmlDataprovider source for second Listbox. Listbox1 uses: <XmlDataProvider x:Key="CategoryXML" Source="C:\Category.xml" XPath="category" /> Ex: Category.xml <?xml version="1.0" encoding="ISO-8859-1"?> <main> <category> <name>Local</n...

Odd Binding behavior in WPF

Hello, I will try and explain this as concise as possible. I have 2 objects, the first which we will call object A that has an Id property and the second we will call object B, which has a ParentId property. The obvious relationship is that object B's ParentId is set to an object A's Id property. I am using the MVVM pattern, so on the vi...

WPF: Binding ContextMenu to visual parent

I know ContextMenus aren't part of the visual tree, but I've been trying to bind the Visibility property of a contextmenu to a property on it's parent UserControl. So far I've tried ancestor binding and experimented with a converted, but the only way that seems remotely feasible at the minute is to use a MultiValueConverter and reflectio...

Problem with Binding Dependency Property on a UserControl

I have a two userControls (IconUserControl & DisplayUserControl), I'm having a problem with binding dependency properties, here's some detail: IconUserControl has a bool DP of IsDisplayShown DisplayUserControl has a bool DP of IsDisplayShown In the XAML I have: <local:DisplayUserControl x:Name="DisplayUserControl...

How to find bad endpoints earlier?

When I try to connect to an unavailable machine, I get an EndpointNotFoundException but it takes too long (about 20 seconds). Setting closeTimeout, openTimeout, receiveTimeout or sendTimeout has no effect. Can I get that exception earlier? ...

Changing the value of a DependencyProperty inside the PropertyChangedCallback for that DependencyProperty...

I have a control with a combobox: <ComboBox x:Name="TraceComboBox" ItemsSource="{Binding SingleChannelList}" SelectedItem="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type cc:LogicTriggerSimpleLevelControl}}, Path=SelectedTrace, Mode=TwoWay}" > Here's th...

Choose path of Path Cell in NSTableView?

I've added a NSPathCell to a table view: - (void)awakeFromNib { NSPathCell *pathCell = [[[NSPathCell alloc] init] autorelease]; [pathCell setPathStyle:NSPathStylePopUp]; [pathCell setControlSize:NSSmallControlSize]; [pathCell setAllowedTypes:[NSArray arrayWithObject:@"public.folder"]]; [[tableView tableColumnWithIdentifier:@"destin...

Using a specific network interface for a socket in windows

Is there a reliable way in windows, apart from changing the routing table, to force a newly created socket to use a specific network interface (I understand that bind() to the interface's IP address does not guarantee this)? ...

Are value converters instantiated per-binding in WPF?

Is a separate WPF value converter object instantiated for each binding that a particular value converter class is used in? I am trying to create a two-way bit-to-boolean value converter. I would like to be able to bind a bool property (such as IsChecked) to a bit in a value type (like a ushort). I'm using the converter's parameter arg...

WPF Binding IsSelected to ViewModel doesn't set items that haven't been shown in the List

I have a ViewModel that has an IsSelected property which I bind in my ListView.ItemContainerStyle XAML to an IsSelected property in my view model. I bring up the application and populate the view model collection (which is shown in my ListView) with a lot of items, say about 2000. Then I select everything in the list via Ctrl-A. The ite...

Flex - Issue with binding in script blocks

I am working on the multifile uploader, and want to set the upload directory based on a selected questionID (which is the directory name) in my datagrid. The code can be found here http://pastie.org/784185 Something like this: I have set myQuestionID (the directory to upload to) so it is bindable (lines 136-137): [Bindable] public v...