wpf-binding

How to bind to a collection within a collection in WPF

Hi, I'm still at the early stages of learning WPF and have decided to try and write a fairly simple Contact Browser app to get to grips with the fundamentals. To add to the complexity I am using Objects from another application. So far I have been able to successfully bind a ListBox control to a Collection and display the Contact Name...

WPF ColorAnimation seems to retain part of original colour?

Hi guys, I'm having a strange problem with a colour animation. I have a list of items bound to a listbox. These items have an enum property which can have one of three values - NoRemarks, RemarksFound and RemarksUpdated. On the datatemplate for this listbox, I have a rectangle which displays a colour related to the item status - Red,...

How to set property only on second column of a ListView?

Introduction I have a ListView and want to format only the second column. The following XAML code does that: <ListView x:Name="listview"> <ListView.View> <GridView> <GridViewColumn Header="Property" DisplayMemberBinding="{Binding Path=Key}" Width="100"/> <!-- <GridViewColumn Header="Value" DisplayMem...

how to make changes to database in WPF?

Drag access database into designer xsd, toolkit:datagrid get datacontext from resources correctly show the table content through this binding. Press button in the button column, can show each row correctly. delete row and add row also work in datagrid however, when i press button column to add a new row or delete a row, there is no chan...

Binding Setting for the Custom control that implements ItemsControl

Hi Dudes, I have problem in wpf binding. I had developed a custom control that implements the ItemsControl. --> ...

WPF DataGrid : CanContentScroll property causing odd behavior

i have a solution where i generate a DataGrid (or multiple instances) based on user criteria.. each grid keeps receiving data as it comes in via ObservableCollection the problem i had, was that the scroll acted weird. It was choppy, and scrollbar would resize it self while scrolling. than i found.. CanContentScroll property! It comple...

databinding to self without code

I'm building a UserControl in WPF. The control has two properties, Title and Description, that I'd like to bind to two textblocks. Seems real straightforward, and I got it working, but I'm curious about something. To get it to work I had to add this code: void CommandBlock_Loaded(object sender, RoutedEventArgs e) { this...

How to bind local variable in WPF

I have silverlight usercontrol. This contains Service Entity object. see below public partial class MainPage : UserControl { public ServiceRef.tPage CurrentPage { get; set; } ... } I need to bind CurrentPage.Title to TextBox My xaml is here <TextBox Text="{Binding Path=CurrentPage.Title, RelativeSource={RelativeSource self}}"></T...

Binding from multiple element in wpf

I have 3 wpf control name "A" "B" "C". I want to bind C control height. Easy understand: C.Height=A.Height+B.Height This is my dream. :) < C > < C.Height > < SumBinding > < Binding ElementName=A, Path=Height/ > < Binding ElementName=B, Path=Height/ > < /SumBinding > < /C.Height > < /C > How to do it? Is it possible t...

WPF Pass current item from list to usercontrol

I am binding to an ObservableCollection<Stage> Stages as the ItemsSource for an ItemsControl: <ItemsControl ItemsSource="{Binding Path=Stages}"> Is there any way to pass the current stage object to a usercontrol in an item datatemplate like this: <ItemsControl ItemsSource="{Binding Path=Stages}"> <ItemsControl.ItemTemplate> <DataTempl...

Binding to UserControl property inside tooltip not working

Hello, I am trying to do some simple binding to a property inside my usercontrol. Does anyone know why this doesn't work? It works when the TextBlock is outside the Tooltip. Thanks! MasterPage.cs: MyUserControlInstance.DisplayName = "Test"; MyUserControl.xaml <ToolTipService.ToolTip> <ToolTip Template="{StaticResource ToolTipT...

Binding to a property of an instance of a class, or modifying the properties from code

I've been having trouble with some databinding with WPF. I have a class to hold various data. I want the data it holds to be binded to Text Boxes in a different window. Everything I've found reccomends this: <Grid.Resources> <c:PropertyModel x:Key="propMod" /> </Grid.Resources> <Grid.DataContext> <Binding Source="{StaticResource...

Enable button when text.Length > 0 in WPF only works when textBox loses focus - why?

Hi all, Simple WPF question I have a text Box and an OK Button and I am using a MVVM pattern. All I want to do is enable OK button only when textBox.Length > 0. But what I get is only when the textBox loses focus the button is enabled. Am I missing something? I have bound the datacontext to the viewmodel and done the following. Why ...

WPF DataTemplate property set at Content

New to WPF and have Tabs and in each tab the content is presented in a curved corner panel/window/whateveryouwannacallit. I wasn't sure how to do this ( Style, ControlTemplate ) but decided to go the DataTemplate way. So now I have this DataTemplate: <DataTemplate x:Key="TabContentPresenter" > <Border Margin="10" Border...

WPF troubleshooting: is there a way to see why binding fails?

so, i am trying to get the following to work: <Style x:Key="ToolTipVisibility" TargetType="{x:Type StackPanel}"> <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}},Path=EnabledToolTips}" /> calling this from inside of a xaml control, and the property is in my mai...

WPF: Binding to single complex item

Hi there, In my application, I use a UserControl instance to display the contents of a complex type that implements INotifyPropertyChanged that is a ViewModel to display the current state of background processes. This ViewModel is exposed to the UserControl as a DependencyProperty. The DependencyProperty is being set nicely, and events...

WPF: binding to a dependency property

I am following a tutorial here. which shows a basic example on how to bind to a dependency property. <Binding ElementName="This" Path="IPAddress" UpdateSourceTrigger="PropertyChanged"> where "This" is the name of the current window: <Window x:Class="SOTCBindingValidation.Window1" x:Name="This" whenever i try to do something like t...

WPF Change color in Xaml based off code behind property

I am trying to change the color of my label based off an enum set in xaml. I can not get the colors to update. Any help would be great. Thanks! <UserControl.Resources> <!-- Normal --> <SolidColorBrush x:Key="Normal_bg_Unselect" Color="#FF1A73CC" /> <SolidColorBrush x:Key="Normal_fg_Unselect" Color="#FF72BAFF" /> <Soli...

Displaying and editing a concatenated string enumerable in a bound WPF DataGrid

I'm using a WPF DataGrid with binding in order to display and edit various properties of a class. Many of these properties are IEnumerable<string>. I would like to display these concatenated, with each item of the enumerable separated by a newline character. The value must also be editable - after an edit, the concatenated string should ...

WPF combobox databinding both to custom objects and to datatable.showing System.Data.DataRowView in dropdown list items

Hello Gurus! I've posted a similar problem here and wasn't able to successfully implement the solution suggested to me as it wasn't working.I've found a way round and wanted to improve it by binding the combobox to a custom objects to enable data validation.here is the xaml for this one <Window xmlns:data="clr-namespace:Myproject"> <...