.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Aply correct template based on a type

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :WPF

Dear all,

I have the follwoing xaml code snipet:

I will try something else and if could not find will try to build a small demo to reproduce

by the way do you thing that in folowing snipet a trigger can be use to test the type of an Item and then based on that type set the property ItemTemplate to correct one ?

 <Style TargetType="{x:Type s:LibraryStack}">
 <Setter Property="ItemTemplate" Value="{StaticResource LibraryItemTemplate}"/>
 <Setter Property 

View Complete Post

More Related Resource Links

Updating sites based on a template


I'm currently planning a SharePoint site which will hold a number of subsites. All of these subsites will be based on a sitetemplate. Now in the future, I'm forseeing changes being made to that template. That's because at this point, it's not 100% clear how the subsites should look. We're probably going to miss out on some things which we will correct in the future.

Now suppose I've got a 100 sites already created and my manager tells me that I have to add a document library. I can add it, save the site template again and all the newly created sites (sites are created in our CRM app) will have the new document library. But what about all the sites already there? They'll won't get updated so they won't have the new document library. And if I want to add it, I would have to add it manually a 100 times, or write some code which will add it.

Now a new document library is only an example. There could be a lot more going on, like pages changing, webparts being added or deleted, etc. How do you guys facilitate such things? Or is a question of once a site is created it's just bad luck?

MCTS in Web Application Development in .NET 2.0

Creating a volume control slider/setting one template property based on another

So, what I want to do, is to make a volume control that looks like a right angle triangle with the 90 degree angle on the bottom right, and then when you click on it, the area to the left of the selected point is shown in a different color.  In other words, I've created a slider with the right background, what I can't do, is work out how to show the selected area by filling in the triangle.  I have worked out how to bind the height of my triangle on the left to the value of the control, but right now, the rate of rise is exactly half of what I need it to be.  I need to know how to change the template for the area to the left of the selection ( which is the repeat button ) so that the background is twice the height that it is right now.  No matter what size I make the slider, the area is always 1/2 the size it needs to be, so I am sure if I could get it to double inside my template, it would work fine. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">       <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">         <Setter Property="SnapsToDevicePixels" Value="true"/>         <

How To "Upload a new document template" to Content Type via Web Service

I hope someone can help me. Let me begin by saying that I'm not a programmer; so I 'may' not get the terminology exactly right, but hopefully someone will know what I mean. I am using SharePoint 2010 along with a 3rd party application that I'm using for creating, managing and executing workflows.  The workflow application I'm using is Nintex Workflow 2010.  As such, I can only use functions, services, commands...etc...that are offered to me by that application. Anyway, what I am trying to do is simply replace a document template that is being used for a particular content type with another document template. For this I believe I need to use the Webs.UpdateContentTypeXmlDocument Method.  More information is provided here (http://msdn.microsoft.com/en-us/library/websvcwebs.webs.updatecontenttypexmldocument.aspx). The Webs.UpdateContentTypeXmlDocument method requires two parameters..."contentTypeId" and "newDocument". "contentTypeId" - I have got the Content Type ID by clicking on the content type and viewing the URL shown in my browser.  So, I am confident that my content type id is correct and is "0x010100C392CF11DE923A4E8AB9018B0A42119303". "newDocument" - The MSDN article states...'A string that represents the XML document to replace the existing XML document.".  To be honest, I'm not 100%

Custom Entity Framework template and access to the database type

First and foremost ... I already made a few changes in the template, the most important one changing the methods generated for stored procedures with OUTPUT parameters and no resultset so that instead of instantiating a few OutputParameter objects, passing them to the method and extracting the values (all without any type checking) you just call the method with a few "out someType?" parameters so I do not need the very basics. I am totally confused by all those GlobalItem, EdmProperty, BuiltInTypeKind, TypeUsage and all this made of objects, all alike and all different though so as soon as I need more data than what's already used by the template I run into problems :-(What I would like is to change the WritePrimitiveTypeProperty() so that it outputs [StringLength(xxx)]  for all char, varchar, nchar and nvarchar properties. But I can't find a way to get from an EdmProperty in the model to the database type in the store.Can anyone help me?In case anyone is interested here's the modified stored procedure mapping code for the template. The first code replaces the original in the .tt: //////// //////// Write EntityContainer and ObjectContext Function Import methods. //////// region.Begin(GetResourceString("Template_RegionFunctionImports")); foreach (EdmFunction edmFunction in container.FunctionIm

