property value inheritance
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: property value inheritance

  1. #1
    Join Date
    Sep 2005
    Location
    Cracow, Poland
    Posts
    345

    Question property value inheritance

    It is perfectly fine to write something like that:

    <StackPanel TextBlock.FontWeight="Bold">
    <Label>dasdas</Label>
    <Grid>
    <Label>dfasdass</Label>
    </Grid>
    </StackPanel>

    But why it is not possible to set fontweight only for labels by writing Label.FontWeight="Bold" ?

    Thank you for help in advance

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,196

    Re: property value inheritance

    Quote Originally Posted by yoyosh View Post
    But why it is not possible to set fontweight only for labels by writing Label.FontWeight="Bold" ?
    Post the xaml code for what you have in mind. It's not clear where you would like to set the Label.FontWeight property.

  3. #3
    Join Date
    Sep 2005
    Location
    Cracow, Poland
    Posts
    345

    Re: property value inheritance

    Hi,

    I would like to set it exactly instead of "TextBlock.FontWeight="Bold"", so to have:

    <StackPanel Label.FontWeight="Bold">
    <Label>dasdas</Label>
    <Grid>
    <Label>dfasdass</Label>
    </Grid>
    </StackPanel>

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,196

    Re: property value inheritance

    Create a style for the Label and set it in there.

  5. #5
    Join Date
    Sep 2005
    Location
    Cracow, Poland
    Posts
    345

    Re: property value inheritance

    That`s ok, but why it is not possible with Label while it is possible with TextBlock?

  6. #6
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: property value inheritance

    TextBlock is a FrameworkElement, Label is a ContentControl.

    They are derived from different classes, thus different DependencyProperty's.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center