Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

windows phone 7 - How to fill generated Pivot Elements with data [templates] -


howdy, generate in application several pivotitems in pivotelement. generation proceeding fine, don't know how can apply template pivot elements.

i thought need use:

pivotitem.contenttemplate = (datatemplate)ressources["kantinenuebersicht"];

but producing empty page.

my code in ressource file looks following:

inserted whole ressources file

<.resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<datatemplate x:key="kantinentemplate">     <stackpanel verticalalignment="top">             <textblock horizontalalignment="left" textwrapping="wrap" text="{binding name}" fontsize="{staticresource phonefontsizelarge}" margin="8,0,0,0" verticalalignment="top"/>             <textblock horizontalalignment="left" textwrapping="wrap" text="{binding entfernung}" margin="24,0,0,0" fontsize="{staticresource phonefontsizesmall}" verticalalignment="bottom"/>     </stackpanel> </datatemplate>  <datatemplate x:key="kantinenuebersicht">         <grid>             <textblock x:name="kantinenname" fontsize="{staticresource phonefontsizeextralarge}" text="" rendertransformorigin="0.566,0.407" margin="0,0,8,0" height="55" verticalalignment="top">                         <textblock.foreground>                             <solidcolorbrush color="{staticresource phoneaccentcolor}"/>                         </textblock.foreground>             </textblock>             <textblock x:name="sdfsdf" horizontalalignment="left" height="40" margin="8,59,0,0" textwrapping="wrap" text="textblock" verticalalignment="top" width="196"/>             <textblock x:name="lblgeoefsdfsdffnet" height="40" margin="208,59,8,0" textwrapping="wrap" text="textblock" verticalalignment="top"/>         </grid>     </datatemplate></resourcedictionary.> 

had insert . in first tags...

what you're trying correct.

in question have "s" in "resources" issue.

if take code question, can add page:

<phone:phoneapplicationpage.resources>     <datatemplate x:key="kantinenuebersicht">         <grid>             <textblock x:name="kantinenname" fontsize="{staticresource phonefontsizeextralarge}" text="" rendertransformorigin="0.566,0.407" margin="0,0,8,0" height="55" verticalalignment="top">                  <textblock.foreground>                   <solidcolorbrush color="{staticresource phoneaccentcolor}"/>                  </textblock.foreground>             </textblock>             <textblock x:name="lblentfernung" horizontalalignment="left" height="40" margin="8,59,0,0" textwrapping="wrap" text="textblock" verticalalignment="top" width="196"/>             <textblock x:name="lblgeoeffnet" height="40" margin="208,59,8,0" textwrapping="wrap" text="textblock" verticalalignment="top"/>         </grid>     </datatemplate> </phone:phoneapplicationpage.resources> 

and use when creating new item:

var newitem = new pivotitem { header = "added" };  newitem.contenttemplate = (datatemplate)resources["kantinenuebersicht"];  mypivot.items.add(newitem); 

works on machine (emulator).

update:
if want add resource separate file can like:

resourcedictionary.xaml:

<resourcedictionary     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >     <datatemplate x:key="kantinenuebersicht">         <grid>             <textblock x:name="kantinenname" fontsize="{staticresource phonefontsizeextralarge}" text="" rendertransformorigin="0.566,0.407" margin="0,0,8,0" height="55" verticalalignment="top">                      <textblock.foreground>                       <solidcolorbrush color="{staticresource phoneaccentcolor}"/>                      </textblock.foreground>             </textblock>             <textblock x:name="lblentfernung" horizontalalignment="left" height="40" margin="8,59,0,0" textwrapping="wrap" text="textblock" verticalalignment="top" width="196"/>             <textblock x:name="lblgeoeffnet" height="40" margin="208,59,8,0" textwrapping="wrap" text="textblock" verticalalignment="top"/>         </grid>     </datatemplate> </resourcedictionary> 

then must reference external file in page wishes use file.

<phone:phoneapplicationpage.resources>     <resourcedictionary>         <resourcedictionary.mergeddictionaries>             <resourcedictionary source="\resourcedictionary.xaml"/>         </resourcedictionary.mergeddictionaries>     </resourcedictionary> </phone:phoneapplicationpage.resources> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -