Note that there are some explanatory texts on larger screens.

plurals
  1. POXaml VS designer error: '{DependencyProperty.UnsetValue}'
    primarykey
    data
    text
    <p>I am building a custom tabitem using template binding. All is fine until I used binding on the margin to a custom value converter, then I get an error in the VS designer: '{DependencyProperty.UnsetValue}' is not a valid value for the 'System.Windows.Controls.Control.Template' property on a Setter.</p> <p>The converters are as follows:</p> <pre><code>public class ContentToMarginConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return new Thickness(0, 0, -((ContentPresenter)value).ActualHeight, 0); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion } public class ContentToPathConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var ps = new PathSegmentCollection(4); ContentPresenter cp = (ContentPresenter)value; double h = cp.ActualHeight &gt; 10 ? 1.4 * cp.ActualHeight : 10; double w = cp.ActualWidth &gt; 10 ? 1.25 * cp.ActualWidth : 10; ps.Add(new LineSegment(new Point(1, 0.7 * h), true)); ps.Add(new BezierSegment(new Point(1, 0.9 * h), new Point(0.1 * h, h), new Point(0.3 * h, h), true)); ps.Add(new LineSegment(new Point(w, h), true)); ps.Add(new BezierSegment(new Point(w + 0.6 * h, h), new Point(w + h, 0), new Point(w + h * 1.3, 0), true)); return ps; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion } </code></pre> <p>And the xaml template as follows:</p> <pre><code>&lt;Style TargetType="TabItem"&gt; &lt;Setter Property="SnapsToDevicePixels" Value="True"/&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="TabItem"&gt; &lt;Grid Name="grd"&gt; &lt;Path Name="tabPath" StrokeThickness="1" Stroke="{StaticResource ResourceKey=borderBrush}" Fill="{StaticResource ResourceKey=unselectedBrush}" Margin="{Binding ElementName=TabItemContent,Converter={StaticResource ResourceKey=content2Margin}}"&gt; &lt;Path.Data&gt; &lt;PathGeometry&gt; &lt;PathFigure IsClosed="False" StartPoint="1,0" Segments="{Binding ElementName=TabItemContent,Converter={StaticResource ResourceKey=content2Path}}"&gt; &lt;/PathFigure&gt; &lt;/PathGeometry&gt; &lt;/Path.Data&gt; &lt;Path.LayoutTransform&gt; &lt;ScaleTransform ScaleY="-1"/&gt; &lt;/Path.LayoutTransform&gt; &lt;/Path&gt; &lt;Rectangle Name="TabItemTopBorder" Height="2" Visibility="Visible" VerticalAlignment="Bottom" Margin="{Binding ElementName=TabItemContent, Converter={StaticResource ResourceKey=content2Margin}}" /&gt; &lt;ContentPresenter Name="TabItemContent" ContentSource="Header" Margin="10,2,10,2" VerticalAlignment="Center" TextElement.Foreground="White"/&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsMouseOver" Value="True" SourceName="grd"&gt; &lt;Setter Property="Stroke" Value="{StaticResource HoverBrush}" TargetName="tabPath"/&gt; &lt;/Trigger&gt; &lt;Trigger Property="Selector.IsSelected" Value="True"&gt; &lt;Setter Property="Fill" TargetName="tabPath" Value="{StaticResource ResourceKey=backgroundBrush}"/&gt; &lt;Setter Property="Panel.ZIndex" Value="2"/&gt; &lt;Setter Property="Visibility" Value="Hidden" TargetName="TabItemTopBorder"/&gt; &lt;Setter Property="TextElement.Foreground" TargetName="TabItemContent" Value="Black"/&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>Any reason why I get this error in the designer, yet when I build the project is fine????</p>
    singulars
    1. This table or related slice is empty.
    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