multibinding

Why is ConvertBack not called on this MultiBinding?

风格不统一 提交于 2019-12-11 04:08:22
问题 My combobox listing Contacts is bound to both FullName and PhoneExtension using MultiBinding. The Convert method of IMultiValueConverter is called but ConvertBack is not. Why? The combobox properly displays the list but the selection is not saved. It disappears when I tab away. Background: 1) The Contact list comes from a web service and is put in an observable collection ContactListObservable in the code behind. I'm not using a ViewModel. PhoneBookService phoneBookService = new

Multibinding Multiselection ListView

旧时模样 提交于 2019-12-11 03:40:30
问题 OK I have a weird one here. What I am trying to figure out is how to have one listview, populated by an ObservableCollection, update another ListView, populated by another ObservableCollection, based on the first listview's selection and then use a valueconverter to check or uncheck a checkbox based on the selection combined with the current item in the second listview. This part I somewhat have working by using multibinding, but the part that has me stumped is when I check or uncheck an item

Do you have to use a converter when using Multibinding in WPF?

℡╲_俬逩灬. 提交于 2019-12-10 19:20:37
问题 I would like to know if there are scenarios where you can use a Multibinding without a converter - and the limitations which force us to use a converter. In particular I am trying to bind a string to another two strings in a string.format style. 回答1: The most common area you use a MultiBinding without a converter is when you have a string format concatenating two individual values say for example: To format Names that have First, Last part and you want to format it based on locale <StackPanel

Multi-Forms Binding data

拜拜、爱过 提交于 2019-12-10 19:02:14
问题 My project have two WPF Forms: Form1 and Form2. In Form1 I have 1 button to call Form2, textBox1, textBox2, textBox3, textBox4, Form2 has only one textBox and a Save button. So when I click button, it show Form2. In textBox I make a template text like: "blablabla %txt1% blablabla %txt2% blabla %txt3% blabla" I click Save button to Save it. When return Form1, textBox4 will display content in template text in which %txt1%, %txt2%,%txt3% will change depend on textBox1, textBox2, textBox3. I

Formatting MultiBinding TimeSpan to hide milliseconds

荒凉一梦 提交于 2019-12-10 17:48:22
问题 I'm currently trying to multibind a WPF TextBlock to a TimeSpan property. The following works: <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Path=ImportOperationRuntime, StringFormat='hh\\:mm\\:ss'}" /> Unfortunately, using a MultiBinding "destroys" the StringFormat and displays the milliseconds alongside (though hidden through the StringFormat). The following ones do not work: <TextBlock Grid.Column="6" VerticalAlignment="Center"> <TextBlock.Text>

WPF - Delayed Multibinding

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:59:33
问题 I have a multibinding that looks something like this: <UserControl.Visibility> <MultiBinding Converter="{StaticResource isMouseOverToVisibiltyConverter}"> <Binding ElementName="otherElement" Path="IsMouseOver" /> <Binding RelativeSource="{RelativeSource Self}" Path="IsMouseOver" /> </MultiBinding> </UserControl.Visibility> And, I want to be able to add a delay between IsMouseOver going to false for both bindings, and the Visibility being set to Collapsed. I found this DelayBinding

How does FallbackValue work with a MultiBinding?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 15:44:41
问题 I ask because it doesn't seem to work. Assume we're binding to the following object: public class HurrDurr { public string Hurr {get{return null;}} public string Durr {get{return null;}} } Well, it would appear that if we used a MultiBinding against this the fallback value would be shown, right? <TextBlock> <TextBlock.Text> <MultiBinding StringFormat="{}{0} to the {1}" FallbackValue="Not set! It works as expected!)"> <Binding Path="Hurr"/> <Binding Path="Durr"/> </MultiBinding> </TextBlock

Special behavior of MultiBinding vs Binding when specifying an ImageSource

▼魔方 西西 提交于 2019-12-07 17:07:35
问题 I ran into a special behavior when binding to the Source property of an Image , using a converter. It appears that if I use a simple Binding with a IValueConverter that returns a string correpsonding to a relative path to the image, everything is OK and the image is displayed. On the other hand, if I use a MultiBinding with a IMultiValueConverter that returns the same string, the binding doesn't work and this error message is displayed in VS2010 output window : System.Windows.Data Error: 5 :

WPF MultiBindings

…衆ロ難τιáo~ 提交于 2019-12-07 07:30:50
问题 I need to implement MultiBindings in C# directly without using XAML, I know how to use the IMultiValueConverter in C#, but, how to do: <MultiBinding Converter="{StaticResource sumConverter}"> <Binding ElementName="FirstSlider" Path="Value" /> <Binding ElementName="SecondSlider" Path="Value" /> <Binding ElementName="ThirdSlider" Path="Value" /> </MultiBinding> in C# ? 回答1: Why not using XAML? The following code should work: MultiBinding multiBinding = new MultiBinding(); multiBinding.Converter

wpf multibinding to viewmodel?

点点圈 提交于 2019-12-06 02:36:43
问题 For the life of me, I can't seem to bind to my viewmodel using multibindings. All of the examples on the net bind to gui elements directly, but whenever I try with a viewmodel object exceptions are thrown. My question is, how do I add a multibinding to several viewmodel objects in xaml? I need to bind the IsEnabled property of a context menu to two integers in my viewmodel. The following binding doesn't work, since its designed for GUI components. How would I do it to work with my ints?