databinding

WPF: Binding the height of a component to another's.

I have, in a window, a Grid that contains a RadioButton, a TexBox and a Button, each in column 0, 1, 2, respectively. They all have their heights set to auto. Then, in another part of the window, I have another grid with a Label, a TextBox and a Button, in columns 0, 1, and 2. Heights are also set to auto. The problem I have is that th...

WPF: Stop Binding if a UI element is not visible

Can i delay binding of a ui element if the element is not currently visible. Sometimes i have a form that has some hidden/minimised elements, i would like to not update them if they are not on the screen. I suspect the answer is no, but it never hurts to ask? ...

Binding a WPF Listbox to Xml in Button_Click event?

Hi, I am trying to bind a ListBox to Xml in Button_Click event in xaml.cs. my Xml is simple <books> <book>ABC/book> <book>XYZ</book> </books> Here's what I am doing.. in xaml.cs XmlDocument x = new XmlDocument(); x.LoadXml(e.Result.ToString()); listbox1.ItemsSource = x; and Xaml ...

DataBinding and Timer in WPF ?

Hi, I'm gonna write a code with DataBinding and a Timer to change an Image sequentially. e.g: in each two seconds. below is my C# code : public class GenerateRandomImagePath { Random random = new Random((int)DateTime.Now.Ticks); readonly int MinInt; readonly int MaxInt; readonly string PrefixImagesName; readonly s...

Bind SelectedValue of ASP.net DropDownList to nested property

(first of all, it seems this is a subject that is discussed many times before, but I can't find a proper answer for my case) I have a asp.net FormView with a DropDownList for the selection of a month. The FormView is data bound to an ObjectDataSource. <asp:DropDownList ID="MonthsList" DataSourceID="MonthsListDataSource" DataTextField="...

Default values in WPF DataBinding ?

Can we set default values in WPF DataBinding? e.g : I've bound the Height and Width of my window to some properties as follows. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" x...

Best practice grid binding

Hello, I have some experience in developing business logic and database logic and primarily work with C#. Now I would like to build my first data-driven presentation-tier in ASP.NET. I was just wondering how I should fill my DataGrids with data. I have IList - Collections of business entities such as "Customer" which I retrieve from my...

Listbox ItemTemplate - Binding to xml attribute value

I am trying to bind the value of the ItemTemplate on a listbox to an attribute in my xml data. The attribute value will match the key of a data template I have defined elsewhere. When I try the following I don't get any build errors but nothing shows up in the ItemContainer (its obviously not associating the value of the node with a res...

Using binding for the Value property of DataTrigger condition

I'm working on a WPF application and struggling with a data trigger. I'd like to bind the value of the trigger condition to some object I have: <DataTrigger Binding="{Binding Foo}" Value="{Binding ElementName=AnotherElement, Path=Bar}">.. However, I'm not allowed as it doesn't seem to be possible to use bindings for the...

Databinding, what’s the point if I have to recreate the binding every time I want to show data from a different row

Am I missing the point here, I don't see how this is any better than just assigning the Text property of a Label directly? //class variables Binding stateBinding; MyRowType rowForDataBinding; ChangeBoundData() { rowForDataBinding = GetNewRow(); lblStatus.DataBindings.Remove(temp); temp = lblState.DataBindings.Add("Text", row...

List<T> vs BindingList<T> Advantages/DisAdvantages

Can someone describe what the difference between the two are for my project. Currently I have a List<MyClass> and set the BindingSource to that and a DataGridView to the BindingSource. I have implemented IEditableObject so when CancelEdit is called I revert my object back to what it was with a Memberwise.Clone() Will changing my List ...

IValueCOnverter Not Working

Hi There, Been googling this problem for hours, and cannot see where I am going wrong. I have the following converter which just returns Brushes.Red(have tried Colors.Red) as well but still no luck. public class ColorConverter : IValueConverter { private static ColorConverter instance = new ColorConverter(); public static Colo...

ASP.NET MVC - Model Validation regarding its dataType Length

Hello there, I'm using ASP.NET MVC 1 on a project where I would like to validate my form submission with the ModelBinding helpers, actually I am validating it with ModelState.IsValid but it doesn't seem to consider the dataType length when validating it. For example: I have a field nvarchar(70) called Name , but when in my form I submi...

Simple CRUD work with WPF and data binding.

I'm new to WPF for Windows application development, just wanted to put that out there first. I'm using Visual Studio 2010 and .NET Framework 4.0. I'm working on a rather simple administration tool. For simplicity sake lets say I'm working with Employee data. I've created a little UserControl called UserDetail that has all the fields ...

Data change notification in Silverlight listbox with databinding to WCF Service

I have inherited some Silverlight\WCF code and now need to implement some new features. I fairly new to Silverlight\WCF so my question may be rather basic. So... I have a listbox in Silverlight that binds to a resource that is a List<> returned from a WCF (rest) service (which is just reading values from a db table). I have implemente...

Winforms Databinding with a ViewModel

I have a list of classes that represent mydatabase tables for example Address,Client. My GUI tends to be a grid of data and an data entry form. This works fine for single table data entry however I now have a form that has client information and their address. I was thinking of using a ViewModel combining the Address and Client class ...

WinForms data binding

I am new in data binding. I have those classes: public class Foo : List<Bar> { public string FooName { get; set; } } public class Bar { public string BarName { get; set; } public string BarDesc { get; set; } } And I have a List<Foo> I would like to have Foo items in ComboBox, and Bar items in ListBox. When I change sele...

wpf databinding with a user control

I have a wpf user control, which exposes a single custom dependency property. Inside the user control, a textblock binds to the value of the dp. This databinding works in all scenarios except when the data source is an object. The minimal code necessary to reproduce this is: this is the main part of the user control <StackPanel O...

Databinding to XML in a DataTrigger in WPF

In a WPF application, I have correctly bound a DataTemplate to an XML node that looks like: <answer answer="Tree", correct="false" score="10" /> In my application, I have a TextBlock with the answer in it. At first, I want it invisible, but when the correct attribute in the XML file changes to "true", it must become visible. My DataT...

binding int values from server side - asp.net

Hi All, Quick question here. I'm sure it's possilbe, just can't get it to work. I've got a gridview. In have a gridview. The gridview is bound to a list of my custom class. The class exposes a link to an image as well as the image's height and width. I have a Image Control in the gridview. I've bound the Image Url to the correct propert...