wpf-binding

binding XCeed Grid

Is it ok to bind ListCollectionView to Xceed datagrid DataGridCollectionViewSource... I am able bind with observablecollection but not with listcollection View bith are dependency properties...Please help me ...

WPF DataTemplate performance

Well the problem here is that if you have one DataTemplate for a type of object, each time the object is present, the DataTemplate will be created, that sounds about right. My problem is that our DataTemplate is sort of heavy AND the app could have around 1000 objects using that DataTemplate. I created a simplistic example where I crea...

WPF - runtime updated binding question

Hello everyone! I'm quite a novice with C# and a complete newbie regarding WPF. Probably it's a very basic question and piece of cake for the pros. Please bear with me. I need to display a dynamic textblock with text changed in run time without additional triggers such as button clicks and so. For some reason (my insufficient understand...

Does WPF-DataBinding support asynchronous updates

I changed accidentally the value of a BusinessObject-property that implements INotifyPropertyChanged from within a BackgroundWorker (BackgroundWorker.DoWork). Amazingly, this led not to an error but actualized the text of the TextBlock that was bound to the property without any complaint. Is the execution of asynchronous bindings par...

Unable to Databind derived property in XAML

I’ve got a property in a base class (view model), which when used in data binding in XAML doesn’t show up. It does however show up when I move that property to the derived view model. Why? XAML: <TextBlock Margin="5,0,0,0" VerticalAlignment="Center" Text="{Binding Path=ResxMessages.SelectPathToDevice}" /> Code Behind: public abs...

Simple ItemsSource for testing purposes

Can someone show me a system-enumerable that I can access quickly as an ItemsSource to get test-data. I do not care what type it returns. The amount of data is also not very relevant, 100 or 10000 items, I do not care. The desired markup would then look something like the code below and idealy does not need any namespace-declaration: <...

Using datatemplate to bind object with multiple properties of same type to gridview

Using WPF, assuming I have 2 classes: public class SimpleType { public string Name { get; set; } } public class ComplexType { public SimpleType Item1 { get; set; } public SimpleType Item2 { get; set; } } and I want to bind a collection of these objects to a gridview, and in other places as well. I always want SimpleType ...

How to set row Background color for WPF DataGrid Programmatically (WPF & C#) based on the value in the DataGrid

Hi, I have a WPF Datagrid binded with list of interface objects. Consider, ClsEmployee class implements I_Employee interface with properties Empl_Id, Empl_Name, Department, Address and City_name. List _emplList; consider, _emplList has 10 items. dgEmployeeGrid.ItemsSource = _emplList; Question: Now, if the user clicks on a button, t...

WPF Validation and Data Templates

I'm looking for a way to validate all the data on a form that has tabs and the tabs contain data templates. I've been looking all over and found a similar question here: http://www.netframeworkdev.com/windows-presentation-foundation-wpf/wpf-validation-data-templates-74176.shtml, but that didn't get a good answer. Walking the logical tre...

Binding to a sub-property

I built a struct named Fraction, with three properties: double Value, int Numerator and int Denominator. In my data source I use the Fraction as a property, Fraction Position. The data is bound like this: <TextBox Text="{Binding Path=Position.Numerator}"/> <TextBox Text="{Binding Path=Position.Denominator}"/> but the binding happ...

passing the current Window as a CommandParameter

Hi there how can I pass the window I am currently on as a parameter to a command? I like to do this in XAML-markup: <Button Command="CommandGetsCalled" CommandParameter="-this?-" /> ...

How to use INotifyPropertyChanged correctly in WPF/XAML

I have a custom object that I am trying to bind to a control. On that custom object I have implemented the INotifyPropertyChanged interface. I have successfully bound to my object and a property on that object. What I can't figure out is how to go from there. I've been working on this for 2 days now and I still cannot get it working. M...

Translating Binding from C# to XAML

Hello, i can't get this binding working in XAML. Binding in c# works: public partial class myControl : UserControl { // get singleton instance InfoPool Info = InfoPool.Info; public myControl() { InitializeComponent(); // Test Binding Binding bind = new Binding(); bind.Source = this.Inf...

How do I bind an Entity Object to WPF TextBox?

I feel like I'm missing something very obvious here but I can't get basic binding to work with objects from my EDM. Here's my xaml: <TextBox Text="{Binding Path=receipt.STATUS}" Height="23" HorizontalAlignment="Left" Margin="371,276,0,0" VerticalAlignment="Top" Width="120" /> Here's my View code-behind: public MainWindow() { ...

Wpf binding question

Hello, This is my Listview XAML code: <ListView ItemsSource="{Binding Items}" Margin="0" Grid.Row="1" > <ListView.View> <GridView> <GridViewColumn Header="OperatorId" DisplayMemberBinding="{Binding OperatorId}" x:Name="operatorIdColumn"/> ...

How can I databind a non-command MenuItem IsEnabled to stay consistent with a command based MenuItem?

This menuItem because it's linked to a command does the magic behind the scenes for me: <MenuItem Name="mnuOpen" Command="Open"/> where I have <Window.CommandBindings> <CommandBinding Command="Open" Executed="CommandBinding_Open_Executed" CanExecute="CommandBinding_ProjectSelected"/>...

What's the best way of access a random number of controls in WPF DataTemplate

I'm building a questionnaire application that shows a series of questions to the user. To simplify the model, the question is represented by class Question{ String name; bool ComboBox; String[] choices; } In the code-behind I have a ObservableCollection that is used by the DataContext. The XAML looks like this ... <Item...

Binding to Children.Count

Hi, I'm using a binding of the form {Binding RelativeSource={RelativeSource Self}, Path=Children.Count, Converter={StaticResource CountToDimensionConverter}, ConverterParameter=Rows} Despite adding the children in xaml, when I break in the converter, the value is always 0. What I assume is going on is that the children are not adde...

Validate DataGridTextColumn with ValidatesOnExceptions=True after converting data from String to Integer

Hi, I have a WPF DataGrid With a Text Column. DataGrid is binded with a LIST<> and DataGridText Column is binded with a String Property but the value in this property can be only Numeric. But the Numeric validation on the DataGridTextColumn can't happen with the String value. So i have converted the value from String to Integer using a ...

DataGridCheckBoxColumn updates source and is validated only after focus loss.

I have a problem with DataGrid from WPFToolkit. My grid has DataGridCheckBoxColumn. When I change value of some cell in this column, validation and real source updating occures only after a cell has lost focus. So, if I change checkbox value in a cell and leave focus inside it, the property of a binded object wouldn't be changed. Colum...