wpf-binding

How do I invert BooleanToVisibilityConverter?

Hi, I'm using a BooleanToVisibilityConverter in WPF to bind the Visibility property of a control to a boolean. This works fine, but I'd like one of the controls to hide if the boolean is true, and show if it's false. Is this possible? Thanks, Andy ...

WPF binding not working properly with properties of int type

Hi, I am having a property of int type in my view model which is bound to a text box. Everything works properly, two way binding works fine except in one case - If i clear the value of text box, property setter doesn't gets called and although value is cleared in text box, property still holds the previous value. has anyone faced simi...

Programmatically change validation rule in WPF TextBox

I have a text input area defined like this: <TextBox> <TextBox.Text> <Binding Path="MyProperty"> <Binding.ValidationRules> <valid:MyValidator/> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox> My problem is that, dependi...

How to move a WPF Popup?

I have a Popup defined like this: <Popup Name="myPopup" StaysOpen="True" Placement="Bottom" PlacementRectangle="0,20,0,20" PlacementTarget="{Binding ElementName=myPopupAnchor}"> <TextBlock ... /> </Popup> I have added event handlers to the myPopupA...

How can I bind dynamic resource key value with column value in data table in wpf

Hello, I am developing a user control in wpf where I need to set eclipse background color as per value in database. Now that field contains values between 1 to 6. now I want that according to values in of that field my eclipse should have different color. I have defined 6 different brushes in resources. Their key values contain 1 to 6 n...

WPF Trigger based on Object Type

Is there a way to do a comparison on object type for a trigger? <DataTrigger Binding="{Binding SelectedItem}" Value="SelectedItem's Type"> </DataTrigger> Background: I have a Toolbar and I want to Hide button's depending on what subclass is currently set to the selected item object. Thanks ...

WPF Dynamic Binding X and Y Co-ordinates

Hi, I have a question on WPF dynamic positioning. I want to place Elipses on the screen based on X and Y co-ordinates that i have stored in a collection in C#. I have been made aware of the drawing ability in WPF which you do from C# using the Windows.Media and Windows.Shapes. Now what i actually want to do is use these namespaces...

WPF Binding to Combo Box

Hi a quick question really in WPF. Does anyone know how i can bind a combo box that will sit in a grid to a dataset that i have. The dataset contains several columns and numerious rows but i want to take one of the columns, lets say ProcessID and just show that in the comobo box. Has anyone done this before or know how it can be don...

WPF Binding to certains items in collection

Hi, I'm currently trying to bind to certain items in a collection in wpf. This is best explained by an example. My XAML is below: <Canvas Name="TaskCanvas" Width="467.667" Height="414"> <Ellipse Name="myElipse" Fill="White" Stroke="Black" Width="126" Height="76" Canvas.Left="{Binding Path=XPos}" Canvas.Top="{Binding Path...

Expander.IsExpaned only if current template is a descendant of a ToolTip.

Hello. I am using a DataTemplate (a StaticResource) in several places in my application as in an ItemsControl, ContentControl and in a ToolTip. The template contains an Expander, and I want its IsExpanded property to be true if the DataTemplate is located within a ToolTip. Any recommendations? ...

What are the defaults for Binding.Mode=Default for WPF controls?

In WPF Binding.Mode, when selecting Default, it depends in the property being binded. I am looking for some list or some convention or any information for the defaults for the various controls. I mean, what properties is TwoWay by default and so on. Any links, ideas, thoughts and even rants are welcommed! ...

Set ItemsSource of a ComboBox to an Array of Integers?

Set ItemsSource of a ComboBox to an Array of Integers? ...

WPF - Binding in XAML to an object created in the code behind

Can an object created in the code (ie C#) be used for binding in the XAML? For example: public class MyForm { private MyComplexObject complexObject; public MyForm() { InitializeComponent(); } public OnButtonClick(object sender, RoutedEventArgs e) { complexObject = new MyComplexObject(); } }...

WPF Data Binding - Example of "Custom Type Descriptor"

I see several people saying that WPF can use "Custom Type Descriptors" for "Change notification". The ways I know how to do Change Notification are: object.GetBindingExpression(Bound.property).UpdateTarget(); Or have my object implement INotifiyPropertyChanged. I see comments saying that Custom Type Descriptors will work too, but no...

WPF Data Binding - Data Template is not Getting Values

I have the following DataTemplate: <DataTemplate DataType="{x:Type Client:WorkItem}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <Co...

WPF Data Binding - Good FULL explination of Data Binding

There are a lot of intros to DataBinding out there. But they leave out a lot of the databinding options. Does anyone know a good reference / instructional document that goes through most/all of the wpf databinding options? ...

WPF Data Binding - Bind to UI Control from a Template

I have a template in my section. I want to bind the Width of one of the values in that template to the width of a control in my Main XAML section. Can this be done? Expression Blend only shows the Template in the Binding list. For example, this is what I am wanting to have work: <Windows.Resources> ... My template stuff <Grid.Co...

WPF Binding Confusion: Composite DependencyObject

I have a DependencyObject class composition that looks like the following: public class A : DependencyObject { public AB AB { get { ... } set { ... } } public AB AC { get { ... } set { ... } } } public class AB : DependencyObject { public string Property1 { get { ... } set { ... } } public string Property2 { get { ... } set { ... }...

wpf - templates - pass template item as ConverterParameter

I have a template for a ListBox. In the ListBox I have a template on the ListBoxItems. I want to disable some of these items (I am still working on what I want to use to make the "event" fire, so I have just put in IsSelected for now) My issue is that I need to get at some of the data for the ListBoxItem to know if it should be disabl...

WPF DataTrigger - Setting ListBoxItem IsSelected

I have the following data trigger on the ListBoxItems in my Multi-selection ListBox <DataTrigger Value="True"> <DataTrigger.Binding> <MultiBinding Converter="{StaticResource DisableWorkItemConverter}"> <Binding ElementName="MainForm" Path="PickedWorkItemID"/> <Binding Path="Id"/> </MultiBindin...