databinding

ASP.net binding to a property that is an array of custom types

I'll use Customer and Addresses as an example rather than explain my real objects. Say I have a repeater bound to a collection of Customers and one of the properties of Customer is an array of addresses. How do I bind to the addresses property? I don't even need to display this information I just want to use it in the Repeaters ItemDa...

How to bind RadDataPager.PageSize to RadNumericUpDown.Value in code

I have a RadGridView, a RadDataPager and a RadNumericUpDown all defined in code. Now i want to bind the RadDataPager.PageSize to the RadNumericUpDown.Value so the pagesize of the pager is changeable via the RadNumericUpDown control. Thus i try: RadDataPager dataPager = new ...; RadNumericUpDown pageSizeSelector = new ...; Binding b =...

DataBinding in an ItemsControl to a custom UserControl property

I am having major problem in Data Binding. I have a stackpanel with an ItemControl in my MainPage.xml: <StackPanel> <ItemsControl x:Name="TopicList"> <ItemsControl.ItemTemplate> <DataTemplate> <local:TopicListItem Tit...

ComboBox in Silverlight DataGrid

When attempting to use a ComboBox in the CellEditingTemplate of a column of a Silverlight4 DataGrid, the binding expression for ItemsSource is not resolving correctly. The RIA DomainDataSource I wish to use is called installerGroupDomainDataSource and the following XAML works fine at page level. The list is populated and when I bind the...

Binding ArrayCollections of Arrays

Hi there! I've been kinda stuck in trying to organize data and bind them to a Repeater in one my applications. What I did at first, was to save an array of arrays, so that I could've accessed any value very easily. But then I realized that I needed to bind them to a Repeater, so I had to switch to an ArrayCollection of arrays. But the Bi...

Suspend binding in Silverlight

I have a ChildWindow (Ok, Cancel buttons) that contains binded controls. I want the behind object to be updated only when pressing the 'OK' button. What's the best way to do it? ...

How can I use WPF bindings while printing?

It seems not all bindings are to evaluated when printing. For example, in the code below, only the first button has content = "100", other buttons have content = "0". var doc = new XpsDocument("test.xps",FileAccess.Write); var writer = XpsDocument.CreateXpsDocumentWriter(doc); var collator = writer.CreateVisualsCollator(); collator.Be...

How can I update a WPF binding immediately

Say I have the following code: ContentControl c = new ContentControl(); c.SetBinding (ContentControl.Content, new Binding()); c.DataContext = "Test"; object test = c.Content; At this point, c.Content will return null. Is there a way to force the evaluation of the binding so that c.Content return "Test"? ...

WPF DataBinding: Cancelled property change - Combobox misaligns

I have a WPF form with a combobox and a textbox (both are databound to an Object's property). Changing the combobox or textbox input updates the Object's property and the databinding kicks in and updates the UI. The problem is, I implemented a way to cancel the change, which works, but screws up the UI updating. If I make the change from...

Problem with data binding in xaml through a RIA Domain Service

I have an entity framework with a many-to-many relationship between Customers and Contacts. I have generated a Domain Service Class and added the following method manually. public Customer GetCustomerById(int Id) { return this.ObjectContext.Customer.Include("Contacts").SingleOrDefault(s => s.Id == Id); } I now want to create ...

Add new row to gridview

I'm using a gridview to display and access a sql database and using databinding. I'm also using autogenerate columns as one gridview has multiple sources and toggles between them. What would be the best way to allow the user to insert a new row? Would a listview be better? ...

Why doesn't this Silverlight 4 DependencyObject's DependencyProperty getting data bound?

I have no idea why data binding is not happening for certain objects in my Silverlight 4 application. Here's approximately what my XAML looks like: <sdk:DataGrid> <u:Command.ShortcutKeys> <u:ShortcutKeyCollection> <u:ShortcutKey Key="Delete" Command="{Binding Path=MyViewModelProperty}"/> </u:ShortcutKeyCollection> </u...

Is there a way to define WPF custom bindings?

WPF already defines Binding and TemplateBinding. Is there a way to define my own custom binding type. For example, could I declare a "SelfBinding" where RelativeSource == RelativeSource.Self? ...

Databinding in WPF (C#)

Hello, sorry for any inconveniece caused. Would like to ask about database or rather databinding My Window look like this: http://i25.tinypic.com/a0x5kn.jpg The browse button is look up the "My Network Place" private void browseBtn_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog dialog = new FolderBrowserDialog(); Ty...

how to convert a databound zero double value to an empty string?

Hi Guys, I have this Payment object public class Payment { public Guid Id { get; set; } public double Amount { get; set; } } which is data bound to a TextBox <TextBox x:Name="_AmountTB" Text="{Binding Path=Amount, Mode=TwoWay}" /> I require that whenever the Amount is 0, then I don't show anything in the TextBox, how can...

Silverlight 4 - binding between two datagrids, from blend 4

I have some issues with using databinding in silverlight 4 xaml pages, this is my problem: I have two data grids: <sdk:DataGrid x:Name="dgCodeCountry" Height="144" Margin="41,56,39,0" VerticalAlignment="Top" AutoGenerateColumns="False" ItemsSource="{Binding Collection}" > <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Binding=...

Binding to ViewModel from XAML

Hi there, I am new to the MVVM model, so I would like some advice, the solution I'm using right now does not seem to work. Description: I have a Viewmodel containing an observablecollection of Customers, I display these in a grid with "Back" and "Forward" buttons. The grids datacontext is set to the SelectedCustomer which is a prope...

Repeater in my user control is empty on postback

I've looked at a lot of similar questions here, but to no avail. So here goes... I'm creating a set of user controls that display a list of grid-like tables. Anyway, the objective is to list the grids, mess with the each grids data (client-side) and press save. The grids work great, but when I press save teh repeater in the VIEWER is...

Loaded XAML Not Binding to Existing Elements Correctly

I have a button that loads XAML from a file, creates a control from it and adds this control as a child to a canvas that is part of a template present in the resources of a dockpanel on the window. The window also has a combobox named cboTColour and a combobox named cboBColour which I use to set a simple gradient background on my loaded ...

Binding Dependency Properties

so here i come creating a user control. it consists of a treeview dropping down from a combobox. actually there is a button with a control (DropTree) dropping down from it's contextmenu. so i have an control DropTree public partial class DropTree : UserControl { public TreeView TreeView { get{return treeView;} } public Dr...