wpf-binding

Get notified of DataContext changed in a WPF Resource

Hi all: I'm having an annoying problem with WPF binding. Basically, I declare a FrameworkElement in my UserControl's resources, but that item doesn't seem to get notified when the DataContext of the parent UserControl changes. Basically, in my UserControl I have a Popup in the ItemTemplate for an ItemsControl. In that Popup, I needed...

WPF TreeView binding to a simple object

I have a simple object as such: public class Info { public string Name {get; set;} public int Count {get; set;} public DateTime TimeStamp {get; set;} } I want to bind a collection of these objects to a WPF TreeView and have the properties on the Info objects show up as sub TreeViewItems, like so: Item 1 Name: Bill Count...

Accessing the selected element inside a templated textblock bound to a wpf listbox

Hello good people , i'm trying to achieve a functionality but i'm don't know how to start it. I'm using vs 2008 sp1 and i'm consuming a webservice which returns a collection (is contactInfo[]) that i bind to a ListBox with little datatemplate on it. <ListBox Margin="-146,-124,-143,-118.808" Name="contactListBox" MaxHeight="240" MaxWidth...

Can a DependencyObject control how a DataGrid Auto Generates Columns?

Hi All, As an example of what I am trying to do. I have a DependencyObject called CompanyDivision. It has a DependencyProperty returning a FreezableCollection<Employee> called Employees. Employee is also a DependencyObject. I can then uses the WPFToolkit DataGrid.ItemsSource to bind to CompanyDivision.Employees with the AutoGenerateCo...

WPF multibound textblock not updating

I want to create a program which calculates how long it will take to repeat a process a certain number of times. I've scaled this down a lot for this example. So, I have some textboxes which are bound to properties in a class: Count: <TextBox x:Name="txtCount" Text="{Binding Count, Mode=TwoWay}" Width="50"/> Days: <TextBox x:Name="txtD...

How to force uniquness in collection Item

Hi I have scenario in project where we need to fetch all active book records from database and hold in observablecollection. This observale Collection is bound to grid control in WPF application where user can add remove books. We need to persist all added, removed and modified records in collection till user hit the save to database. O...

How to Bind MouseDoubleClick Event

How can I bind a MouseDoubleClick event of a DataGrid to a delegate command and get the selected item of that grid.? I want to do this in XAML file as I'm using Prism 2.0 and MVVM pattern. ...

I'm confused in WPF Validation IDataErrorInfo vs ValidationRules!!

Hello Good People! I'm building my first WPF application and some of the validation techniques are getting me confused the more i google looking for a solution. My application connects to a web service and pulls data for manipulation.After manipulation the app calls another method for example to send the manipulated data. (for example i...

How does one bind to a List<DataRow> collection in WPF XAML?

Using a DataView one can specify the binding for controls in XAML for example as follows: <Image Source="{Binding Thumbnail}" /> I have a control that displays a number of images. I can get this to work with a DataView as the data source for the control, but I want to use a List collection of DataRow objects, which is not not working ...

Binding AutoCompleteBox inside DataTemplate

I have the following AutoCompleteBox defined inside DataTemplate: <Window.Resources> <DataTemplate x:key="PaneTitleTemplate"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinition> <ContentPresenter Content="{Binding}" /> <toolkit:AutoCompleteBox x...

how to pass data when using MenuItem.ItemContainerStyle

Hello Experts! i've been trying to have a dynamic ContextMenu to show the name property of each of the object in its collection of objects. here is concrete example ,i'm connecting to a webservice to pull contacts and groups of a particular account.so i have those as global variables.i display the contacts in a listbox and i want to sho...

Issue with binding Collection type of dependency property in style

Hi, I have a customcontrol exposing a Dependency property of type ObservableCollection. When i bind this properrty directly as part ofthe control's mark up in hte containing control everythihng works fine <temp:EnhancedTextBox CollectionProperty="{Binding Path=MyCollection, Mode=TwoWay}"/> But when i try to do the binding in the ...

How to bind a datatable to a wpf editable combobox: selectedItem showing System.Data.DataRowView

Hello Good People!! I bound a datatable to a combobox and defined a dataTemplate in the itemTemplate.i can see desired values in the combobox dropdown list,what i see in the selectedItem is System.Data.DataRowView here are my codes: <ComboBox Margin="128,139,123,0" Name="cmbEmail" Height="23" VerticalAlignment="Top" TabIndex="1" ToolTi...

Data binding manually update in WPF MVVM

My ViewModel: class ViewModel { public string FileName {get;set;} } and in my View I bind a label's content to ViewModel's FileName. now When I do drag-drop a file to my View, How can I update the label's Content property, so that the ViewMode's FileName also get updated via binding? Directly set the label's Content property won't w...

WPF binding not updating until after another action

I have an observable collection bound to a listbox in WPF. One of the options in the window is to use an OpenFileDialog to add an item to the listbox with certain properties. When I use the OpenFileDialog it immeditaely sets two of the properties of the new item in the observable collection. I am using INotifyPropertyChanged to update th...

How to trigger binding source update from code in WPF?

In My ViewModel class I have a property: class ViewModel : INotifyPropertyChanged { public string FileName {get;set;} } and in my View I bind a label's content to ViewModel's FileName. now When I do drag-drop a file to my View, How can I update the label's Content property, so that the ViewMode's FileName also get updated via binding...

Bind WPF control with property of custom type

Hello everyone, I'm trying to bind a Label's 'Content' property to a property from some custom type I have; unfortunately, I didn't figure out how to do it, and that's why I'm here :) Let's assume that I have the following type (can be in the same namespace as my WPF Window that contains the Label or different namespace): namespace My...

WPF Custom Control - Designer looks fine, but I get a runtime issue...

MainWindow.xaml <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:my="clr-namespace:MyStuff;assembly=MyStuff" Title="MainWindow" Height="350" Width="525"> <Grid> <TabControl Margin="5"> ...

How to bind a WPF CustomControl to a ListBox

I've just started to learn WPF this week so please accept my apologies if I am being stupid or missing fundamental points! Iam trying to build a very simple Contact browser. I have a Collection of Contact objects that displayed in a ListBox control which shows the FullName of the Contact and to the right I have a customControl called...

.Net : Need for a tutorial about how to create a Wpf user control (multi - column combobox) which can be binded to Database in other project

.Net : I'm new in Wpf so need for a tutorial about how to create a Wpf user control (multi - column combobox) which can be binded to Database in other project (windows application)? ...