databinding

Change databinding on WPF ComboBox when Checkbox value changes

I have a WPF ComboBox which is databound to a Collection, but depending on wether a Checkbox is checked or not I'd like to vary which Collection the ComboBox is bound to. The basic issue is I have a large collection of MyCustomer and I also have a filtered collection of MyCustomer - the filtering is quite intensive and I don't want to d...

Definitive pattern for implementing templated data-bound controls in ASP.NET

I am working on a project at the moment where we are building templated data-bound controls (TDBC) for ASP.NET. The problem is it appears that nobody has really worked out the definitive pattern for how to do this - there are 3 or 4 different 'styles'. Not only that but many of the controls are giving the "cannot use databinding when ...

Binding to an auto-updating object?

Is there an object or interface I can use to make an auto-updating object, and have those updates filter through to the UI in WPF? Basically I'm looking for something like this: <TextBlock Text="{Binding Source={StaticResource myClass}, Path=DataObject}" /> public class MyClass { public AutoUpdatingObject DataObject { get; set; } ...

Can I databind (2-way) dynamically generated RadioButtonLists?

I am trying to create a dynamic survey page. The idea seems simple, but trying to implement it in ASP.NET is getting me very frustrated... Each user is linked to an individual list of (multiple-choice) questions. I have the following data tables: Surveys: User | Question | Rank -------+------------+----- user-x | question-x | 1...

c# DataBinding to string property on a Generic

Guys, I'm trying to Databind to my custom dictionary class. In formLoad, I can bind to Car.Desc but I cannot bind to RatesCache.Desc. They are both public string properties. What am I missing? Thanks! System.ArgumentException was unhandled Message="Cannot bind to the property or column Desc on the DataSource.\r\nParameter name: ...

Modifying Data Binding in ASP.NET MVC RC2

How can I modify the behavior of the autobinding in ASP.net MVC? For instance, suppose I have a simple Employee object. One of the fields might be hiredate. When this field is bound to a textbox, it displays mm/dd/yyyy hh:mm:ss instead of just the date. I know I can modify the view to add formatting, but I'm pretty sure I the autobin...

Sorting a gridview when databinding a collection or list of objects

I am attemping to have my gridview be: bound by a List in code-behind. I am using my own custom BOL. no datasource object on the html page sortable on each column that I choose. The SortExpressions are all set correctly. The resulting error message: The GridView 'myGridView' fired event Sorting which wasn't handled. How can I have...

DataBind string to DataTemplated checkbox

I want to create a ListBox filled with checkboxes in WPF, and I want to databind the "Content" value with a simple string value. However when I try <CheckBox Margin="5" Content="{Binding}" /> the app crashes. This is what I have. ( I'm sure I am missing something simple ) <ListBox Grid.Row="1" IsSynchronizedWithCurrentItem="True" x:Nam...

Best way to decorate databound text in a wpf TextBlock

Hello, Let's say I have some multiline text that I'd like to format, and let's also say that it's databound. So, in XAML: <TextBlock TextWrap="Wrap"> <TextBlock.Inlines> <Run TextWeight="Bold" Text="{Binding Path=FirstName}" /> <Run TextStyle="Italic Text="{Binding Path=LastName}" /> </TextBlock.Inlines> </Text...

What's the difference between these two bindings?

Long ago, I looked at this MSDN walkthrough. It implements a color editor, and the tooltip uses the color's name like "Red" or "Blue". Today, I'm implementing a ListBox that is similar; it displays a box with the color and the name of the color next to it. Except in my application, all of the color names display as the hex values like...

Simple DataBinding question.

I can't figure out what is wrong for this simple binding. when click on first or second radio button, no first or last name display. 1) Xaml <Window x:Class="WpfApplication2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-nam...

Conditionally binding Foreground to a boolean

I have a Treeview showing Xml data where each element is wrapped in a class that exposes IsExpanded, the wrapped XElement's Name and Value and a boolean MatchesFilter which is set if the element matches a specific filter; I'd like to change the foreground color if MatchesFilter is true. What I currently have is: <TreeView.ItemTemplate...

WPF: Can I bind to a method of the selected object in another control?

I have two WPF list boxes. One is a list of lists (actually a List of ObservableCollection), the other is a list of all known instances of "Thingy". Here's the datatemplate I'm using for the "thingy" class. <DataTemplate DataType="{x:Type Model:Thingy}"> <StackPanel Orientation="Horizontal"> <CheckBox x:Name="ThingyInLis...

Dynamic SQL Java library

We need to generate dynamic SQL in our Java app. Does anyone know a simple library to do this? In our Java app we have a bunch of where clause filter criteria (database column, operand, value). In other words, we could have a Date instance that we need to use to filter a given datetime Oracle column, a String instance that we need to...

WPF Triggers: Changing an out-of-scope control's style in a trigger

I can't come up with a solution for this problem in XAML: I want to animate the width of the right button to a certain value when IsMouseOver of the left button is true. I dont know where to put this: in a style or template of one of the buttons or in a style on the grid. Is it even possible? <Border Style="{StaticResource ContentBodyS...

Binding a line to the edge of an ellipse

On a canvas I have an ellipse rotated by a RotateTransform through animation. I wish to add a line with one end attached to a point on the ellipse. Can I somehow bind to a point on the ellipse? ...

Databinding on a IValueConverter

Does anybody know if it is possible to do databinding on an IValueConverter based class? I have the following converter: [ValueConversion(typeof(int), typeof(Article))] public class LookupArticleConverter : FrameworkElement, IValueConverter { public static readonly DependencyProperty ArticlesProperty = DependencyProperty.Register("...

How to bind XML to a data.grid in Silverlight.

I have an app that receives XML from a server. I want to bind the data to a data grid and it would be grate if the grid auto generated the columns. So far I have tried to this much in my code. XAML page: <data:DataGrid x:Name="Status" ItemsSource="{Binding}" AutoGenerateColumns="True"> </data:DataGrid> Code behind for the page: void...

WPF: Show UserControl before all bound properties are loaded.

I have one UserControl which has a ListView showing a list of Client objects. Double clicking one of the rows plays an animation and transitions to another UserControl which shows the list of accounts for that client. The second user control is bound to the Accounts property on the Client object. The list of accounts is loaded the firs...

How to Bind a custom class with no strongly typed properties

hey guys, here are my requirements: I need a simple class with only one Public property and no Public methods (the final Class will be more complex, but for testing this is all I need) The Property is "Item" and takes a "String" as a parameter. It returns a "String" based on the parameter. I then want be able to add instances of this ...