passing the current Window as a CommandParameter

There are two ways I can of think to do this: Give the window a name (via a x:Name attribute on the Window tag, and then construct a binding like this (assumes the name of the window is ‘ThisWindow’): <Button Command=”CommandGetsCalled” CommandParameter=”{Binding ElementName=ThisWindow}” /> For something more general (doesn’t rely on giving the current Window … Read more

Binding to ExpandoObject. PropertyChanged not working

They didn’t add a default mechanism for binding to dynamic objects and instead added a new interface ICustomTypeProvider. And that interface wasn’t added to an ExpandoObject either, but with expando you should be able to use the indexer binding since it is an IDictionary<string, object> that implements INotifyPropertyChanged. <TextBlock Text=”{Binding [Foo]}”/>

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

You can use MultiBinding + StringFormat (requires WPF 3.5 SP1): <TextBox.Text> <MultiBinding StringFormat=”{}{1:#0}% up, {2:#0}% down”> <Binding Path=”PercentageOne” /> <Binding Path=”PercentageTwo”/> </MultiBinding> </TextBox.Text> Regarding Run.Text – you can’t bind to it but there are some workarounds: http://fortes.com/2007/03/20/bindablerun/ http://paulstovell.net/blog/index.php/attached-bindablerun/

How can I do a knockout binding to a backgroundImage URL?

You need to concatenate your strings: data-bind=”style: { backgroundImage: ‘url(\” + image() + ‘\’)’ }” If image is actually an observable, you’ll need to call it, or you’ll end up concatenating the function instead. Note that since you’re binding to an expression involving the property, you must call the function (with ()). Otherwise, you will … Read more

WPF: How to bind a command to the ListBoxItem using MVVM?

Unfortunately, only ButtonBase derived controls have the possibility for binding ICommand objects to their Command properties (for the Click event). However, you can use an API provided by Blend to map an event (like in your case MouseDoubleClick on the ListBox) to an ICommand object. <ListBox> <i:Interaction.Triggers> <i:EventTrigger EventName=”MouseDoubleClick”> <i:InvokeCommandAction Command=”{Binding YourCommand}”/> </i:EventTrigger> </i:Interaction.Triggers> </ListBox> … Read more

Cannot find source for binding

As Zarat mentioned the default style for TabItem in Windows 8 has triggers that fire after the remove and then look for the now missing TabControl. I consider that a bug because adding and removing TabItems is a really common scenario isn’t it? I found as a workaround, that it is possible to remove the … Read more

techhipbettruvabetnorabahisbahis forumueduseduedusedusedusedusedusedueduedus