binding

WPF Binding only part of a label

How would one achieve mixing bound values with constant text in a WPF bound control? For example, say I have a form displaying orders, and I want a label that displays text like "Order ID 1234". I've tried things like: text="Order ID {Binding ....}" Is this achievable, or do I have to do something like having more than one label in ...

Default form submit behavior after jQuery forms.js ajaxSubmit executes

I'm using the jQuery Form Plugin to bind the submit events for two forms on the same page so that they are submitted to separate PHP scripts that return markup to separate divs on the page. One form refreshes the next. I use "live" so each form has its events re-bound when it is refreshed: $(document).ready(function() { /* Form 1 *...

How to bind nested array element property value to TextBox in ASP.NET MVC

Hi, I have model public class User { public User() { Addreses = new List<Address>(); } public String Name { get; set; } public String LastName { get; set; } public List<Address> Addresses { get; private set; } } public class Address { public String Street { get; set; } public String City { get; ...

Array binding Xaml by Position (Silverlight) - on Datagrid

Hi, I have a list of string array as input. The array dimension are static for all the list but I can't know the array size until the list is retrieved. I need to bind the list in a datagrid in Silverlight. I tryied to create columns at runtime, binding each column to a particular array position but cannot find a way. Have you any ...

WPF: "Items collection must be empty before using ItemsSource."

I'm trying to get images to display in a WPF ListView styled like a WrapPanel as described in this old ATC Avalon Team article: How to Create a Custom View. When I try to populate the ListView with a LINQ-to-Entities queried collection of ADO.NET Entity Framework objects I get the following exception: Exception Items collection m...

Is it possible to bind an Event in a Silverlight DataTemplate?

Is it possible to bind an Event in a Silverlight DataTemplate? If so, what is the best way to do it? For example, say you've created a DataTemplate that has a Button in it, like this: <UserControl.Resources> <DataTemplate x:Key="MyDataTemplate" > <Grid> <Button Content="{Binding ButtonText}" Margin="4" /> </Grid> ...

Hosting multiple endpoints under WAS

Is it possible to host a service with multiple binding endpoints under WAS. For example a service with tow TCP endpoints and tow message queue endpoints? Is that possible? ...

Selecting all items after binding wpf listview

I have the following XAML: <ListView x:Name="debitOrderItems" ItemsSource="{Binding DebitOrderItems}"> <ListView.ItemTemplate> <DataTemplate> <CheckBox x:Name="checkbox" Content="{Binding}" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Path=IsSelected}" /> </DataTem...

Binding a datacontext string property to a StaticResource key

I have an List values with a ResourceKey and a Caption, these values are both strings. The Resource is the name of an actual resource defined in a resource dictionary. Each of these ResourceKey Icons are Canvas's. <Data ResourceKey="IconCalendar" Caption="Calendar"/> <Data ResourceKey="IconEmail" Caption="Email"/> I then have a list v...

Binding to properties of Storyboard declared in UserControl

Hi there, I'm struggling with a binding that only works when declared inside a Window's resources area. As soon as I move the declaration to a UserControl's resources area, the binding fails. No error message, but the value is not updated when the value of the slider (source) is changed. I would like to use the storyboard inside one of ...

Asp Binding question

Below is a some sample code I am trying to update. The client would like to make the menu item text an AppSetting Value. I have been able to setup the appsettings and the function to implement it. But I am getting an error on my Bind code and wondering if anyone see something I missed. Is it as easy as setting an ID tag for the Men...

Set Parent Visibility to nested Child Visibility

I have the following <ControlTemplate x:Key="RoundedTopPanel" TargetType="{x:Type ContentControl}"> <Grid> <Border CornerRadius="9.5, 9.5, 0, 0" Padding="10" > <ContentPresenter/> </Border> </Grid> </ControlTemplate> and then use it as <ContentControl Template="{StaticResource RoundedTopPanel}" Grid.R...

WPF - Binding to a Menu Icon.

I've got a UserControl that contains a menu. I need to bind the Menu.Icon to a property of the UserControl but it's not working. The code starts like this - <Border Grid.Row="0"> <DockPanel> <Image x:Name="testImage" Height="16" Width="16" Source="{Binding ElementName=UC,Path=AddImage}"/> ...

WPF TextBlock dynamic bold and italic parts

Hello, I'm using MVVM pattern and I have string type property in my ModelView. The string may contain following HTML tags: <b>, </b>, <i>, </i> I need to make certain parts of text in TextBlock to be in normal, bold or italic. At moment I have created workaround, a helper method that works like this: Breaks HTML string into parts...

WPF - Is there any way to programmatically evaluate a binding?

Does anyone know how to get the current value associated with a Binding? I ran into a problem recently where I wanted to get the value associated with a particular cell in the WPFToolKit DataGrid - so I created a function that gets the Path string, splits on '.' and tries uses PropertyDescriptor in a loop, trying to get the bound value....

Changing which DependencyProperty I bind to at run time

I'm using WPF and have a data class which I bind to a control's DependencyProperties. I need to change the binding at run time under the control of a user. Ideally I'd like to be able to do something like this myControl.SetBinding(UserControl.GetDependencyProperty("HeightProperty") , myBinding); Of course GetDependencyProperty tak...

WPF MVVM Using Commands vs. Event Handlers

Hello, I like MVVM pattern, once you start using it, you get addicted to it. I know that in perfect world your View code-behind is almost empty (maybe some code in constructor) and every aspect of View is being manipulated from ViewModel. But there are times when creating new fields, properties,commands in ViewModel creates more code ...

Binding ElementName. Does it use Visual Tree or Logical Tree

Having {Binding ElementName=foo}, will it lookup visual or logical tree? http://blogs.msdn.com/mikehillberg/archive/2008/05/23/Of-logical-and-visual-trees-in-WPF.aspx When does the logical tree matter? When looking up a name, such as in {Binding ElementName=Foo}, the search walks up the ancestry looking for a name scope, ...

Storing DLL's in A Central NON GAC Location

We are being presented with a unique, painful situation. Traditionally we have been using the GAC and Policy Files to control DLL versions for our .NET applications. However, we have a very unique situation and are running into major problems with this, as some of our applications do NOT respect the policy files. Most specifically the...

WPF Bind DateTime to Date and Time EditFields

Hi, i am trying to build a gui that includes editing a DateTime value of an object. The DateTime Property has binding to a DataPicker and a normal TextBox for the Time. When i change the value in the Time TextBox the value wirtten in the DateTime Property is Today with the entered Time instead of just updating the Time, preserving the...