How can create site in sharepoint foundation 2010 based on WSS 3.0 template(.stp file)

Hi,   I  want  to migrate wss3.0  site into sharepoint foundation 2010 site . earlier we  were creating site based on .stp file  in WSS 4.0 . but now we  have   to build same site in sharepoint foundation 2010. I followed  the old way  intall the .stp file  and  based on that trying to create new  site  but getting some error  old version template is not supporetd my this version. how could  l able to create  site  in sharepoint foundation 2010 based on wss 3.0 template . Please help Thanks in advance Jandel Singh

How can create site in sharepoint foundation 2010 based on WSS 3.0 template(.stp file)

Hi,   I  want  to migrate wss3.0  site into sharepoint foundation 2010 site . earlier we  were creating site based on .stp file  in WSS 4.0 . but now we  have   to build same site in sharepoint foundation 2010. I followed  the old way  intall the .stp file  and  based on that trying to create new  site  but getting some error  old version template is not supporetd my this version. how could  l able to create  site  in sharepoint foundation 2010 based on wss 3.0 template . Please help Thanks in advance Jandel Singh

How Would I Design a Trigger Based on Object Type?

I have doing some research trying to figure out how I could create a trigger or datatemplate that would react based on an Object's type, but haven't found a decent explanation. In code I could use "GetTyoe()" but I am unsure if that is possible in XAML. As a basic example, if the Object is of Type "A" I want to bind the content of a label to a certain property of object "A", but if the object is of Type "B" I want to bind to a different property. I guess the big question is: How do I determine an objects type from XAML?

Creating a workflow condition based on document type

Hello! I'm creating a workflow for a Document Library. I only want the action in the workflow to be executed on the condition that the document is of a certain document type. Any suggestions how I should do that? Thanks!

How to display TreeViewItems different ways based on the item type under a single node?

Hi, I am having trouble trying to display hiearchical data under each node in two different ways depending on the data.  I hope someone will be able to provide me some help on this since I am rather new to WPF development. Maybe I am going about this all wrong but for now, I am trying to create a customized TreeView to represent data similar to the xml I provided in the code below.  The <ItemsPresenter/> instances listed in the code are not exactly doing what I need.  I will probably need to filter the content that I list with each of the two <ItemsPresenter/> tags based on the type of each item although I have no idea if this is possible.   <Window x:Class="Wpf_treeview_testing.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <!-- * The "xmlData" describe roughly the type of data that I require visual representaion of. * Since I could not find a WPF Control that will present a Hierachical Data Template close to what we need, I am trying to setup a TreeView to represent this information by using a ControlTemplate for TreeViewItem. * The preferred result is to present different items types in

Request for Proposal Template: "Request Document" list not showing correct files


Hi, I've ran in to a challenge with the standard Request for Proposals (RfP) template. Due to the number of proposals we use, the huge number of documents per proposal and a need to keep historic results I have had to add folders into the "request documents" library for each RfP to reduce the number of documents shown in the list when creating an RfP and confusing users.

All works fine, however when I create a new RfP, I see additional files in the "request documents" list instead of just the folder names. It looks like it is also readin gthe contents of each foldr, but not all files are listed. Versioning is turned on for major and minor releases as default.

As I am unable to view the details of the standard new RfP page I am struggling to work out how to fix this.


Any ideas?





Correct Boolean type when designing database table?


In my VB.Net code I am using boolean type and it is later stored through a stored procedure to a MS SQL database table. I have so far allways been using "int" as the column type in database table because there is no Boolean type to choose from when designing the columns of a table in the MS SQL Express?

Is it correct to use the column type int for storing Boolean values?

/Kontorslokaler Stockholm

Creating Content Type in a Hub and creating lists based on this content type



