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

Top 5 Contributors of the Month
Post New Web Links

Styles: Setting Properties in deeper hierarchies

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

I'm not sure how to do a search on this, so I decided to rather ask it instead of doing hours of searching.

I have a class with DependencyProperties and use that class in a UserControl. I use that UserControl in a Window and in that Window I use the Window's Resources to set some Properties on the UserControl. I now like to set some DependencyProperties on that class, which would automatically reflect on the UserControl due the binding.

Is there a way to do it? I couldn't figure it out to do it in the .xaml, which is where I'd like to do this particular task.

View Complete Post

More Related Resource Links

Advanced Basics: Setting Word Document Properties the Office 2007 Way


The last time I wrote this column (March 2006), I shared an application that allows you to update all the Microsoft® Word documents in a folder and its subfolders. Each time the application finds a document in the specified path, it updates the document properties to match those you specified in the application.

Ken Getz

MSDN Magazine June 2006

Setting Page properties from itself


Hi all,

Is there any easy way to set properties of a Page (or UserControl for that matter) from *within itself*?
As an example, I have several .aspx pages which inherit from exactly the same code-behind class, but I need to be able to pass different properties to the class to make them do the correct thing for the specific .aspx.

The only way I've found to do this is to create the following - which works fine, but doesn't feel right....
<script runat="server">
  Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
    Me.MyProperty = True
  End Sub

It would be a much nicer, simplier and easier solution to be able to be able to set MyProperty = True somewhere... is this possible?

The option of hard-coding properties within the class for the "parent" page is not going to work for my situation.

Many thanks in advance,
Tom Smile

Setting properties from a database


 I have a database which holds the path of an image. It also holds the recomended height and width of the image. My question is how can I set the height and width properties from my database? I have tried the following with no avail:

<asp:TemplateField HeaderText="Image" HeaderStyle-HorizontalAlign="Left">
                    <asp:Image ID="Image" runat="server" ImageUrl='<%# Eval("Image") %>'  Width='<%# Eval("Width") %>' Height='<%# Eval("Height") %>'/>


Any Ideas?

Thanks in advance

Programmatically setting Agent Autostart properties


I've written a service to replace the SQL Server Agent service to be independent of Agent when moving to Express versions of SQL Server which do not include Agent.  Obviously on older 2000 MSDE versions I don't want Agent and my service running at the same time so I need to turn off Agent but there are SQL Server Properties such as under the General tab, "Autostart policies when the operating system starts" section and I need to uncheck the "Autostart SQL Server Agent".  In SQL Server Enterprize Manager I can right click the server then select properties and general tab.

How do I change that property either via T-SQL or via VB.NET to uncheck it?



finding control id and setting properties in other pages


hi can anybody help me how to code,

im using a webusercontrol (hide.ascx) it has 2 buttons btn_hide,btn_expand

and in my other forms of all like(products.aspx)customers.aspx,orders.aspx

im using a panel conrol(pnl_products) where in im placing all the input controls.

i want to find the panel control in hide.ascx page and to set that

panel.visble=true/false property in this page.

so that expand and collapse the panel in each page.

Setting "Reduce storage requirements for text properties by using a hash for comparison." using powe


Hey all,

I have a need to enable 'Reduce storage requirements for text properties by using a hash for comparison.' for a crawled property, i'd like to do this in my 'set search scopes' powershell script, where I define everything the crawler should be doing but I can't find the appropriate powershell command to do so, can anyone help?

At the moment I simply have one line setting up the property:


New-SPEnterpriseSearchMetadataManagedProperty -Name $preferredSandwich -SearchApplication $searchApp -Type 1  -RespectPriority 1 
-FullTextQueriable  1 -Retrievable 1 -IncludeinMd5 1	


Setting Windows Services App properties programatically


I've got a Windows Services app I've deployed and I've used the System.ServiceProcess.ServiceInstaller to set the StartType to Automatic and that works great.

How do I set the action on failure to "restart" and the wait time to one minute?

Can't find those properties but if you open up a Service's properties in the UI, there's a Recovery Tab with First Failure, Second Failure etc. and a "Restart service after __ minutes"

