Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverlight: Binding to UserControl's dependency properties
    primarykey
    data
    text
    <p>I have an user control named GraphPanel. It has two dependency properties, one custom, PanelTitle, and the other inherited from the FrameworkElement, Content.</p> <pre><code> public static readonly DependencyProperty PanelTitleProperty = DependencyProperty.Register( "PanelTitle", typeof(string), typeof(GraphPanel), new PropertyMetadata("") ); // ... public string PanelTitle { set { SetValue(PanelTitleProperty, value); } get { return (string)GetValue(PanelTitleProperty); } } </code></pre> <p>The XAML code is as follows: </p> <pre><code>&lt;UserControl x:Class="PlaceringsGuiden.Library.Components.GraphPanel" DataContext="{Binding RelativeSource={RelativeSource self}}"&gt; &lt;UserControl.Resources&gt; &lt;ResourceDictionary Source="/App;component/Assets/Styles/GraphPanelStyles.xaml" /&gt; &lt;/UserControl.Resources&gt; &lt;Border Style="{StaticResource GraphPanelBorderStyle}"&gt; &lt;Grid Style="{StaticResource GraphPanelGridStyle}"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="1*" /&gt; &lt;RowDefinition Height="8*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid Grid.Column="0" Grid.Row="0"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="0.02*" /&gt; &lt;ColumnDefinition Width="1*" /&gt; &lt;ColumnDefinition Width="0.02*" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Path=PanelTitle}" Style="{StaticResource GraphPanelHeaderStyle}" /&gt; &lt;/Grid&gt; &lt;Grid Grid.Column="0" Grid.Row="0" x:Name="GraphPanelContentPresenter"&gt; &lt;ContentPresenter Content="{Binding Path=Content}" /&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/UserControl&gt; </code></pre> <p>Running this yields an exception:</p> <pre><code>Value does not fall within the expected range. at MS.Internal.XcpImports.CheckHResult(UInt32 hr) </code></pre> <p>What am I doing wrong? What should I do to achieve this binding?</p> <p>Thanks!</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.
    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