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

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

How to use a custom Property in style

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

hi, i have Class like that;

class CASUICombobox : System.Windows.Controls.ComboBox  

        private bool m_bShowShadow = false;
        public bool ShowShadow
            get { return m_bShowShadow; }
            set { m_bShowShadow = value; CreateShadow(); }

        DropShadowEffect m_Shadow;

        private void CreateShadow()
            if (ShowShadow && m_Shadow == null)
                m_Shadow = new DropShadowEffect();
                m_Shadow.ShadowDepth = 3;

View Complete Post

More Related Resource Links

Custom Server Control Property not maintaining state


I have created a server control consisting of a TextArea and a div under it.  My goal is to create my own asp:TextArea type control.  the div is for a Character count of the text area and seems to work ok but i added a CharacterCountVisible property to the control that is always returning true.  See Proptery definition below


<Bindable(False), Category("Appearance"), DefaultValue("True"), Localizable(True)> Property CharacterCountVisible() As Boolean
        Return _CountBoxVisible
    End Get
    Set(ByVal value As Boolean)
        _CountBoxVisible = value
    End Set
End Property

Note the _CountBoxVisible variable is define inside the class as :

Dim _CountBoxVisible as Boolean = True

What I am trying to do is give the user/coder the option to show/utilize the char count feature.  Can make it disappear with textarea1.CharacterCountVisible = False but setting it to true will not make it display.


What am i missing





DataGrid: Tailor Your DataGrid Apps Using Table Style and Custom Column Style Objects


One of the most enduring challenges in writing user interfaces is figuring out how to display large amounts of data efficiently and intuitively without bewildering the user. The problem becomes particularly thorny when the interface must reflect hierarchical relationships within the data that the user needs to modify. The Windows Forms DataGrid control gives developers a powerful and flexible tool to meet this challenge. This article explains its basic operations and shows how to extend the DataGrid to display columns of data in an application-appropriate manner.

Kristy Saunders

MSDN Magazine August 2003

Unable to search Custom User Property Created in User Profiles in SharePoint 2010


Hi ,

I have created a custom user property,and created metadata property and added mapping to it, still i m not able to Search in People,Please advise

Problem in Custom Control Unable to find Control To Validate Property


I make a custome control by taking a TextBox and A Regular Expression Validator.When i Use this on a .aspx page it works fine.But when i use this on .ascx page and dynamically load user control on a place holder in .aspx page it through an Error

Unable to find control id '_ctl0:txtEmail' referenced by the 'ControlToValidate' property of '_ctl0:txtEmailRequired'


My Custome control Code is this"--

