<commit_before>﻿// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using Perspex.Controls;
using Perspex.Controls.Shapes;
using Perspex.Diagnostics;
using Perspex.Markup.Xaml;
using Perspex.Xaml.Interactions.Core;
using Perspex.Xaml.Interactivity;
using XamlTestApplication.Behaviors;
using XamlTestApplication.ViewModels;

namespace XamlTestApplication.Views
{
    public class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new MainWindowViewModel();
            DevTools.Attach(this);

            XamlBehaviorsTest();
        }

        private void InitializeComponent()
        {
            PerspexXamlLoader.Load(this);
        }

        private void XamlBehaviorsTest()
        {
            //
            // TODO: Remove code below used only for temporary test of DragPositionBehavior
            //

            /*
            <Interactivity:Interaction.Behaviors>
                <behaviors:DragPositionBehavior/>
            </Interactivity:Interaction.Behaviors>
            */

            Interaction.SetBehaviors(
                this.FindControl<Ellipse>("dragEllipse"),
                new BehaviorCollection { new DragPositionBehavior() });

            //
            // TODO: Remove code below used only for temporary test of EventTriggerBehavior
            //

            /*
            <Interactivity:Interaction.Behaviors>
                <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}">
                    <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerText}" PropertyName="Text" Value="Hello!"/>
                </Interactions:EventTriggerBehavior>
            </Interactivity:Interaction.Behaviors>
            */

            var button = this.FindControl<Button>("button");

            var eventTriggerBehavior = new EventTriggerBehavior()
            {
                EventName = "Click",
                SourceObject = button
            };

            eventTriggerBehavior.SetValue(
                EventTriggerBehavior.ActionsProperty,
                new ActionCollection
                {
                    new ChangePropertyAction()
                    {
                        TargetObject = this.FindControl<TextBox>("DataTriggerText"),
                        PropertyName = "Text",
                        Value = "Hello!"
                    }
                });

            Interaction.SetBehaviors(
                button,
                new BehaviorCollection { eventTriggerBehavior });
        }
    }
}<commit_msg>Removed unused code<commit_after>﻿// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using Perspex.Controls;
using Perspex.Diagnostics;
using Perspex.Markup.Xaml;
using XamlTestApplication.ViewModels;

namespace XamlTestApplication.Views
{
    public class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new MainWindowViewModel();
            DevTools.Attach(this);
        }

        private void InitializeComponent()
        {
            PerspexXamlLoader.Load(this);
        }
    }
}
{'fraction_non_alphanumeric': 0.07986009909647333, 'fraction_numerical': 0.0, 'mean_word_length': 1.8864592094196804, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2268683', 'n_tokens_mistral': 836, 'n_tokens_neox': 786, 'n_words': 185}