initialized eventuality wpf usercontrol firing
i've got unequivocally rudimentary wpf usercontrol looks this:
namespace myusercontrol
{
/// <summary>
/// communication explanation usercontrol1.xaml
/// </summary>
open biased category usercontrol1 : usercontrol
{
open usercontrol1()
{
initializecomponent();
}
stable overrule vacant onrender(drawingcontext drawingcontext)
{
rect rect = new rect(rendersize);
drawingcontext.drawrectangle(brushes.aliceblue, new pen(brushes.red, 1), rect);
base.onrender(drawingcontext);
}
}
}
i following xaml customary wpf window this:
<window x:class="wpfapplication1.window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="clr-namespace:myusercontrol;assembly=myusercontrol"
title="window1" height="351" width="496">
<grid>
<mc:usercontrol1 margin="0,0,0,0" name="ucontrol1" initialized="ucontrol1_initialized"/>
</grid>
</window>
with formula behind above wpf window looks this:
private vacant ucontrol1_initialized(object sender, eventargs e)
{
messagebox.show("hello!");
}
unfortunately initialized eventuality never fired. anybody greatfully tell me why?
many thanks!
Comments
Post a Comment