routed-events

MS Surface Tag Visualizer steals contact events

烈酒焚心 提交于 2019-12-24 08:14:49
问题 I'm struggling with the TagVisualizer control on an MS Surface project. In theory the control seems great, allowing you to respond to input from real world physical objects The problem is that the control will cover the entire screen (since I want to capture tags on the entire screen) and as such, no other controls in my app will receive the touch events. (Unless, they are direct ascendants in the visual tree). In my app, I want to have a "layer" type of a approach, where each layer can

Programmatically Call WPF TargetedTriggerAction

风流意气都作罢 提交于 2019-12-22 08:40:54
问题 I have a TargetedTriggerAction from a 3rd party library that would like to call/invoke without attaching it to a button. I have no problem getting it to work with the button, but I want to do it in response to some non-UI event. Here is the action's class declaration: public class MeasureAction : TargetedTriggerAction<Map> Here is my setup code so far: var measure = new MeasureAction(); measure.TargetObject = _mapControl; measure.MeasureMode = MeasureAction.Mode.Polyline; measure.MapUnits =

How can I raise a custom Routed Event from user control?

南楼画角 提交于 2019-12-21 04:03:23
问题 In my user control I have a button that, when clicked, would raise a custom Routed Event. I've attempted to raise it, but it doesn't get fired in the MainWindow.xaml. Xaml for the button in UserControl: <Button x:Name="PART_Add" Content="+" Grid.Column="3" Margin="0,0,0,0" Style="{DynamicResource dTranspButton}" Click="btnAdd_Click"/> UserControl C# code: //AddClick Event public static readonly RoutedEvent AddClickEvent = EventManager.RegisterRoutedEvent("AddClick", RoutingStrategy.Bubble,

Why e.Handled = true not working?

大城市里の小女人 提交于 2019-12-18 04:04:09
问题 I have following XAML <StackPanel MouseEnter="StackPanel_MouseEnter" Height="130" Background="Blue"> <Grid MouseEnter="Grid_MouseEnter" Height="60" Background="Red" > <Button MouseEnter="Button_MouseEnter" Height="20"/> </Grid> </StackPanel> In code behind I am doing this private void StackPanel_MouseEnter(object sender, MouseEventArgs e) { } private void Grid_MouseEnter(object sender, MouseEventArgs e) { e.Handled = true; } private void Button_MouseEnter(object sender, MouseEventArgs e) { e

Disable event bubbling on selectionchanged event- WPF

巧了我就是萌 提交于 2019-12-11 01:35:19
问题 I have a listbox inside a listview. on Both of them I have selectionchanged event. When I fire child control event parent control fires automatically. I need to stop this behaviour. Any hints? Thanks! <ListView Name="listView1" ItemContainerStyle="{StaticResource RowStyle}" AlternationCount="2" SelectionChanged="listViewTask_SelectionChanged"> <ListView.View> <GridView> <GridViewColumn Width="150"> <GridViewColumnHeader Name="gridViewColumnHeader1" Click="SortClick" Tag="Style" Content="Style

Routed event class handler for LoadedEvent does not work for most classes

不羁岁月 提交于 2019-12-10 17:16:28
问题 I'm trying to register handler for all Loaded events: EventManager.RegisterClassHandler(typeof(UIElement), FrameworkElement.LoadedEvent, new RoutedEventHandler(OnRoutedEvent), true); EventManager.RegisterClassHandler(typeof(ContentElement), FrameworkContentElement.LoadedEvent, new RoutedEventHandler(OnRoutedEvent), true); EventManager.RegisterClassHandler(typeof(UIElement), FrameworkElement.UnloadedEvent, new RoutedEventHandler(OnRoutedEvent), true); EventManager.RegisterClassHandler(typeof

Command Binding Memory Leak in WPF

核能气质少年 提交于 2019-12-10 13:15:44
问题 When i create a user control that has a CommandBinding to a RoutedUICommand im worried that i get memory leaks. scenario: Have a RoutedUICommand as a static in c class where i store my commands Implement the CommandBindings on a user control. Add the user control to the main form. Remove the user control from the main form, set the references to it to null. The canExecute of the command bindings continues to fire. I dont have a reference to the UserControl so its leaked. and it keeps firing

WPF: How to created a routed event for content changed?

☆樱花仙子☆ 提交于 2019-12-08 19:01:31
I have a frame. I switch pages with this line: FrameName.Content = new PageName(); I want a storyboard to begin when the page has changed, and I want to do it in XAML, and not in code-behind. I have tried the following code: <Frame.Triggers> <EventTrigger RoutedEvent="ContentChanged"> <BeginStoryboard Storyboard="{StaticResource storyboardName}" /> </EventTrigger> </Frame.Triggers> After searching a bit I realized there is no built-in routed event of that nature. The first answer here suggests that The most dynamic approach is to simply derive your own label control that provides a

ScrollViewer notify on RequestBringIntoView

冷暖自知 提交于 2019-12-08 08:24:40
问题 I am attempting to get notified when an element is scrolled into view , As i understand it , ScrollViewer calls BringIntoView on it's child elements and then the child elements raise a RequestBringIntoView event which the ScrollViewer later catches and handles. This is done by Registering a Class handler for this Event and catching it as it bubbles up EventManager.RegisterClassHandler(typeof(ScrollViewer), RequestBringIntoViewEvent, new RequestBringIntoViewEventHandler(OnRequestBringIntoView)

WPF: How to created a routed event for content changed?

回眸只為那壹抹淺笑 提交于 2019-12-08 04:30:41
问题 I have a frame. I switch pages with this line: FrameName.Content = new PageName(); I want a storyboard to begin when the page has changed, and I want to do it in XAML, and not in code-behind. I have tried the following code: <Frame.Triggers> <EventTrigger RoutedEvent="ContentChanged"> <BeginStoryboard Storyboard="{StaticResource storyboardName}" /> </EventTrigger> </Frame.Triggers> After searching a bit I realized there is no built-in routed event of that nature. The first answer here