public class EmailValidator:System.Web.UI.Control, INamingContainer{

private System.Web.UI.WebControls.TextBox textBox;

private System.Web.UI.WebControls.RegularExpressionValidator regularExpressionValidator;

public EmailValidator(){

textBox = new TextBox();

regularExpressionValidator = new RegularExpressionValidator();

IsErrorTextBelow = true;

IsRequired = false;

In a style template, express a property in terms of the controls properties it is applied to.

Hello,   In the style template below, which works fine, I'd like to express the "Points" property in terms of the applied to controls "Width" and "Height" properties.  As you see, the "Fill" property is expressed in terms of the "Background" property the template is applied to by means of Fill="{TemplateBinding Background}".  The following does not work:   Points="0,({TemplateBinding Height} / 4)  ({TemplateBinding Width} / 12.5),({TemplateBinding Height} / 4) . . ."   Is what I'm looking for possible, all in XAML, no code/converters? <Style x:Key="FolderButton" TargetType="Button"> <Setter Property="Margin" Value="2.5" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Polygon Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Points="0,5 4,5 6,0 23,0 25,5 50,5 50,20 0,20"/> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </ControlTemplate>

DateTime custom managed property search fails with " Your query is malformed. Please rephrase your q

I've created a front end search page in Silverlight 4 for SharePoint Search.  Currently we are using WSS 3.0 + Search Server Express 2008 (v  The page interacts with the MOSS version of the search web service at:   <site collection>/_vti_bin/search.asmx The reason for this approach is the unique way the requirements specify the look and behavior of the results.  The built-in Search Center page or web parts will not satisfy these requirements. We are going into production but I still cannot figure out how to search against my custom managed properties that are of Type DateTime.  If I cannot get this to work, it is a showstopper. I've tried numerous variations on the SQL Syntax and cannot get it to work.  I know the error is in the date portion of the WHERE clause since I can remove it and searches work fine. Here is a working query: SELECT Size, Rank, Path, Title, Description, Write, RequestSubmittedDate, DocumentType, RequestPromisedDate, ProblemDescription, DatePublished, RequestOwner, RequestingDepartment, DocumentAuthor, ProjectNumber, ProjectDescription, RequestStatus FROM scope() WHERE CONTAINS ('"nmr"') ORDER BY "Rank" DESC yet if I try to use a date literal in the WHERE clause as in the following query modification, I get the "malformed"

Binding a property within a style - in code

So if I had a style as follows <Style TargetType={x:Type Button}> <Setter Property="Background" Value={Binding myproperty} /> </Style> How could I achieve this in code? So far I got Style x = new Style(); Setter a = new Setter(TextBox.Property, new Binding("myproperty")l but there seems to be something wrong with the way I set up the binding, how can I correct it? Thanks

Defining a custom style for a derived DataGrid

Hi all, Please tell me what I could be missing here. I am trying to define a very basic style for a derived DataGrid and it doesn't seem to take! In my dll project, I have this in the Generic.xaml: <Style TargetType="{x:Type local:MyDataGrid1}" BasedOn="{StaticResource {x:Type DataGrid}}"> <Setter Property="RowBackground" Value="#AAEAEFF4"/> <Setter Property="AlternatingRowBackground" Value="#00FFFFFF"/> </Style>  .. and this is how the derived grid is currently (pretty empty until I have this figured out): public class MyDataGrid1 : DataGrid   {     static MyDataGrid1()     {       DefaultStyleKeyProperty.OverrideMetadata(typeof(MyDataGrid1), new FrameworkPropertyMetadata(typeof(MyDataGrid1)));     }   } And in my Sample App's MainPage.xaml, I simply have this: <mygrids:MyDataGrid1 x:Name="dataGrid1" /> But, the alternating colors are not applied! Interestingly, in debugger I see that the properties are set to these values in this instance, but the for some reason while rendering, these values were not used! Please help. Thanks

Custom Workflow Activity dependency property FieldNames

I have a custom actvity in VS2008. All is well until I added a new dependancy property like so: public static DependencyProperty EventLookupColumnNameProperty = DependencyProperty.Register("EventLookupColumnName",typeof(string),typeof(FTFSyncEventToAttachmentListItem)); public static DependencyProperty EventLookupColumnIDProperty = DependencyProperty.Register("EventLookupColumnID",typeof(string),typeof(FTFSyncEventToAttachmentListItem)); [Description("Event Lookup Column Name")][DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)][Browsable(true)][ValidationOption(ValidationOption.Required)]public string EventLookupColumnName{get { return ((string)(base.GetValue(EventLookupColumnNameProperty))); }set { base.SetValue(EventLookupColumnNameProperty, value); } [Description("Event Lookup Column ID")][ValidationOption(ValidationOption.Required)][Browsable(true)][DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]public int EventLookupColumnID{get { return ((int)(base.GetValue(EventLookupColumnIDProperty))); }set { base.SetValue(EventLookupColumnIDProperty, value); }}Then in the actions file:    <Action Name="FTF Sync Event To Attachment List Item"   ClassName="DP.Sharepoint.Workflow.FTFSyncEventToAttachmentListItem"   Assembly="DP.Sharepoint.Workflow, Version=, Cultur

Creating custom property on derived Page

I am attempting to accomplish the following during the creation of a Page derived from DerivedPage: <local:DerivedPage xmlns="..." xmlns:x="..." xmlns:local="..." MyProperty="My Value" Title="My Title"> ... </local:DerivedPage> You'll notice an extra property MyProperty in there. The code-behind is like this: class DerivedPage : Page { public string MyProperty { get; set; } ... } When I execute this, I get a null reference in InitializeComponent() when I create a Page derived from DerivedPage. I also tried making MyProperty a dependency property.  But I get the same results. How can I create a property for my new base-class that's set in the markup of my derived class. Thanks, ...Matt

Accessing Custom Property in HTML???


i have a usercontrol with a few dropdownlist....n i am using that usercontrol in few pages and depending on pages those dropdownlist  can be enabled mode or disabled mode.

so i created a property:

private string _readOnly;
        public string ReadOnly
         set {
                if (value == "true")
                    ddlOTime.Enabled = false;

Now i am accessing in HTML as

<uc3:OpenTime ID="OpenTime1" OTime='<%#Bind("OpeningTime")%>' ReadOnly="true" runat="server" />

it seems to work.

Just curious know that am i going in right direction or any better approach is available?


Printing Problem :- Style.Overflow property in Firefox


Hi All,

I have a web application which has two DIV, one is main and one is child. I am having  problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.

Now i am using divMain.style.overflow = "visible"

After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll bar

Now if after print i give divMain.style.overflow = "Auto" OR divMain.style.overflow = "Scroll", still the scroll bar doesn't come and if it comes then its inactive. I am unable to see the complete data on the page after the print is taken.

The problem is not coming in I.E and the full data with scroll bar is recovered in I.E.

Please help me how to get the normal page with full data and scroll bar after printing in Firefox. 




Printing Problem :- Style.Overflow property in Firefox


Hi All,

I have a web application which has two DIV, one is main and one is child. I am having  problem in printing multiple pages. There is a lot of data in the child DIV and i am using JavaScript functions to control the print functionality. When i print using window.print(), only the data on the main page currently being showed is printed. I further researched and checked out the Style.Overflow property.

Now i am using divMain.style.overflow = "visible"

After this the complete print comes. But in Firefox, the scroll bar disappears and only single page is left with no scroll

Sorting search results by custom managed property


I am customizing the XSLT for the core results webpart to give the user the option to sort search results by a certain managed property. There are several managed properties that I am listing on the search results page, and when the user clicks one, it should sort the results by that property.

In MOSS 2007, you could use the "v=property" parameter in the URL to define the sort order, but this doesn't seem to work anymore in SharePoint 2010. Are there any ideas on how to accomplish this?

Cant adjust Box size in Custom view with Box style implemented in sharepoint



i have a sharepoint view which has boxed style implemented to it. It displayes information in form of two boxes adjacent to each other on the site. the issue i am facing is that the two boxes are of unequal size. The left size box takes enough space and hence the box adjacent box has to squeez in the left over space.

how can i customise those according to  my needs. any help would be appreciated.

Thanks in advance



not able to set custom property of web part on page load


I am not able to set the custom property of the web part on page load.

It gives me exception if i try to get or set that property but i can still access other inbuilt property of the web part and can display them on the page.


I am using sharepoint designer and MOSS 2007.

ReadOnly Property of a Custom NativeActivity in Rehosted WorkflowDesigner


Dear All,

In Property Panel of a rehosted designer, I want a property (InArgument) of a custom NativeActivity to be read-only. Is it possible to do that? I have tried to use ReadOnlyAttribute, but the property become vanished.

Any help will be appreciated.

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