databinding

WPF UserControl in DataTemplate within ItemsControl - how to bind to parent of ItemsSource

The subject line says it all really! I have a user control which can be bound successfully to, say, a Fullname object - i.e. it works ok. I now need to show a list of these and, again, this works ok when the control is in a DataTemplate within ItemsControl.Template. But, the control has a property (InEditMode) that is not a property ...

Bind to an attached behavior on a Storyboard

I have created an attached dependency property for Storyboards, with the intention of enabling me to call a method on my ViewModel when a Storyboard Completed event fires: public static class StoryboardExtensions { public static ICommand GetCompletedCommand(DependencyObject target) { return (ICommand)target.GetValue(Comp...

WPF Binding Fails. Why?

I have this Markup: <GroupBox BorderThickness="2"> <GroupBox.BorderBrush> <SolidColorBrush x:Name="Border"> <SolidColorBrush.Color> <MultiBinding Converter="{StaticResource ConnectionAndLoggedInToBorderBrush}"> <Binding Path="IsConnected"/> <Binding Path=...

Update Panel and Drop Down List databinding twice - lifecycle

I think this is an asp.net page life cycle question, but none the less, i can't quite figure it out. I have a drop down list in an update panel that lists users and then shows details below it (update or delete). When the I click delete, the code behind goes and clears the ddl (to remove the deleted user), and then rebinds it. All fin...

How to add empty or custom value to a bound combobox?

I am using a System.Windows.Forms.Combobox bound to Category table as search criteria. I need to have a value “All” or empty string that will be selected when user does not want to use this criteria. Since combo is bound, each time it is clicked, value added by combo1.Text = “All” is erased. Obviously, I can’t add “All” category to data...

Problem with conditional databinding

hi guyz. i ve been strugling to find some way to do my required conditional binding, but i am lost :s i want to use Eval("products_image") in conditional binding in such a way that if product_image exists in images directory then its ok, otherwise it should display "noimage.jpg" i tried to do it this way: <%# (File.Exists(("ProductI...

Databinding to a custom class in C#

Hi, I have a class like this: public class Person { Int32 id; Boolean isMarried = false; String displayName; Detail mainDetail = new Detail(); Detail partnerDetail = new Detail(); } public class Detail { String firstName; String lastName; DateTime dob; String address; } And then a Form which has se...

In WPF, Selecting ItemContainerStyle based on data bound content

In #WPF you have ItemTemplateSelectors. But, can you also select an ItemContainerStyle based on the datatype of a bound object? I am databinding a scatterview. I want to set some properties of the generated ScatterViewItems based on the object in their DataContext. A mechanism similar to ItemTemplateSelector for styles would be great. I...

Asp.Net and Shadowbox

Trying to pop up an IFrame Shadowbox with Jquery from an asp:gridview datarow. I can't get the proper quotes into the string: <asp:ImageButton ID="btnEdit" runat="server" OnClientClick='<%# "javascript:popAccount(\'"+ Eval("id", "Popup.aspx?id={0}")+"\');" %>' /> Parser Error Message: The server tag is not well formed. Witho...

Unable to set initial value when databinding combobox to Dictionary<char,string>

I have a simple Dictionary defined as ResultOptions = new Dictionary<char, string> and my viewmodel has a public property ResultCode of type char. My XAML is as follow: <ComboBox ItemsSource="{Binding ResultOptions}" DisplayMemberPath="Value" SelectedValuePath="Key" ...

AutoCompleteBox not retaining text

I have a Silverlight test project where I'm returning a List< ProductInfo > ... public class ProductInfo { public override string ToString() { return Name + " - " + Description; } public string Name { get; set; } public string Description { get; set; } } It is successfully returning the name and descripti...

DataBound CheckBoxList

Hi, I have a website programmed in Asp.Net and use a ListView for displaying data. The data is coming from a LinqDataSource. In my EditItemTemplate I have a CheckBoxList which consist of: <asp:CheckBoxList runat="server" ID="TypeCheckBoxList" RepeatColumns="2"> <asp:ListItem Value="128">6.-10. klasse<br />Norddjurs vejleder</asp:List...

Change when a RIA Services DataForm sends changes to the backing object

DataForms seem to update their CurrentItem as soon as the user tabs out of a field. This happens even when AutoCommit = false. The side effect of that behavior is that other controls that are bound to the data update while the user edits data instead of when the user clicks Ok to accept the DataForm changes. Is there a way to modify t...

Problem databinding a custom control in silverlight

I'm attempting to databind a custom control in Silverlight 3 and I'm getting strange problems with it. My xaml for the user control is this: <UserControl x:Class="StronicoMain.GenericSmallIcon" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="4...

linq-to-sql implementing row level save/commit/rollback

Is there a recommended way to implement individual row-level change tracking? such that when a change is made to more than one row before a save is called, changes that the database doesn't reject move forward, the ones that don't aren't? I have am trying to figure this out for two projects a ticketing database, and an asset management d...

How to get a Content control to present a data template for a selected field in a WPF gridview?

so I have the following definition for a DataGrid control: <Custom:DataGrid x:Name="dataGrid" ItemsSource="{Binding Units, Mode=Default}" AutoGenerateColumns="False"> and later in the same XAML document I have the following Content control: <ContentControl Content="{Binding SelectedUnitResults, Mode=TwoWay}"/> What I would like to ...

Why can't I make a binding inside asp:Textbox's Text property?

I have the following DataList: <asp:DataList ID="values" Visible="false" runat="server" DataKeyField="Id"> <ItemTemplate> <div id="row" style="height: 25px; vertical-align: top"> <div id="left" style="visibility: hidden; width: 25px"> <%# DataBinder.Eval(Container.DataItem, "Id") %> </div> <div id="middle" style...

Using databinding whenever I can?

Hello! I have a Question: Should I use databinding whenever I can? I will explain myself. I have a class instantiated on the Main Windows ViewModel, I have this class istantiated because I have a section on the window that will use it. The problem is that section on the window will be used very few times, then, I have a class instan...

problem updating row in Gridview with bound combobox

i have the following gridview <asp:GridView ID="GridView3" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="CommentsDataSource"> <Columns> <asp:BoundField DataField="Firstname" HeaderText="Firstname" SortExpre...

Delayed "rendering" of WPF/Silverlight Dependency Properties?

Is there a way to know the first time a Dependency Property is accessed through XAML binding so I can actually "render" the value of the property when needed? I have an object (class derived from Control) that has several PointCollection Dependency Properties that may contain 100's or 1000's of points. Each property may arrange the poin...