Having Two Buttons does not render but one button does


i have found if have 1 button (button1) below, xaml render correctly have 2 buttons (button1 , button2), nothing render.  buttonloaded method never gets called. what causing behavior?
michael s. scherotter
mindjet labs
 
javascript:

var margin = 3;

//adjust button size

function buttonloaded(sender, eventargs)

{

var text = sender.findname(sender.name + "_text");

text["canvas.top"] = margin;

text["canvas.left"] = margin;

var rectangle = sender.findname(sender.name + "_rectangle");

rectangle.width = text.actualwidth + margin * 2;

rectangle.height = text.actualheight + margin * 2;

sender.width = rectangle.width;

sender.height = rectangle.height;

}

 
  <?xml version="1.0" encoding="utf-8" ?>
- <canvas xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--
button
  -->
- <canvas x:name="button1" canvas.top="0" loaded="javascript:buttonloaded">
- <rectangle x:name="button1_rectangle" stroke="#ff8e8e8e" strokethickness="2" radiusx="2" radiusy="2">
- <rectangle.fill>
- <lineargradientbrush x:name="button1_rectanglebrush" startpoint="0.5,2.109" endpoint="0.5,-1.109">
  <gradientstop x:name="gradientstop1" color="#ffff9e00" offset="1" />
  <gradientstop x:name="gradientstop2" color="#ffeaeaea" offset="0.218" />
  </lineargradientbrush>
  </rectangle.fill>
  </rectangle>
  <textblock x:name="button1_text" text="button 1" />
  </canvas>
<!--
button
  -->
- <canvas x:name="button2" canvas.top="20" loaded="javascript:buttonloaded">
- <rectangle x:name="button2_rectangle" stroke="#ff8e8e8e" strokethickness="2" radiusx="2" radiusy="2">
- <rectangle.fill>
- <lineargradientbrush x:name="button2_rectanglebrush" startpoint="0.5,2.109" endpoint="0.5,-1.109">
  <gradientstop x:name="gradientstop1" color="#ffff9e00" offset="1" />
  <gradientstop x:name="gradientstop2" color="#ffeaeaea" offset="0.218" />
  </lineargradientbrush>
  </rectangle.fill>
  </rectangle>
  <textblock x:name="button2_text" text="button 2" />
  </canvas>
  </canvas>

try changing names of gradient stops in second button:

<canvas x:name="button2" canvas.top="20" loaded=buttonloaded">
<rectangle x:name="button2_rectangle" stroke="#ff8e8e8e" strokethickness="2" radiusx="2" radiusy="2">
<rectangle.fill>
<lineargradientbrush x:name="button2_rectanglebrush" startpoint="0.5,2.109" endpoint="0.5,-1.109">
  <gradientstop x:name="gradientstop3" color="#ffff9e00" offset="1" />
  <gradientstop x:name="gradientstop4" color="#ffeaeaea" offset="0.218" />
  </lineargradientbrush>
  </rectangle.fill>
  </rectangle>
  <textblock x:name="button2_text" text="button 2" />
  </canvas>

you can use names once...



Archived Forums SA-SM  >  Silverlight (formerly WPF/E) Developer Issues



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607