binding

Binding Visibility in XAML to a Visibility property

I've seen on the internet quite a few examples of binding a boolean to the Visibility property of a control in XAML. Most of the good examples use a BooleanToVisibiliy converter. I'd like to just set the Visible property on the control to bind to a System.Windows.Visibility property in the code-behind, but it doesn't seem to want to wo...

wpf update ListViewItem background property

I have a listview that is binded to a ThreadSafeObservableCollection. The background of each of these items is set to an enum that is run through a color converter, here's the code for these 2 settings. <UserControl.Resources> <EncoderView:EncoderStatusToColorConverter x:Key="ColorConverter"/> <Style x:Key="ItemContStyle" Targe...

How Do I get this ComboBox Hosted in a ListView to update my Collection?

I have a ComboBox hosted in a ListView and I need changes in the CombBox to update the supporing class that the ListView is bound to. Here is my DataTemplate <DataTemplate x:Key="Category"> <ComboBox IsSynchronizedWithCurrentItem="False" Style="{StaticResource DropDown}" ItemsSource="{Binding Source={...

WPF: How to bind RadioButtons to an enum?

I've got an enum like this: public enum MyLovelyEnum { FirstSelection, TheOtherSelection, YetAnotherOne }; I got a property in my DataContext: public MyLovelyEnum VeryLovelyEnum { get; set; } And I got three RadioButtons in my WPF client. <RadioButton Margin="3">First Selection</RadioButton> <RadioButton Margin="3">The Other...

Binding and formattingEnabled...?

Hi, I have a combobox derrived class which has a SelectedLookupItem property. This returns a LookupItem object. LookupItem is a MustInherit class. I have a class that has a property whose return type is ChildLookupItem (a class derrived from LookupItem). When I set up binding to link the combo to this property, I get a FormatException "...

WPF: Ideas to set an flag enum value for a single object using Binding Mechanism

I have a Enum for example... public enum TypeIdentifier { NotSet = 0, Type1= 1, Type2= 2, Type3= 3, Type4= 4, Type5= 5 } public class CommonObject { TypeIdentifier myTypeIdentifier {get; set;} } I have a WPF UserControl that has a generalized object binding.I have a c...

Is there anyway to prevent 'this' from changing, when I wrap a function?

I want all buttons to perform an action before and after their normal onclick event. So I came up with the "brilliant" idea of looping through all those elements and creating a wrapper function. This appeared to work pretty well when I tested it, but when I integrated it into our app, it fell apart. I traced it down to the 'this' valu...

Python globals, locals, and UnboundLocalError

I ran across this case of UnboundLocalError recently, which seems strange: import pprint def main(): if 'pprint' in globals(): print 'pprint is in globals()' pprint.pprint('Spam') from pprint import pprint pprint('Eggs') if __name__ == '__main__': main() Which produces: pprint is in globals() Traceback (most recent ...

Binding a object with a sub objects as properties to a datagrid

Good morning, I am working with an object which has sub objects with in (see example below), I am attempting to bind a List to the datagrid. When I bind the List<>, in the cell that contains the subObject I see the following Value ... "namespace.subObject" ... the string values display correctly. Ideally I would like to see the "Descri...

How to refresh a simple binding of a windows forms control?

I'm binding a domain objects property to the Text property of a System.Windows.Forms.Label using the DataBindings. Label l = new Label(); l.DataBindings.Add(new Binding("Text",myDomainObject,"MyProperty")); However, when I change the domain object, the Label does not reflect the change. I know that for complex Controls like the DataGr...

WPF DataGrid Sync Column Widths

I've got two WPF Toolkit DataGrids, I'd like so that when the user resizes the first column in the first grid, it resizes the first column in the second grid. I've tried binding the width of the DataGridColumn in the second grid to the appropriate column in the first grid, but it doesn't work. I'd prefer to use all xaml, but I'm find wit...

WPF Shape Rectangle Binding

Hi Guys. I'm trying to make some kind of shape in wpf, which does resize itself to the content (which should be text). Unfortunately, the stretch property isn't the right thing, since I want only the width of the Shape resized and without the borders (pls copy bottom example in xamlpad to see for yourself) of this shape stretched. The bo...

WPF binding to XPath-reachable value of an element property

I'd like to bind to a value reachable only with XPath from the property of an element. The element is a ComboBox populated from some XML, and its property is SelectedItem. SelectedItem points to an XML element, and I'd like to bind to a child element's value within that, which can be reached with an XPath. The XAML looks like this, so ...

Is my WCF using the correct Binding?

Hi, My wcf service's web.config looks like this: How can I confirm that it is using the settings correctly? I still get this timeout error sometimes even though I have configured the binding to use: SendTimeout = 10 minutes etc. ? <system.serviceModel> <services> <service behaviorConfiguration="MyService.MyServiceBehavior"...

WPF BitmapSource ImageSource

I am binding an Image.Source property to the result of the property shown below. public BitmapSource MyImageSource { get { BitmapSource source = null; PngBitmapDecoder decoder; using (var stream = new FileStream(@"C:\Temp\logo.png", FileMode.Open, FileAccess.Read, FileShare.Read)) { decoder = new PngBitmapDecod...

Binding IDataErrorInfo to window IsEnabled button property

I have a WPF sub window with some input controls that the user has to correctly fill before pressing Ok button. I have already implemented the interface IDataErrorInfo to validate all properties bound to UI Controls. Now I would like that the IsEnabled property of Ok button is True only if ALL controls are valid, otherwise it has to be...

How do you debug wpf relativesource throwing errors on load?

I'm working with a WPF dialog window that contains a ListBox. The list box can display both an 'icon' and 'list' view. To accomplish this, we used ListBoxItem styles that are dynamically applied to the ListBox, as well as a pair of corresponding ItemsPanelTemplates. As is, it displays beautifully. However, when loading this dialog we ge...

What is the WPF XAML Data Binding equivalent of String.Format?

Or, to be more clear, how can I format a block of text (in my case, to be included within a tooltip) such that some portions of the text come from bound values. In plain C# I would use: _toolTip.Text = string.Format("{1:#0}% up, {2:#0}% down", Environment.NewLine, percentageOne, percentage2); However the WPF XAML markup for a Tex...

Why I have to use fully qualified assembly name for local assemblies?

In many places, like in app.config/web.config files I have to specify types using this verbose fully qualified names, like <add name="myListener" type="System.Diagnostics.TextWriterTraceListener, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> This MSDN site says, that Partial binding, which speci...

Changing port on which an Axis web service is listening to

I have a web application running on port :80, and I have an Axis web service that is part of that web application. As such, the service is running on port :80 as well. However, for security reasons our client has asked us to change the web service port to 8080 so that they can allow access only to that port for remote consumers of the w...