c# - Window Loaded event handler: "Ensure Event Failed" -


i'm trying simple task of adding event handler window loading. i'm using visual studio 2017. when type loaded="" , use intellisense add new event handler, error message "ensure event failed" , no other information. wrong?

xaml:

<window x:class="mld_ui_1.mainwindow"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     xmlns:local="clr-namespace:mld_ui_1"     mc:ignorable="d"     title="mainwindow" height="350" minheight="700" width="525" minwidth="1050"     loaded="">     <grid background="{staticresource mainbackgroundbrush}">         <grid.rowdefinitions>             <rowdefinition height="10"/>             <rowdefinition height="40"/>             <rowdefinition height="*" minheight="80"/>             <rowdefinition height="200"/>             <rowdefinition height="10"/>         </grid.rowdefinitions>         <grid.columndefinitions>             <columndefinition width="10"/>             <columndefinition width="*" minwidth="100"/>             <columndefinition width="*" minwidth="100"/>             <columndefinition width="10"/>         </grid.columndefinitions>         <border borderthickness="2 2 1 2" borderbrush="black" grid.column="1" grid.row="1" background="{staticresource uvgradientbrush}" cornerradius="5 0 0 5"/>         <border borderthickness="1 2 2 2" borderbrush="black" grid.column="2" grid.row="1" background="{staticresource irgradientbrush}" cornerradius="0 5 5 0"/>         <border borderthickness="2 2 1 2" borderbrush="black" grid.column="1" grid.row="3" background="{staticresource gradientbrush}" cornerradius="5 0 0 5"/>         <border borderthickness="1 2 2 2" borderbrush="black" grid.column="2" grid.row="3" background="{staticresource gradientbrush}" cornerradius="0 5 5 0"/>         <stackpanel grid.column="1" grid.row="1" orientation="horizontal" margin="10 0 10 0">             <textblock text="uv" fontfamily="tahoma" foreground="white" verticalalignment="center" fontsize="20"/>         </stackpanel>         <stackpanel grid.column="2" grid.row="1" orientation="horizontal" margin="10 0 10 0">             <textblock text="ir" fontfamily="tahoma" foreground="white" verticalalignment="center" fontsize="20"/>         </stackpanel>         <image x:name="imagepane1" grid.column="1" horizontalalignment="stretch" grid.row="2" verticalalignment="stretch" margin="2 2 2 2"/>         <image x:name="imagepane2" grid.column="2" horizontalalignment="stretch" grid.row="2" verticalalignment="stretch" margin="2 2 2 2"/>     </grid> </window> 

the namespace in x:class incorrect; did not match namespace in code behind:

changing x:class="mld_ui_1.mainwindow" x:class="mld_ui_2.mainwindow" fixed everything.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -