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

  • SEARCH
  • Home
  • 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 178629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:15:52+00:00 2026-05-11T14:15:52+00:00

I am not able to use SetTop property Canvas in Silverlight App. Following is

  • 0

I am not able to use SetTop property Canvas in Silverlight App. Following is the minimal code to reproduce the problem

from System import TimeSpan from System.Windows import Application, Duration, PropertyPath from System.Windows.Controls import Canvas, TextBlock from System.Windows.Media import SolidColorBrush, Colors from System.Windows.Media.Animation import (     DoubleAnimation, Storyboard, RepeatBehavior )  root = Canvas()  root.Children.Clear() root.Resources.Clear() #root.Background = SolidColorBrush(Colors.Black)  parent = Canvas(Width = 100, Height = 100) parent.Background = SolidColorBrush(Colors.Black) parent.SetTop(root, 0) parent.SetLeft(root, 0)  parent2 = Canvas(Width = 100, Height = 100) parent2.Background = SolidColorBrush(Colors.Blue) parent2.SetTop(root, 100)  root.Children.Add(parent)  Application.Current.RootVisual = root 

The line ‘parent2.SetTop(root, 100)’ changes the position where parent1 will be displayed.

This behavior is surprising. I am not even adding parent2 as one of the child object still it’s affecting the layout.

Can somebody please explain what I am doing wrong?

  • 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. 2026-05-11T14:15:53+00:00Added an answer on May 11, 2026 at 2:15 pm

    I think you’re using SetTop ‘backwards’. SetTop sets the attached property on a child control of the Canvas so doing this:

    parent2.SetTop(root,100) 

    Sets the Canvas.Top property of root to be 100 (not parent2) (so will hence move all of the children of root too). What you should be doing is:

    root.SetTop(parent, 0) 

    Which will set the Canvas.Top property of parent to be 0.

    More info on MSDN.

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

Sidebar

Related Questions

System.Reflection.Assembly.Load(System.IO.File.ReadAllBytes(path)) So this is a work around to not being able to use T4
I am not able to use SDWebImage on my ios 4.2 app,the current SDWebImage
I'm not able to use my snap view anymore after changing from CP to
Part of my app requires login and is not able to use client-side authentication
I need to use the following query but i am not able to use
When changing the project from console to windows app, I still am not able
Why I am not able to use @model MembershipUserCollection nor @model System.Web.Security.MembershipUserCollection In my
For some reason I am not able to use the TextFlow element in WPF.
I'm trying to use JQuery Slidetoggle functionality, but not able to use properly. The
I'm trying to use JQuery toggle functionality, but not able to use properly. Instead

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.