I am building a prototype of a Sharepoint app and I am new to this technology. We have a need for a piece with News items. Someone comes to a sharepoint site and adds a news piece there. This news content piece needs to be approved and to do that approver goes to a staging environment where they can see this news post in proper context (of how it would look in production) and can approve it. If they reject it, news piece never gets propagated to pro environment which also subscribes to this content type.  What I did was I created content type hub with a "News" content type in a Content Type hub and subscribed other sites to this hub. I can see this content type in subscribing sites.

I have following questions regarding this problem:

- Is it the right architecture for such a task?

- I am trying to create a list which would manage adding and editing of news items but I can't find any option to bind a custom list with content type, I can add site columns to a list but I am not able to base a list on a content type.

Thanks for your input.

updating view based Clr type


i created a clr type (point) and table.

i have view based properties of this type (select C1.X , C1.Y from tableName)

how can i update this view ( i don't have in view the source object(point))


Provision an InfoPath form template in a content type, with "view in browser" option

Hi all.
I've to provision an InfoPath form template in SharePoint 2010 within a content type, and my form must be open in a browser.
The provision of the .xsn file and of the content type goes well, but my form always open in the client and not in the browser. Instead, if i publish my form from InfoPath 2010 using the "Publish" option and i select to publish my form within a content type, everything goes well. I can see the form in the browser.

Here is my code.


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <Module Name="OpeningJeans" Url="_cts/MY CONTENT TYPE" RootWebOnly="TRUE">
  <File Path="InfopathModules\MyForm.xsn" Url="MyForm.xsn" />


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Form (0x010101) -->
 <ContentType ID="0x0101

External Data Fields in a Word Template saved as a content type in a document library with multiple


I have created a Word Template for a Document Library that has an External Data Column in it of Client Name which also adds Client Address1, Client Address2, Client City, Client State, & Client Zip.  Now this works fine for a Document library with that template as the Template.dotx file. 

I want to be able to make a bunch of Templates and have them all as Content Types in one Library.  When I do this I cannot get the External Data Quick Parts to work.

Anyone have any ideas?

Custom document library list template issues with custom content type


Either I don't know what SharePoint is doing or I don't know what I'm doing (or both, which is more likely).

I'm attempting to create a Custom Document Library template with a custom content type association (Custom Document), all using a feature. When I create
a document library based on the installed template, the content type association is there. However, when I click on New Custom Document, the template.dotx does not reflect the Custom Document content type association. The Word document information panel does not show any Custom Document content type properties (like Title and Comments).

Here are the steps I've taken:

1. Create the feature.xml with element manifests of contentType.xml and CustomDocumentLibrary.xml
2. Create the contentType.xml (Custom Document) with an additional field reference for Comments
3. Create the CustomDocumentLibrary.xml for the list template
4. Create a Custom Document Library subfolder that contains the same files that are in the 12\TEMPLATE\FEATURES\DocumentLibrary\doclib folder.
5. Edit the schema.xml to use the new content type and field reference
6. Deploy and activate the feature
7. Create a new "Custom Document Library"
8. Go to Custom Document Library Settings and verify the Custom Document content type is being used
9. Click on New Custom D

Web method called from JavaScript not returning correct type


Hello all-

I have a web method written in VB.Net, coded as follows:

<OperationContract()> _
        Public Function HowManyExportsLeft(ByVal userId As Integer) As Boolean
            _UserId = userId
            Dim MaxExports As Integer = Me.UserSettings.ExportSettings.ExcelExportSettings.MaximumNumberOfExports
            Dim MyExports As Integer = Me.UserSettings.ExportSettings.ExcelExportSettings.MyExportCount
            Dim returnValue As Integer
            If MaxExports = Integer.MaxValue Then
                returnValue = 999
                returnValue = MaxExports - MyExports
            End If
            Return returnValue
        End Function

Now, on the ClientClick method of an asp:Button, I call the following method :

function CheckExportsRemaining() {
    var hdnUserId = $get(CalcResults.Controls.hdnUserId);
    Services.Common.HowManyExportsLeft(hdnUserId.value, ExportCount_complete);

Which of course on success calls this callback method:

function ExportCount_complete(result) {
    if (result <= 3) {
        eACommonDialog.ShowDialog(getURLString(aspxSiteUrl, 'TrialExports.aspx?exportsRemaining=' + result), 420, 215, '', 75, false, true, '', false
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend