wpf - Help me put event trigger for controls of type Expander! -
hello im trying this
allrooms = remote.getallrooms(); (int = 0; < allrooms.count; a++) { expander ex = new expander(); ex.expanded += expander1_expanded; ex.width = 254; ex.name = ("expander" + a); ex.verticalalignment = system.windows.verticalalignment.stretch; ex.horizontalalignment = system.windows.horizontalalignment.stretch; ex.header = allrooms[a].nome; wrappanel panel = new wrappanel(); panel.opacity = 1; panel.width = 254; (int b = 0; b < allusers.count; b++) { system.windows.controls.label lbl = new system.windows.controls.label(); lbl.content = allusers[b].nick; lbl.width = 127; panel.children.add(lbl); } ex.content = panel; canvas.settop(ex, (30 * a)); canvasleft.children.add(ex); } mytimer.stop();
and objective add event trigger expanders created, in xaml or c#.
<canvas.triggers> <eventtrigger routedevent="expander.expanded" sourcename="expander"> <eventtrigger.actions> <beginstoryboard> <storyboard> <doubleanimation from="0" to="1" duration="0:0:0.25" storyboard.targetname="listbox" storyboard.targetproperty="(frameworkelement.layouttransform).(scaletransform.scaley)"/> </storyboard> </beginstoryboard> </eventtrigger.actions> </eventtrigger> </canvas.triggers>
something have errors , need x:type expander
created expanders in canvas.
can me?
try like:
<canvas.resources> <style targettype="expander"> <style.triggers> <eventtrigger routedevent="expander.expanded"> <eventtrigger.actions> <beginstoryboard> <storyboard> <doubleanimation from="0" to="1" duration="0:0:0.25" storyboard.targetname="listbox" storyboard.targetproperty="(frameworkelement.layouttransform).(scaletransform.scaley)"/> </storyboard> </beginstoryboard> </eventtrigger.actions> </eventtrigger> </style.triggers> </style> </canvas.resources>
if placed in resources style should applied expanders
because of targettype
.
Comments
Post a Comment