Where do I set these properties for my service at design time before deploying??



Setting ShowInDisplayForm, ShowInEditForm, ShowInNewForm properties with powershell


I am trying to set ShowInDisplayForm, ShowInEditForm, ShowInNewForm properties of the filed in a custom list using powershell. This looks straightforward and powershell code is quite simple:

#get the site
$site = new-object Microsoft.SharePoint.SPSite("http://sv42104bosv271")
$web = $site.OpenWeb()
#get the list
$list = $web.Lists["MyList"]
#set col1
$field = $list.Fields["col1"]
$field.ShowInNewForm = "false"
$field.ShowInEditForm = "false"
$field.ShowInDisplayForm = "false"
#set col2
$field = $list.Fields["col2"]
$field.ShowInNewForm = "false"
$field.ShowInEditForm = "false"
$field.ShowInDisplayForm = "false"
#update & dispose

This runs without any error messages in “SharePoint 2010 Management Shell”, but the expected behavior is not being applied. I have also done an iisreset, but still col1 and col2 remain visible in all 3 forms...

Has anyone have a suggestion on this?

Thanks in advance!


WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Automatic vs Explicit Properties

If the reason that motivated the change from automatically implemented property to explicitly implemented property was to change the semantics of the property then you should evaluate whether the desired semantics when accessing the property from within the class are identical to or different from the desired semantics when accessing the property from outside the class.

Dependency Properties

When you begin to develop appliations with WPF, you will soon stumble across DependencyProperties. They look quite similar to normal .NET properties, but the concept behind is much more complex and powerful

Xml File Methods and Properties

Method and Properties of XmlTextWriter class:
The XmlWriter class is a base class that outputs an XML data structure. It has methods to sequentially write XML elements in a proper hierarchy to create an XML file or other types of output streams. The System.Xml namespace provides support for the XmlWriter. It must be imported to the ASP.NET page with the directive

<%@ Import Namespace="System.Xml" %>

The XmlTextWriter

XmlWriter is an abstract class that is implemented as an extended XMLTextWriter class. The XmlTextWriter writes a sequence of XML nodes one element at a time. Output can be written to an XML file, although other streams of output data can be produced. It can create a new file or overwrite an existing file. Its non-cached writing techniques provides very fast generation of an output stream.

Setting the default start page in godaddy hosting?


 How do you set the start page with godaddy hosting? I can see no way of doing this! You do not seem to have access to the IIS settings that allow you to change it!

Setting Screen Resolution



  I am developing a website in asp.net.How can i make my web pages view same in different screen resolutions.I am using 1024*768 resolution

Error while setting up application on Win7 using Visual Studio.NET 2003


Hi All,

Getting the below error while setting up application on Win 7 using visual studio.NET 2003.


cannot find the components for communiacting with the front page server extensions...


I understand by the error, i need to install Front page server extension, but not able to figure how to install using IIS 7.5.

I had XP machine with IIS 5.1, able to find the option.


Need your help in resolving this.




Setting default localization



I ever thought that I can set a default localization if the users one (which is set in the browser) isn't available.

I've implemented my localresource files for localization. The start.aspx.resx contains all texts and elements for German use and the start.aspx.en.resx for English users. When I switch the language in the browser settings from German to English everything works fine and the english text is displayed. But when I switch to an other language which is not German or English, it takes defaulty the german resource files.

I've set

UICulture="auto:en-US" Culture="auto:en-US"

as well, but it didn't assume the .en resource file automatically. (For example when I enter the website and switch the browser language to French or Italian it should take the english resource files.)

Thanks and regards,

C# conversion to VB and properties


I am trying to implement image caching for a web application and I found some code on the Internet that implements an HttpHandler that does this. The code was in C# and since my web app is written in VB, I decided to convert the code to VB. I managed to convert everything except the following code (in bold):

public class FileExtensionCollection : ConfigurationElementCollection
        public override ConfigurationElementCollectionType CollectionType
                return ConfigurationElementCollectionType.AddRemoveClearMap;

        public FileExtension this[int index]
            get { return (FileExtension)BaseGet(index); }

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