There are two dictionaries. They contain templates for CustomControl . For event handling, I connected x:Class="ModConstructor.Controls.ScriptComponent" and prescribed a script
namespace ModConstructor.Controls { [ContentProperty("Content")] public partial class ScriptComponent : Control for my ScriptComponent
and x:Class="ModConstructor.Controls.PropertyField"
namespace ModConstructor.Controls { public partial class PropertyField : Control for my PropertyField .
However, I still get the error. The Разделяемые объявления "App" не должны указывать различные базовые классы. What is wrong here? After all, before that, when they both referred to x:Class="ModConstructor.App" , he cursed that inside the App these two controllers create additional InitializeComponent()
PS When you double-click on an error, it opens App.xaml itself App.xaml red public partial class App : Application , but does not say anything specific.
UPD App.xaml
<Application x:Class="ModConstructor.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionaries/Basic.xaml"/> <ResourceDictionary Source="Dictionaries/ComboBox.xaml"/> <ResourceDictionary Source="Dictionaries/Converter.xaml"/> <ResourceDictionary Source="Dictionaries/Datatemplates.xaml"/> <ResourceDictionary Source="Dictionaries/List.xaml"/> <ResourceDictionary Source="Dictionaries/Palete.xaml"/> <ResourceDictionary Source="Dictionaries/ScrollBar.xaml"/> <ResourceDictionary Source="Dictionaries/Tabs.xaml"/> <ResourceDictionary Source="Dictionaries/Window.xaml"/> <ResourceDictionary Source="Dictionaries/XCTK.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> App.xaml.cs
using System.Windows; namespace ModConstructor { /// <summary> /// Логика взаимодействия для App.xaml /// </summary> public partial class App : Application { } }
CustomControl, described in the resource dictionary, add event handlers? The variant withmycontrol.Click += OnClickinsideMainWindowdoes not offer. When everything was inApp.xaml, I referred to the methods insideApp.xaml.csNow it is impossible. - Puromybutton.Click += OnClick. I'm telling you. Earlier I could writeClick="OnClick"in human markup and already inApp.xaml.cs:private void OnClick(object sender, RoutedEventArgs e) {}. - PuroApp.xaml.cs? Do you have a file for your code? - Andrey NOP