databinding

How can I improve Silverlight binding performance?

Scenario: I have many (potentially dozens) of ObservableCollection's being bound to ListBoxes at load time. These bindings are declared in their respective Xaml files. When the app first runs, it queries a database and then populates these ObservableCollections (by adding a new entity to their respective collection). I suspect that the...

Syntax error binding to a static resource in Silverlight

I am having a problem with accessing Application Resources from a UserControl in my Silverlight application. Here is my UserControl: <UserControl x:Class="MyApp.MainControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:basics="clr-namespace:...

How can I set the focus to a ListBox properly on load if it uses databinding?

I usually call myControl.Focus() in the Loaded event handler, but this doesn't seem to work for a ListBox which is databound to a list of custom objects. When I start my application, the ListBox's first item is selected but the focus is elsewhere. I thought this could be because the focus is being set before the databound items are load...

How to set DropDownList selected item in markup?

I have a DropDownList in a template column of a GridView control. The GridView is bound to a list of objects. Each object has a property of type int which corresponds to a value in one of the DropDownLists ListItems. I could set the selected item programatically by adding a DataBind event to the drop down, but I'm wondering if there's...

Add support for fields to databound controls

For example when using a gridview. When you specify the columns BoundField for example won't work if you are binding it to a field instead of a property. I guess this is so because when the gridview is looking for the DataField property it looks for a property and not a field. Now the question is how can i change this behavior to make ...

What is the best way to databind a WPF control to a typed dataset?

I have a static, typed dataset that I am using within my WPF application that all the user controls must bind to. I want compilation to break if the dataset and the UI are out of sync. What approach have you found best to accomplish this? ...

How do I have a Silverlight databinding update the model as the user types?

I'm currently using Silverlight 4 and following the MVVM pattern. I have login boxes bound to my ViewModel like so: <PasswordBox Password="{Binding Path=Password, Mode=TwoWay}" /> I then later on have a button bound to a Command which listens to the ViewModel's PropertyChanged event and when one of the databindings has its data update...

Databound controls "flashing" as they are refreshed

It's a small thing but I was just wondering... Visual Studio 2008, C#. I have a master-detail form with databound controls. When user selects the record in a listbox, all the details are updated in multiple databound controls on the form. As it happens, they kind of 'flash', or blink, when repopulated with new data and it's sort of li...

groovy swingbuilder bindable list and tables

Is there a way to bind data to a list and/or a table using the groovy swing builder bind syntax? I could only find simple examples that bind simple properties like strings and numbers to a text field, label, or button text. thanks, Jeff ...

Why does bindingSource = newBindingSource not refresh data

I have this in my form's designer code: this.referenceNumberTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.clientDetailBindingSource, "ClientDetails.ReferenceNumber", true)); In a method in the form just before it gets displayed I say this.clientDetailBindingSource = passedInBindingSource; The controls that ...

Property Binding to Static Properties in WPF: Width binding doesn't work

Update: I've corrected the post, so the question is closed. Expected result: Menu width must be equal to the main window width. Here is full code: <Menu Name="menu1" DockPanel.Dock="Top"> <Menu.Width> <Binding Path="MainWindow.Width" Source="{x:Static Application.Current}" UpdateSourceTrigger="P...

Can't databind at design time in WPF using MVVM - ViewModel property never gets called

Ok, I'm pulling my hair out over this, so any help will be hugely appreciated! I'm building a WPF application using the MVVM pattern. In an attempt to get data in at design time I am using the Ninject dependency injection framework in conjunction with a service locator (much like the example in an article at http://jonas.follesoe.no/Yo...

WPF Display formatted multiline text using data binding

I need to display the following using WPF databinding (the values change). Headers must be bold, the info lines are normal text. If info for a given header does not exist, I want to collapse that section, including the header. I prefer all the data (header and info items) be in one formatted string that can line break where I want. Hea...

Bind List of UControls to a Controls Children property?

Hello, I have got an ObservableCollection buttonList; (this can be any other control: Textbox, Textblock or even a UserControl). I want to bind this List via DataBinding to a parent control (lets say a Grid or a WrapPanel,...) Is this somehow possible? Children property is read only. I do not want to do this in the program code -> Dont...

DataBinding 2 properties to 1 Control

Is it possible to databind 2 properties to 1 control? Specifically, I'm thinking phone numbers. I've got an object where all of the properties are bindable directly to 1 control, but there is an areacode and phonenumber property on the object. My users very much prefer a masked textbox for entering phone numbers as opposed to 2 separate ...

Are there any builtin IMultiValueConverts in WPF?

I'm writing a MultiBinding containing two bindings - each returning a bool. Using MultiBindings you need to specify an IMultiValueConverter. In my case this converter should take two bools and return the AND of them. This is really simple to write, but do I have to? This feels like the most basic MultiValueConverter, and I don't want to ...

Problem with GridView, Bind() and DropDownList

I am updating an existing ASP .NET site. This site has a custom grid control class that extends the GridView control to add a few features. Many pages in the site use the built in declarative two-way binding feature that is built into the base GridView, i.e. column templates make calls to Bind() so that data can be shown and updated auto...

WPF Binding - Notify Change to ToString value

I have a textblock that is bound to an object. This object I have overridden ToString to return a combination of 2 other properties. How can I notify that the ToString value has been changed when one of the property values is updated? Unfortunately I cannot change the binding to the ToString value as this is within a 3rd party control s...

Wpf binding to Foreground with GridViewColumn

Hi all, I'm doing : <ListView Margin="34,42,42,25" Name="listView1"> <ListView.View> <GridView> <GridViewColumn Width="550" Header="Value" DisplayMemberBinding="{Binding Path=MyValue}"/> </GridView> </ListView.View> <ListView.Resources> <Style TargetType="{x:Type TextBlock}"> <Setter Property="Foreground" ...

.net databinding external resource dll

Hi, for localizing purpose I wonder how to databind the text properties of controls e.g. buttons in a C# .NET windows application to an external resource..? Currently I created a resource, containing a table like ButtonText1 - "Value1" ButtonText2 - "Value2" ... and compiled it as an embedded resource to a DLL. In my windows appl...