Try using attached properties public static class ItemSelector { public static DependencyProperty MakeSelectionProperty = DependencyProperty. RegisterAttached("MakeSelection", typeof(bool? ), typeof(ItemSelector), new PropertyMetadata(null, OnMakeSelectionPropertyChanged)); public static DependencyProperty ItemsControlProperty = DependencyProperty.
RegisterAttached("ItemsControl", typeof(ItemsControl), typeof(ItemSelector)); public static void SetMakeSelection( DependencyObject d, bool value) { d. SetValue(MakeSelectionProperty, value); } public static void SetItemsControl( DependencyObject d, ItemsControl value) { d. SetValue(ItemsControlProperty, value); } private static void OnMakeSelectionPropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e) { var itemsControl = d.
GetValue(ItemsControlProperty) as ItemsControl; if (itemsControl == null) return; ((ListBoxItem) itemsControl. ContainerFromElement(d)) . IsSelected = true; } and heres its use.
Also if you want a specific item to be selected you can then hold on to it. FYI - the reason being is that the annonomous objects are on the stack (I believe... I don't use them really but the behavior leads one to this assumption). By making your own object it is reference based so even if the props are the exact same, they are different.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.