databinding

Data Binding Dissimilar Types...

Trying to accomplish: I want to change the image property of a bound tree node when the value of an enumerated property changes on the bound object. Bound Object is representation of an airfield or vehicle base in a game. The object has a property of Type which is an enumerated value type: SmallAirfield, MediumAirField, LargeAirField, ...

WPF ListBox: how to update data with binding

I have listbox that displays information about list of objects: <ListBox Grid.Column="0" Height="152" Name="CustomersList" HorizontalAlignment="Stretch"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name, Mode=OneWay}"/> <...

Checkbox DataBindings - Checked vs CheckState

Can anyone tell me the pros and cons of using the checkboxes checked property vs the CheckState property for databinding? Thanks. ...

ListView databinding behavior

I have what I think to be an odd problem with listview databinding. I am calling a protected method on my code-behind called ItemHtml() - as seen below. <ItemTemplate> <div class="itemWrapper"> <%# ItemHtml() %> </div> </ItemTemplate> The method is defined as follows. protected string ItemHtml...

WPF Conditional Binding

Hello, I have a TreeView and a couple of other controls like TextBoxs and ComboBoxs. The textboxes are bound to the selected item in the treeview like this: Text="{Binding SelectedItem.Name, ElementName=groupTreeView}" This works fine if all the elements in my treeview have a Name Property. I was wondering if there was a way to do so...

WPF Bind to DependencyProperty of another Object?

Hi All, I am working on a WPF application similar to visio. I would like to be able to logically group some of the items in my diagram, each of which is a UIElement, and control certain behaviors (i.e. visibility) at the group level. My first attempt at this was to create a control, called a Group, which had width & height = 0. I w...

How to pass a custom format string to DateTimeConverter?

I have a list of business logic objects that is bound to a Winforms DataGridView, and it contains DateTime fields. By default they get converted into a long date and time string. I want the fields to be converted automatically into HH:MM format. I've discovered that I can attach a TypeConverterAttribute to a field with a subclass of Typ...

NHibernate, WinForms, and DataBinding - do they play well together?

I've been using WinForms databinding to display data from a database mapped with Fluent NHibernate, and that's been working great. For example, I can just set a DataGridView's DataSource property from an entity's IList property, and voila - there's all the data! But now I need to start adding and saving new data rows, and that's not g...

DataBinding Lists in a DataGridView with ComboBox

I am looking at DataGridView to assist with the following functionality without DataSet/Table usage. I am replacing few columns with the DataGridViewComboBox. As a specific and slightly contrived example below, I am replacing AccessID column on BindingList (of Setting) : class Setting { public int AccessID { get { return ... } set { ....

ASP.NET view engine won't execute my code snippets

I have an asp:DataGrid with templated columns. Here's one of those columns: <asp:TemplateColumn> <ItemTemplate> <asp:LinkButton ID="btnDetails" Runat="server" CommandName="details" Text="Details" Font-Size="0.8em" CommandArgument='a=<%# Eval("a")%>&amp;b=<%# Eval("b")%>' /> <...> When the command fires, the Comma...

Variable repeater columns

Hi All, I have an objectdatasource which i want to bind to a repeater. the problem is, I cannot work out how to display a variable amount of columns with a variable amount of rows. for example: The dataset I have is structured like this. The objectdatasource is a List<item>. item { string name; List<itemdata> data; } itemdata { ...

Bind a Wpf HierarchicalDataTemplate ItemsSource to a CollectionViewSource in a dictionary?

I'm trying to display a Wpf Treeview with items sorted by a CollectionViewSource. Currently, everything is working except sorting using this code in my resource dictionary: <HierarchicalDataTemplate DataType="{x:Type books:Container}" ItemsSource="{Binding Path=Items}"> <nav:ContainerControl /> </HierarchicalDataTemplate> What wo...

How to show WPF ValidationResult in a seperate textblock?

I am trying to use in WPF a validating input of databound controls with validation rules. I have a posintValidationRule class: public class posintValidationRule : ValidationRule { public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { string _strInt = value.ToStri...

Data binding fails when changing numbers on numericUpDown

Hi. I have a databinding like this: numericUpDown1.DataBindings.Add("Value", myBox1, "Width"); Whenever myBox1.Width changes it will update numericUpDown1.Value. The problem is when entering new numbers on the control, myBox1.Width will not be updated immediately, but only after the cursor leaves the text area of the control. Is...

Label and GroupBox triggers not working, same trigger works on StackPanel

I have a set of triggers in a XAML form, and for the life of me I can't figure out why one set works, and the other doesn't, despite being bound to the exact same variable. First, the triggers that do work: <StackPanel Orientation="Vertical" Margin="25,0,0,0"> <StackPanel.Style> <Style TargetType="{x:Type StackPanel}"> ...

DataRelation between two data tables - can't bind data to a listbox (C# .NET 3.5)

C# (.NET 3.5) I have an SQLite database with two tables - employees (the first column being id INTEGER PRIMARY KEY), and holidays (id INTEGER - meaning the ID of the employee; start DATE, end DATE - self-explanatory). My form contains textboxes, checkboxes etc. to represent the employee details - but say I'd also like a list box, listi...

Silverlight/WPF and Blend: DataBind a text field, but define a design-time value?

Hopefully this is simple - I DataBind a bunch of labels and text controls in a Silverlight application (to DependencyProperties that I create in my class), but of course the text is empty at design time. I'd still like to have an idea of how this will be laid out; is there a way to specify a design-time value, even though it's databound...

I'm getting 'Duplicate id error' after adding 'binding' attribute

Here is JSF code: <o:chart id="categoryLineChart" model="#{categoryReports.categoriesLineChart}" view="line" rendered="#{categoryReports.reportRendered}" height="#{categoryReports.scaleHeight}" width="#{categoryReports.chartWidth}" binding="#{categoryReports.lineChartComponent}"> <o:chartNoDataMe...

Binding the Checked Property of a CheckBox within a TemplateItem

For the life of me I cannot bind the Checked property of a CheckBox control within a TemplateField (declaritively). I have tried: <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="deactivated" runat="server" checked="<%#Eval("Deactivated")%>"></asp:CheckBox> </ItemTemplate> <...

WPF advice on XML data binding: XmlDataPresenter vs custom class?

Hello there, I'm just starting out in WPF and I'm building a simple movie library as a test project to help me find my feet. I'm storing my movie information in XML, for example: <movie id="1" title="Back To The Future" date="1985" ... /> The movies appear in a list and when clicked the fields will become editable. I've got that w...