databinding

how to express this xaml combobox data-binding in c# code

ItemsSource="{Binding Source={StaticResource stringResources}, Path=MyProp}" I tried and got so far but I don't get it compiled: comboBox.ItemsSource = new Binding { Source = new StringResources(), ElementName = "MyProp" }; comboBox.DisplayMemberPath="Value"; comboBox.SelectedValuePath="Key"; It says that it cannot convert Binding t...

Databound TextBox doesn't reflect source changes.

Hi. I need TextBox which will reflect changes in databound string. I tried following code: public partial class Form1 : Form { string m_sFirstName = "Brad"; public string FirstName { get { return m_sFirstName; } set { m_sFirstName = value; } } public Form1() { InitializeComponent(); ...

How can I see the actual SQL an ASP SqlDataSource will run (after binding)

This is a very simple question, but one I can't find an answer to. If I have an SqlDataSource that takes parameters, how can I see the actual SQL that will be executed against the DB after the binding takes place? (I have tried adding a breakpoint to code on the onBinding event of the SqlDataSource) Thanks for any help Ryan ...

DataGridView Event - which one to choose

I'm looking for an event that occurs right right after loading and after sorting. I have a piece of code that colors some of the Rows in a DataGridView control. But when I sort the style changes are lost. I need the right event to tap into to redo the coloration step after the load/sort events. Trying to right clean code ... so I was lo...

Does the UpdateItem function work on a DetailsView bound to a List?

I'm using a DetailsView bound to a specific member of a custom business object - so, really, a List with one element. It displays fine and I am not having any problems with the bindings as far as I can tell - example being: <asp:TemplateField HeaderText="Name"> <EditItemTemplate> <asp:TextBox ID="txtName" run...

WPF: binding seletion of text to sliders?

In a WPF based project I would like to bind the content of a TextBox to two sliders in such a way that first slider would start selection (from left or right based on a checkbox) from the n-th character (n being slider value) to the m-th character (based on second slider value). In essence I would like to specify selection range based on...

WPF and MVVM: Changing data binding converter at runtime

I am using WPF and the MVVM pattern in my user interface. In my ViewModel I have a List containing distances in millimetres, which I display in a ListView by binding ListView.ItemsSource to the List. However, I would like the values displayed to use a more natural unit - either metres or feet depending on the state of a "metric" checkbox...

Set a datalist.datasource from inside a usercontrol - asp.net c#

I have a usercontrol that contains a datalist, and I want to set the datasource of the datalist to different things depending on what page the usercontrol is on. So, I think what I need to do is expose a public property of the datalist that will get the datasource and set it, like so: public datasource UserDataSource { get { return Da...

How to set custom properties on a Winforms control bindable?

I have some properties like OverlayColor, etc that I want to bind to an instance of a different type, but the bound data just doesn't change. I use this: [Bindable ( true )] public Color OverlayColor { get; set; } The UI changes but not the bound data. Bound data's property name is Color. ...

Why Winforms.Button.Text works for DataBinding but not ImageKey?

Is there anyone who knows this? I have been trying this for the last week, and no luck. Now I can see that once can bind successfully to a Button's Text property, but not its ImageKey property: myButton.Text = "new text"; // really changes the bound data myButton.ImageKey = "new text"; // does NOT change the bound data I use: myBut...

ASPX Page Bind in UserControl deployed to SharePoint

I would really be happy if there is a functionality if the page DataBind as explained in this link http://support.microsoft.com/kb/307860#1a. Does sharepoint support this kind of Page DataBind. The syntax which I am working on is here <asp:Label ID="lblICSFormCreatedCount" runat="server" Text='<%# ICSFormCount%>'><asp:label> even I t...

Databinding combobox in winforms MDI app

Hi all, I'm working on a winforms project and I have a combobox implemented inside a menu strip on the MDI parent form. I'm trying to bind that combobox to a data table (LINQTOSQL) and filter it. My code is the following : BindingSource bs = new BindingSource(); bs.DataSource = dataContext.UserRoleInProjects; bs.Filter = "userID = '" ...

WPF dependency property not recognized

Hello, I'm trying to overcome a limitation that doesn't allow me to bind to regular clr properties. The solution I use uses custom dependency properties that in turn changes clr properties. Here is the code class BindableTextBox : TextBox { public static readonly DependencyProperty BoundSelectionStartProperty = DependencyProperty...

What exactly does WPF Data Binding's "RelativeSource FindAncestor" do?

I am currently working within a WPF user control (the root element of my XAML file is "UserControl"), which I know is being hosted inside a Window. How can I access a property of the Window using data binding? Does anyone know why simply <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}" Path="..." />...

Silverlight 3 - Data Binding Position of a rectangle on a canvas

Hi Everyone, I am currently trying to bind a collection of objects to a Canvas in Silverlight 3 using an ItemsControl as below: <ItemsControl x:Name="ctrl" ItemsSource="{Binding myObjectsCollection}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas></Canvas> </ItemsPanelTemplate> </ItemsContro...

How do you get a Microsoft Access form to refresh a computed column?

Hello, I have a Microsoft Access form that is bound to a linked SQL Server table that has a computed column. I have a control bound to the computed column. I already realize that the computed field cannot be refreshed until AFTER a record is saved. Beyond that, what is the best way to refresh that textbox that is bound to the compute...

Databinding Silverlight datagrid row details template

Hello, I have an objectmodel that has a class Item and ItemsManager which exposes a list of Items objects using Observablecollection Items public class Item { public Name {get;set;} public Description {get;set;} } public class ItemsManager:INotifyPropertyChanged { public Observablecollection<Item> Items; public string It...

Problem with databinding manual writevalue in .net winforms

If I turn off automatic updating of a binding data source by setting DataSourceUpdateMode = Never and then use a button to update the whole lot (using binding.WriteValue), a problem occurs - Namely, only the first bound control's data source is updated. All other controls are reset back to the original values. This is because when the c...

Is it possible to bind a whole class in spring?

Hi,I use spring web flow 2 with hibernate annotations. Is there possible that in my jsp using form tags to bind a whole class? I am asking this, because when I generated my entity classes from SQL Server 2008 using Intellij it autogenerated also my @ManyToOne column (it's about 2 tables: one named Leader-with idLeader,name..and so on and...

Clear Binding in Silverlight (Remove Data Binding from SetBinding)

How do you Clear/Remove DataBinding in Silverlight? similar to: http://stackoverflow.com/questions/186475/remove-binding-in-wpf-using-code But the BindingOperations.ClearBinding() method does not exist in Silverlight 3. ...