eventsetter

Dynamically set event handler using DataTrigger

南楼画角 提交于 2020-01-14 07:42:05
问题 iv'e got several itemscontrols which i need to attach an event handler for their PreviewMouseLeftButtonDown event only when a certain condition is met . iv'e designed a style for my controls with a datatrigger ,i checked out it's bindings and tried it out with a regular property setter for the BorderThickness Property just to see that the datatrigger works . (It does..) how can i apply my datatrigger to attach an event handler when the condition of the datatrigger is met using an event setter

WPF baml bug: EventSetter in static resource being set twice, second time to null

梦想与她 提交于 2020-01-11 12:42:07
问题 If I try to store a collection of SetterBase objects in xaml, that includes and EventSetter, The xaml loader throws an error. The root cause is that the xaml loader tries to set PresentationFramework.dll!System.Windows.EventSetters.Event twice: the first time to the correct value (ButtonBase.Click RoutedEvent) but the second time to null, and this throws an exception. My attached property callback is not involved. Why does it try to add the event to the EventSetter twice and why is it null

Why Setter Property is not applied on Hyperlink?

时光总嘲笑我的痴心妄想 提交于 2020-01-04 02:28:10
问题 I want to set (e.g.) FontSize for all Hyperlink s in my window. This is my MainWindow 's XAML content: <Window.Resources> <Style TargetType="{x:Type Hyperlink}"> <EventSetter Event="Click" Handler="Hyperlink_OnClick"/> <Setter Property="FontSize" Value="30"></Setter> </Style> </Window.Resources> <Grid> <RichTextBox> <FlowDocument> <Paragraph> something <Hyperlink> <Hyperlink.Inlines> clickable </Hyperlink.Inlines> </Hyperlink> ... </Paragraph> </FlowDocument> </RichTextBox> </Grid> If I add

WPF Treeview Style EventSetter dont work

雨燕双飞 提交于 2019-12-24 07:15:21
问题 Hallo i have a problem with an eventsetter. My Window: <TreeView.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="CrefoChartTreeViewItemStyle.xaml" /> </ResourceDictionary.MergedDictionaries> <HierarchicalDataTemplate DataType="{x:Type local:Node}" ItemsSource="{Binding ChildNodes}"> </HierarchicalDataTemplate> </ResourceDictionary> </TreeView.Resources> My CrefoChartTreeViewItemStyle.xaml <ResourceDictionary xmlns="http://schemas.microsoft

WPF baml bug: EventSetter in static resource being set twice, second time to null

穿精又带淫゛_ 提交于 2019-12-02 03:31:08
If I try to store a collection of SetterBase objects in xaml, that includes and EventSetter, The xaml loader throws an error. The root cause is that the xaml loader tries to set PresentationFramework.dll!System.Windows.EventSetters.Event twice: the first time to the correct value (ButtonBase.Click RoutedEvent) but the second time to null, and this throws an exception. My attached property callback is not involved. Why does it try to add the event to the EventSetter twice and why is it null the second time? I checked that the ctor being used is the default one so, EventSeetter is not