databinding

How to display in each ListBoxItem textblocks with binding to a filelds of a different tables

Greetings to all and sorry for my English! I have a ListBox, it's ItemsSource = myClientsList.DefaultView. The Items of ListBox have a template (ControlTemplate), that is defined in a in a separate resource file. Every Item contains a little TextBlock's, Text -property of each have a binding to fields of my Object myClientsList. I need ...

SqlDataSource manual Update how to?

Hi, I'm looking for a solution how to manualy call Update method on a SqlDataSource connected to a DetailsView. The problem is that if I call the Update method from a button.onclick event nothing happens. So I checked the parameters value in the Updating event of the sqldatasource and they are all null. I don't wan't to use a Command but...

Silverlight bind collection to Combobox in DataForm using MVVM

I have this problem, I've got Silverlight app written using MVVM. I need to create DataForm which is binded to property on ViewModel and I want to add ComboBox and fill it with values from other collection in the same ViewModel. Code: <dataFormToolkit:DataForm CurrentItem="{Binding NewUser, Mode=TwoWay}" AutoGenerateFields="False" Heig...

Help binding command parameter to relative source

I have a ListBox that I have added a context menu to. I want one of the items in the context menu to be bound to a command and I want the parameter passed to that command to be the currently selected item of the ListBox control. Here's my xaml: <ListBox x:Name="selectedVascularBeds" Ite...

IsSynchronizedWithCurrentItem attribute and current item updates

Hello I have a view model to manage a dialog type of view that allows filtering of a listing (if necessary) and selection of an item. The code works fine whether I set IsSynchronizedWithCurrentItem to true or not. My understanding is that this property is not true by default in a ListView, so I'd like to better understand this property....

Asp.Net Control parameter filled from <% data %>

<% foreach(Data.Abzac abzac in GetAbzaci()){ %> <abz:Paragraph runat="server" ID="ctrlParagraph" Abzac='<%= abzac %>' /> <% } %> Is this possible in some similar way, without DataBinding and reapeating controls? ...

Is it possible to bind a Spring Form to an Object using the constructor or by mapping multiple fields to a single value via a custom Editor?

I have an Object who's internal representation is not conducive to data entry. I have a class with multiple custom components, one of which is a Range class. The Range class is easiest to input using two text field inputs rather than as one text field that uses a custom PropertyEditor. I have a fully functional constructor that could ...

Treeview to display database - how ?

Work on asp.net vs 05 C#. I read many books on use of treeviews and they all display sitemaps. However I want it to display my own database for other purpose - eg supervisor-sunordinates/reports relation. Suppose my database is like this Supervisor,Staff =============== Peter, Mary Peter, Tom Winnie, Victor etc if exists (select * f...

DataBind listBox selected item to textboxes

Hi! I have ListBox data bind to list of users (collection): usersListBox.DataSource = null; usersListBox.DataSource = _users; usersListBox.DisplayMember = "Name"; usersListBox.ValueMember = "Id"; Now I want properties of selected item to be shown in different text boxes, so I do the binding: nameTextBox.DataBindings...

WPF Data Binding and Data from SQL DataTable - need some ideas.

Hello, i have a lot of some WPF windows. On them i write some code, which binds UI controls and data, something like this: public class AddressWindow { public string AddressID { get; set; } public string Addr1 { get; set; } public string Addr2 { get; set; } public string ZIP { get; set; } ...

WPF Show data from multiple DataContexts in ToolTip of ItemsControl

Hi, I am trying to display a tooltip for an item generated by an ItemsControl that needs to pull data from conceptually unrelated sources. For example, say I have an Item class as follows: public class Item { public string ItemDescription { get; set; } public string ItemName { get; set; } } I can display the Item within an It...

Can you call PadLeft inside a databound server control?

Say I have a label inside a gridview template column and I assign the text to the databound item, "OrderID". Is there any way I can call .ToString().PadLeft(7, '0') ? Here's the label as it stands: <asp:Label ID="lblOrderID" runat="server" Text='<%# "WW" + DataBinder.Eval(Container.DataItem, "OrderID") %>' /> Because PadLeft requir...

When exactly is a value returned from Eval() converted to a string?

Hi I thought Eval("JobTitle") converts returned value to type String, but that doesn’t seem to be the case, since value (returned by Eval("JobTitle")) passed to GetSelectedJobTitle() was of type Object and not String, which caused an error saying “cannot convert from object to string”. <EditItemTemplate> <asp:DropDownList ID="Ed...

Does Bind() retrieve a value moments before…?

Hi If user selects another item in ddlJobs, then I assume for Bind() to be able to retrieve the newly selected value, SelectedIndexChangedEvent needs to be fired before Bind() tries to retrieve the value of ddlJobs.SelectedValue property? So when exactly does Bind() retrieve a value from binded property? Moments before the updating ...

How to trim whitespace from a data-bound XML element in WPF using XPath?

How can the whitespace at the start and end of the content of an XML element be removed when binding to the element using XPath in WPF? ...

WPF - Binding in XAML to an object created in the code behind

Can an object created in the code (ie C#) be used for binding in the XAML? For example: public class MyForm { private MyComplexObject complexObject; public MyForm() { InitializeComponent(); } public OnButtonClick(object sender, RoutedEventArgs e) { complexObject = new MyComplexObject(); } }...

monitoring a range of cells inside of excel 2007 with C#/VSTO

I have a row in excel I'd like to translate into an ObserveableCollection in C# for binding/event purposes, so all accessor classes know they're getting the latest data from the source excel sheet. How would this be done? Clarification: I'm using an excel add-in project, not a workbook project, so am not sure whether or not XMLMappedRan...

DataTrigger / Style quick in XAML

Hey I have an Ellipse defined as so <Ellipse Stroke="#FF474747" Style="{StaticResource SelectedTemplate}" Fill="{StaticResource RedGradient}" /> I also have two styles setup like so <RadialGradientBrush x:Key="RedGradient" GradientOrigin="1,1"> <GradientStop Color="White"/> <GradientStop Color="Red" Offset="1"/> </RadialGrad...

WPF Data Binding - Example of "Custom Type Descriptor"

I see several people saying that WPF can use "Custom Type Descriptors" for "Change notification". The ways I know how to do Change Notification are: object.GetBindingExpression(Bound.property).UpdateTarget(); Or have my object implement INotifiyPropertyChanged. I see comments saying that Custom Type Descriptors will work too, but no...

C# datetime binding

Hello, I have a textbox I want to bind to DateTime property to an object : myTextBox.DataBindings.Add("Text",myObject,"DateTimeProperty") myTextBox.DataBindings["Text"].FormatString = "HH:mm"; myTextBox.DataBindings["Text"].FormattingEnabled = true; myTextBox.DataBindings["Text"].BindingComplete += delegate(object sender, B...