WPF : Resize DataTemplate -


i tried set width , height property data template control control keeps default size.

<itemscontrol grid.row="1" x:name="containerusers" itemssource="{binding validusers}" >                 <itemscontrol.itemspanel>                     <itemspaneltemplate>                         <wrappanel isitemshost="true"  allowdrop="true" cliptobounds="false" dragenter="panelusers_dragenter" drop="panelusers_drop" />                     </itemspaneltemplate>                 </itemscontrol.itemspanel>                 <itemscontrol.itemtemplate>                     <datatemplate>                         <my:picturelabelcontrol width="20" height="50" />                     </datatemplate>                 </itemscontrol.itemtemplate>             </itemscontrol> 

in fact have 3 panels these , wish change size of control when comes panel drag n drop.

<usercontrol x:class="vhtservice.wfm.view.picturelabelcontrol"          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"           mc:ignorable="d" cursor="hand" focusable="true" margin="3"> <grid>     <grid name="grid1">         <label content="{binding labeltext}" focusable="true" fontsize="12" fontweight="normal" horizontalcontentalignment="center"                 name="lblpicture" verticalcontentalignment="center" height="26" verticalalignment="bottom" />         <image source="{binding picture}" focusable="true" name="imgavatar" stretch="uniform" margin="0,0,0,26" gotfocus="imgavatar_gotfocus"                 lostfocus="imgavatar_lostfocus" />     </grid> </grid> 

i made following example window , items respect size given. post picturelabelcontrol? think error somewhere in there.

<window     x:class="project1.mainwindow"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:system="clr-namespace:system;assembly=mscorlib"     title="mainwindow"     height="350"     width="525">     <itemscontrol>         <itemscontrol.itemspanel>             <itemspaneltemplate>                 <wrappanel                     isitemshost="true"                     allowdrop="true"                     cliptobounds="false"/>             </itemspaneltemplate>         </itemscontrol.itemspanel>         <itemscontrol.itemtemplate>             <datatemplate>                 <textblock                     background="gray"                     text="{binding}"                     width="50"                     height="50"/>             </datatemplate>         </itemscontrol.itemtemplate>         <itemscontrol.items>             <system:string>foo1</system:string>             <system:string>foo2</system:string>         </itemscontrol.items>     </itemscontrol> </window> 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -