Note that there are some explanatory texts on larger screens.

plurals
  1. POUnknown property 'Converter' for type 'MS.Internal.Markup.MarkupExtensionParser+UnknownMarkupExtension' encountered while parsing a Markup Extension
    primarykey
    data
    text
    <p>I am binding to an ObservableCollection called ScaleFactor to a ComboBox. The value of the ObservableCollection are simply 1, 2, 4 and 8. I want to use an IValueConverter to change these values to x1, x2, x4 and x8.</p> <p>My MainWindow.xaml</p> <pre><code>&lt;Window x:Class="TimeLineCanvas.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:timeline="clr-namespace:TimeLineCanvas.UserControls" xmlns:helper="clr-namespace:TimeLineCanvas.Helpers" Title="MainWindow" Height="350" Width="525"&gt; &lt;Grid&gt; &lt;Grid.Resources&gt; &lt;helper:ZoomConverter x:Key="ZoomConverter" /&gt; &lt;/Grid.Resources&gt; &lt;StackPanel&gt; &lt;ComboBox ItemsSource="{Binding SSS}" HorizontalAlignment="Left" &gt; &lt;ComboBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding, Converter={StaticResource ZoomConverter}}" /&gt; &lt;/DataTemplate&gt; &lt;/ComboBox.ItemTemplate&gt; &lt;/ComboBox&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p>And the code behind</p> <pre><code>using System; using System.Windows; using System.ComponentModel; using System.Collections.ObjectModel; namespace TimeLineCanvas { /// &lt;summary&gt; /// Interaction logic for MainWindow.xaml /// &lt;/summary&gt; public partial class MainWindow : Window { #region Constructors public MainWindow() { InitializeComponent(); SSS = new ObservableCollection&lt;int&gt;(); SSS.Add(1); SSS.Add(2); this.DataContext = this; } #endregion public ObservableCollection&lt;int&gt; SSS { get; set; } } } </code></pre> <p>And the converter</p> <pre><code>using System; using System.Windows.Data; namespace TimeLineCanvas.Helpers { public class ZoomConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return "x" + value.ToString(); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } } </code></pre> <p>I don't know why this is, I'm not using MarkupExtensions so I don't think <a href="https://stackoverflow.com/questions/11785248/error-when-binding-using-markup-extensions-unknown-property-encountered-while-p">this link helps</a>. Can any one shed any light?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload