databinding

How can I reference an attached property as the source of a data binding?

Here's a much-abbreviated sample of my code. <Grid> <Polygon Name="ply" Grid.Column="2" Grid.Row="0" Grid.RowSpan="3" Fill="Orange" Stroke="Orange" Points="0,1 1,3 2,2 2,0 0,0" /> <Line Grid.Column= "{Binding ElementName=ply, Path=Grid.Column, Mode=OneWay}" Grid.Row= "{Binding ElementName=ply, Path=Grid.Row, Mode=On...

WPF data-binding with multiple dependencies?

I believe this code may require more effort to comprehend than average, so I'm using contextual code-comments to explain my predicament in an effort to make it a little easier to understand my question. public class MyControl : System.Windows.FrameworkElement { public double Property1 { get; set; } public double Property2 { ge...

What is the reverse of DataBind() function in ASP .NET

I am currently doing data binding with a grid view with a data source from an ArrayList. Is there a way to reverse the bind and get the value from the grid view with a one line code? // Bind to GUI ArrayList dsList; gvName.DataSource = dsList; gvName.DataBind(); // Current Way of getting code from GUI int iRow = 0; foreach (GridViewRow...

Referencing Page.Title after it has been set as part of a asp:contentplaceholder

Hi, I've got a master page setup with a contentplaceholder control inside the title tag as so: <head id="head1" runat="server"> <style type="text/css"> body { font-family: Tahoma; font-size: 9pt; } </style> <title><asp:contentplaceholder id="title" runat="server" /></title> </head> That contentplaceholder is implemented inside ...

Pass values from one to another page

How we can pass the values from a child window to the parent window in silverlight 3 by using Properties (ie Databinding). In my work, it includes a parent window and a child window. The child window contains a text box, which returns a value after the hitting OK button it to Parent window. I already did this by using message sending an...

WPF ItemsControl - Command on ViewModel not firing from within ItemsControl

Hi, I'm using M-V-VM and have a command on my ViewModel called 'EntitySelectedCommand'. I've trying to get all the Items in an ItemsControl to fire this command, however it's not working. I think it's because each items 'datacontext' is the individual object the item is bound to, rather than the ViewModel? Can anyone point me in the ...

How to read BindType prop from BindingSource?

I'm looking for reading object type bind to BindingSource. In debugger mode I've drilled down BndingSource object and I've found non-public property named "BindType" what contains interested info. (Also found property "ItemType" what contains also such info - but I'm not sure it will work if BS.Count == 0) Can you please advice how ...

Why do I get Inconsistent Binding results

I have a control template with a toggle button. This ToggleButton has it's IsChecked property one way bound to a dependancy property. If i set the dependancy property explicitly the binding works. The problem is that after I interact with the toggle button in the UI, the bindings don't update the IsChecked property if I set the depend...

How to implement the Display/ValueMember in my own control.

Hi, I created the custom winforms data control which has the "DisplayMember & ValueMember" properties (the functionality should be same as in standard winforms controls). But the problem is common and can be used in webforms. Now, I'm trying get values via Reflection and DataRow/DataRowView. Should be supported more ways how to get/set...

Hidden field to store the int representation of an enumerated value

I'm a total asp.net newbie just fixing a bug in some code. I want a hidden field that displays the integer representation of a enum. Currently the following line displays the "Text" / human readable version of the enum. <asp:Label ID="lblNoteType" runat="server" Text='<%# Bind("NoteType") %>'></asp:Label> What do I need to do to the...

How do I make WPF data bindings refactor safe?

So I am working through my first WPF project and I am liking what I see so far. There was more of learning curve than what I anticipated, but nevertheless WPF is pretty cool. However, I am struggling a little bit with the data binding concepts. One specific question I have is how do I make my data binding declarations refactor safe? ...

A ComboBox Data Binding Question

I have an interesting data binding question related to combobox. Hope someone has some good suggestion. I have a simple form, it contains a file picker and a comboxbox. Every time a file is picked, I read a list of strings from the file to a List object and I set comboBox.DataSource = listOfStrings. In the form load event, I set comboB...

BindingNavigator issue?

I have a binding navigator which I am using to add/edit items. The problem I'm having is when I click the save button (button I added to the toolbar) my bindings dont seem to have taken effect. This code loads and binds my data. private void CompanyForm_Load(object sender, EventArgs e) { // Loads all of the c...

How to detect if ASP.NET control properties contain DataBinding expressions?

I have a custom control which inherits from System.Web.UI.Control and some of its properties can be declaratively set using databinding expressions. e.g. <foo:Foo runat="server" MyFoo="<%# this.GetFoo() %>" /> Now, when I do that I need to call .DataBind() on the control (or one of its parents) to evaluate these expressions. What I w...

Databind radiobutton group to property

Hello, I have a radiobutton group: <TextBlock Height="24" Text="Update Interval (min):"/> <RadioButton x:Name="radioButtonTimerNone" IsChecked="{Binding UpdateInterval, Converter={StaticResource updateIntervalToCheckedConverter}, Mode=TwoWay}"} Content="None" /> <RadioButton x:Name="radioButtonTimerOne" IsChecked="{Binding UpdateInterva...

WPF - How do you add an Event Trigger to a data template for a business object?

PROBLEM: I have a custom class named BlinkingLight. I also have a static ObservableCollection BlinkingLightCollection. In the UI, I have a ListBox that is bound to BlinkingLightCollection. In my ListBox I want to essentially display each BlinkingLight object as a custom control that looks like box with an LED light that has an animatio...

LINQ WPF Binding with Cross-Thread Collection Changed Notification

So, I've spent a good amount of time using ContinuousLinq to bind collections to WPF using LINQ in my client app. Now I get to testing and find out that ComboBoxes do not support collection change notifications cross-thread. Does anyone know of a Bindable LINQ solution that has an option to force change event to be raised on a given UIT...

Silverlight databinding

Well i have this code in my code behind Public Shared ReadOnly UsernameProperty As DependencyProperty = DependencyProperty.Register("Username", GetType(String), GetType(LoginControl), Nothing) Public Property Username() As String Get Return CStr(MyBase.GetValue(UsernameProperty)) End Get Set(ByV...

Spring.NET data binding with UserControl

I am trying to bind a public UserControl property to my model inside a parent page. I created a simple example to show what I am trying to do, you can see it on PasteBin or download it here The problem it that UserControl's property not binding to model, please check UserControl code: public partial class SpnTest : Spring.Web.UI.UserCo...

.Net Declarative databinding in nTier

I have an existing .Net single tier web app that is built using declarative data binding in the markup using EntityDatasource objects. I am in the process of extracting out the layers (Business Logic, Data Access) from the UI and migrating this to a ntier app. This app is using Declarative data binding. e.g.: <asp:DropDownList ID="...