Skip to content

Event registration inside a DataTemplate throws compile error #63

Closed

Description

@Henk7
  <ItemsControl>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Border PointerReleased="Border_PointerReleased">
                    <TextBlock>
                        <Run Text="546546"/>
                    </TextBlock>
                </Border>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>

throws the following error during compile time:
An object reference is required for the non-static field, method, or property 'MainPage.Border_PointerReleased(object, PointerRoutedEventArgs)'

Looks like the generated code expects a static event handler method.

Activity

  1. changed the title [-]Event registration inside of DataTemplates throws compile error[/-] [+]Event registration inside a DataTemplates throws compile error[/+] on Jun 23, 2018
  2. changed the title [-]Event registration inside a DataTemplates throws compile error[/-] [+]Event registration inside a DataTemplate throws compile error[/+] on Jun 25, 2018
  3. added
    kind/bug
    on Jun 26, 2018
  4. added a commit that references this issue on Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions