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 3432114
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:24:33+00:00 2026-05-18T07:24:33+00:00

I have a canvas control which I’m housing a shape and some text in.

  • 0

I have a canvas control which I’m housing a shape and some text in.

<Canvas x:Name="myCanv">
  <Rectangle x:Name="myRect" Stroke="Gray" Fill="Blue" StrokeThickness="3" Width="675" Height="350"/>
  <TextBlock x:Name="myText"/>
</Canvas>

In my code behind i’ll be changing the text as events occur and I thought it’d be neat to place the text in the center of “myRect”.

I found a great blog post on how to center text in a canvas control in WPF app using MultiBinding Converters. After reading it, I tried it out for WP7 only to be met with pain!

Unfortunately, it seems as though Silverlight 4 (of which WP7 Silverlight is a subset) doesn’t have MultiBinding Converters. I then found a blog which has code for MbC in SL4, but i can’t open the project in VS2010 Express.

Has anyone either
A) Centered text via a value converter
or
B) found a better way to center the text without using a value converter

…? 🙂

  • 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-18T07:24:33+00:00Added an answer on May 18, 2026 at 7:24 am

    You could just put the textbox outside the canvas in the visual tree but absolutely position it to the same size and location. You could then set the horizontal and vertical alignment on the textblock so that the text appears as if centered in the canvas.

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

Sidebar

Related Questions

I have some Tkinter canvas and some picture of lines and text on it.
I have a user control which has a Canvas of height 100 and width
I have a Canvas in a Flex application which has items inside it that
My problem is: I have a Canvas which covers part of my Window. The
In my Silverlight application I have Canvas control in ScrollViewer and lot of controls
I have a WPF (.NET 3.5) control which renders about 20000 rectangles. This MyControl
We have a custom canvas which has specialized nodes that behave a lot like
I have a Control inside a Canvas and I want to be able to
I have a custom DrawingCanvas which is inherited from Canvas. When I add a
I have a canvas with user controls arranged on it. When a tooltip is

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.