wpf-binding

Attached Property and Binding

I'm creating an attached behavior in order to set a regular property of a class: public class LookupHelper { public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.RegisterAttached("ItemsSource", typeof(object), typeof(LookupHelper), new UIPropertyMetadata(null, OnItemsSourceChanged)); private static...

How to call a user control method using MVVM?

Hi, I'm working in a WPF project, I'm using the MVVM patter in my project. I created a user control (also in WPF) and I want to use it in my project, now, my problem is that I have a method in my user control that I need to call from my View Model, but I don't know how to do that, how to bind to the method inside my control from the vie...

WPF Databinding to generic List<>

SOLVED SOLVED SLOVED the generics list was a list of structs if you use a class instead of a struct it works fine i.e. public class Person { public string Name { get; set;} public string ID { get; set;} } instead of public struct Person { public string Name; public string ID; } I am doing somethin...

How can I bind a ListBox's items to a List of instance objects?

My code behind file receives an instance object Session which has a property AvailableCountries that returns a List. Each Country object has a Name property which is a String. I also want to display these Country objects using a data template which I simplified here. My current code is after going through a WPF binding tutorial, only t...

How to rollback changes made to a object in silverlight 3 with a TwoWay binding

I have a Silverlight 3 project. I have a textbox that is TwoWay data bound to an object. If the user wants to cancel the changes that they made to the textbox, what is the best way to undo the changes to the bound field on the object? I know I could store the initial value in a separte variable when the object is loaded, but I was won...

MVVM: Binding radio buttons to a view model?

I have been trying to bind a group of radio buttons to a view model using the IsChecked button. After reviewing other posts, it appears that the IsChecked property simply doesn't work. I have put together a short demo that reproduces the problem, which I have included below. Here is my question: Is there a straightforward and reliable w...

Property Binding to Static Properties in WPF: Width binding doesn't work

Update: I've corrected the post, so the question is closed. Expected result: Menu width must be equal to the main window width. Here is full code: <Menu Name="menu1" DockPanel.Dock="Top"> <Menu.Width> <Binding Path="MainWindow.Width" Source="{x:Static Application.Current}" UpdateSourceTrigger="P...

List the items in listview according to groups, the data is taken from observable collection

i hav one class which stores file information with namelist as itz observableCollection Imports System.Collections.ObjectModel Public Class NameList Inherits ObservableCollection(Of FileInfo) ' Methods Public Sub New() MyBase.Add(New FileInfo("Willa", "Cather", "warning", "err 1")) MyBase.Add(New FileInfo("Isak", "Dinesen"...

2 quick WPF (Windows presentation foundation ) questions on tabs and combo boxes.

Hi, I am a very novice WPF programmer, so need help in some simple tasks. 1- As the image shows, I want the (+) tab(it's a tab created with TabItem as of now or should it be button or something else? :-/) to create a tab left to it, say (A1), pressing again, should create (A2), sort of like in tabbed browsers......... And if possible,...

Datagrid (editable issue, access issue) in WPF

I created a Datagrid, as shown in this figure --> http://img682.imageshack.us/img682/5109/datagrid.png where user is supposed to enter data. In one of columns, I added Combobox.Now, the Datagrid won't allow me to enter data in the cells. IsReadOnly="False" was also not working, it was giving some "EditMode exception". So, what I did wa...

Get Distinct Value from Observable Collection Class

Hi I am using Linq-To-SQL. I have made one class by inheriting ObservableCollection This class has one constructor with Datacontext as parameter. I have calling this construtor from my program and assigning it to the control's ItemSource property. But I can't get distinct value in it.. public class BindBookIssueDetails : Observab...

Problem Binding via command.Can you help

Hi New to wpf and through a learning curve. I have a userControl with a Toolbar Save Button and a TextBox. What I am trying to achieve is as follows When I press the save Button in the toolbar I should record in the textbox that I am about to save and that I have saved the customer (CustomerView UserControl) I seem to have 2 problems...

With WPF DataBinding how do I have multiple clients for single source?

I have a data class that implements INotifyPropertyChanged and two WPF controls that DataBind to the same value. Only one WPF control is updated, why? Here is my data class: using System; using System.ComponentModel; using System.Windows.Threading; namespace TestMultiBind { class DataSource : INotifyPropertyChanged { s...

Error ! Couldn't create instance of type (Designer Reloading Problem)

Hi I am using Linq-To-Sql I made a class by overloading observable collection.. After that i added assembly namespace of my project. xmlns:s="clr-namespace:WpfApplication1" Window.Resources <s:DataBinding x:Key="EmpName" /> ...... /Window.Resorces After that make a data template to bind controls.. After all thing d...

Custom activity in WF 4.0: WorkflowItemsPresenter wont show converted array

Hi There, we have an Array which is converted via a Binded Converter: else if (TTools.IsOfBaseClass(value.GetType(), typeof(System.Activities.Presentation.Model.ModelItemCollection))) { OurBaseClass[] test = (value as ModelItemCollection).GetCurrentValue() as OurBaseClass[]; List<OurBaseClass> list...

(WPF)how to raise Datatemplate's Context MenuItem event

Hi Experts, I have a listbox and its data template. Items of listbox are binded with a static source. In data template I have a button, and created context menu of it and some menu items. <ObjectDataProvider x:Key="GlobalUnits"/> <DataTemplate x:Key="listboxTemplate" DataType="UnitClass"> <StackPanel Margin="3" > <DockPa...

WPF: How do I prevent users from entering text in a Textbox data bound to a numeric property?

WPF: How do I prevent users from entering text in a Textbox data bound to a numeric property? ...

How to pass Command Parameter in WPF?

I want to pass the Button Event Arguments as a CommandParameter on a WPF Button. What would be the syntax I should use? <Button x:Name="btnMain" Command="viewmodel:ApplicationCommands.MyCommand"CommandParameter="{Binding ???}" /> ...

IValueConverter Visibility Property

Hi All, I need to display a button depending on the value in the database. For Eg. If the value of the object is empty I need to display a button that says Create Data. And if the object does have a value, I need to display 2 buttons that say Update Data and Edit data. I tried to use 2 converters for this. The first one displays Create...

Binding ComboBox with LINQ XML

Hello, Excuse me for my poor English, that is not my native language. I'm a beginner (since 3 days) with WPF and LINQ, and a casual user of C#. Yesterday, i've trying all the day to solve my probleme and read several documentation, but a bug in my code persist. I pass a XElement to a control who bind its content, but i've a but in th...