Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7519189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:51:41+00:00 2026-05-30T01:51:41+00:00

I am reading a Pro Silverlight 4 book (http://my.safaribooksonline.com/book/programming/csharp/9781430229797/xaml/element-to-element_binding), and I do all examples

  • 0

I am reading a Pro Silverlight 4 book (http://my.safaribooksonline.com/book/programming/csharp/9781430229797/xaml/element-to-element_binding), and I do all examples from the book. But an example from the binding chapter doesnt work for me. The slider doesnt move after I compile and run the application:

<UserControl
x:Class="SilverlightApplication14.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid
    x:Name="LayoutRoot"
    Background="White">
    <Slider
        x:Name="sliderFontSize"
        Margin="3"
        Minimum="1"
        Maximum="40"
        Value="10"></Slider>
    <TextBlock
        Margin="10"
        Text="Simple Text"
        x:Name="lblSampleText"
        FontSize="{Binding ElementName=sliderFontSize, Path=Value}"></TextBlock>
</Grid>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:51:42+00:00Added an answer on May 30, 2026 at 1:51 am

    Dave S, is absolutely correct. You can see the Z-Index problem reversing the order of the controls (so the TextBlock is before the Slider)- it will then work because the slider will be on top of the TextBlock:

    <Grid 
    x:Name="LayoutRoot" 
    Background="White">
        <TextBlock 
        Margin="10" 
        Text="Simple Text" 
        x:Name="lblSampleText" 
        FontSize="{Binding ElementName=sliderFontSize, Path=Value}"></TextBlock>
        <Slider 
        x:Name="sliderFontSize" 
        Margin="3" 
        Minimum="1" 
        Maximum="40" 
        Value="10"></Slider>
    </Grid>
    

    You can see here that Z-Index is determined by the order of controls in the XAML.

    An alternate way round this (or to demonstrate) is to specify the Z-Index attached property explicitly:

    <Grid 
    x:Name="LayoutRoot" 
    Background="White">
        <Slider 
        x:Name="sliderFontSize" 
        Margin="3" 
        Minimum="1" 
        Maximum="40" 
        Value="10" Canvas.ZIndex="1"></Slider>
        <TextBlock 
        Margin="10" 
        Text="Simple Text" 
        x:Name="lblSampleText" 
        FontSize="{Binding ElementName=sliderFontSize, Path=Value}"></TextBlock>
    </Grid>
    

    The best way to fix this is to simply make sure that the elements don’t overlap each other, by putting them in different rows:

    <Grid 
    x:Name="LayoutRoot" 
    Background="White">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Slider Grid.Row="1" 
        x:Name="sliderFontSize" 
        Margin="3" 
        Minimum="1" 
        Maximum="40" 
        Value="10"></Slider>
        <TextBlock
        Margin="10" 
        Text="Simple Text" 
        x:Name="lblSampleText" 
        FontSize="{Binding ElementName=sliderFontSize, Path=Value}"></TextBlock>
    </Grid>
    

    In this sample, the TextBlock is in row 0 and the slider is in row 1, so they no longer overlap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading a book called Pro .NET 4 Parallel Programming in C# by Adam
I'm currently reading the book Pro Asp.Net MVC Framework. In the book, the author
I was reading Steven Sanderson's book Pro ASP.NET MVC Framework and he suggests using
I started reading the Pro Business Applications with Silverlight 4 and I'm having the
I'm reading Pro JPA 2. The book talks begins by talking about ORM in
In the book I'm reading Pro Linq in C# 2010 (APress, Freeman and Ratz)
This is sort of out of curiosity question. Reading through Pro Android 3 book
I reading Steven Sanderson's book, Pro Asp.NET MVC 2 Framework. I'm on page 116
I'm reading the Pro ASP.NET MVC3 Framework book from Freeman and Sanderson and have
Currently I'm reading a book (Pro ASP.Net Framework). In this book, the author suggests

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.