I created an attached behavior that is used to execute a delegate of type Func<bool> when invoking the behavior. The following is a definition of a dependency property.
public static readonly DependencyProperty SendToDetailBehaviorProperty = DependencyProperty.RegisterAttached("SendToDetailBehavior", typeof(Func<bool>), typeof(ListDetailAspectSendToDetailBehavior), new UIPropertyMetadata(null, SendToDetail));
I work as expected, however in my XAML I get the following error, preventing the developer from loading.
The property "SendToDetailBehavior" was not found or is not serializable for type 'SortableListView'
Below you will find xaml.
<Controls:SortableListView Grid.Row="0" Grid.Column="0" Name="lvwLocations" MinHeight="150" MinWidth="{Binding Path=BusinessObject.Locations, ValidatesOnDataErrors=true, Converter={StaticResource AlwaysReturn1Converter}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource SortableListViewStyle}" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" IsSynchronizedWithCurrentItem="True" **behaviors:ListDetailAspectSendToDetailBehavior.SendToDetailBehavior="{Binding Path=LocationListDetail.SendFocusToDetail}"** ItemsSource="{Binding Path=LocationListDetail.MasterList}" SelectedItem="{Binding Path=LocationListDetail.DetailItem, Mode=TwoWay}" MouseDoubleClick="lvwLocations_MouseDoubleClick">
If I changed the base type of the Dependancy property to bool , for example, the error will disappear.
As I said, the attached behavior works, only the designer explodes. I was looking for documentation on this and came up empty. I hope someone has an understanding.
Thanks, BDN
wpf dependency-properties attached-properties attachedbehaviors
Brette.Net
source share