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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:56:37+00:00 2026-05-15T04:56:37+00:00

In the <ImageBrush/> element, there are AlignmentX and AlignmentY attributes with values Left/Center/Right and

  • 0

In the <ImageBrush/> element, there are AlignmentX and AlignmentY attributes with values Left/Center/Right and Top/Center/Bottom, respectively.

What I’m wanting to do is set my own value in, for example, AlignmentX either as a value or as another enumeration like AlignmentX="HalfCenter" where HalfLeft equals my own value (halfway between Center and Left). For example, if I have this:

    <Rectangle Canvas.Left="0" Stroke="LimeGreen" StrokeThickness="16" Canvas.Top="0" 
               Width="400" Height="400" >
        <Rectangle.Fill>
            <ImageBrush ImageSource="newone.jpg" 
                       Stretch="None" AlignmentX="HalfLeft" AlignmentY="Top"  />
        </Rectangle.Fill>
    </Rectangle>

I don’t know if this is a Dependency Property, Attached Property or otherwise (don’t yet know how to create those). In the helpfile, it says in TileBrush.AlignmentXProperty field: Public Shared ReadOnly AlignmentXProperty As DependencyProperty. Does the ReadOnly word here mean that I can’t set this property to a custom property?

If this can’t be an override of that property, how can I create my own? I think this is an Attached Property and it could be called something different, like OffsetX and OffsetY that set an ImageBrush to a location inside its parent Shape. I’m getting very confused by the SL documentation on how I would do this though (almost no examples in VB.NET – but even the C# ones aren’t all that revealing).

If it is possible, how would I get started on this?

  • 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-15T04:56:37+00:00Added an answer on May 15, 2026 at 4:56 am

    Save yourself the pain and just use a value convertor and even that is going to be a little tricky, since you are going to have to apply a rendertransform or something to react to your enums.

    You also could write your own panel which is probably a better idea.

    You have a few different problems here to confront, creating the attached property, validating the enum, having the enum do what you want it to do when it is set.

    Your also going to have to learn about MeasureOverride and ArrangeOverride

    If you just can’t help yourself … Look Here

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

Sidebar

Related Questions

<Grid Height=333> <Canvas Margin=0,-41> <Rectangle Height=60 Width=72 Canvas.Left=73 Canvas.Top=355> <Rectangle.Fill> <ImageBrush Stretch=None ImageSource=aaa.png/> </Rectangle.Fill>
Is there a way to put a clipping path on an ImageBrush in Silverlight
I'm trying to change the background image set by xaml this way: <s:SurfaceWindow.Resources> <ImageBrush
When using DrawingContext . DrawRectangle with a TileBrush , I noticed that the top-left
I have a 3D plane which I'm trying to render with an ImageBrush as
I'm trying to customize a pushpin. For that, I'm setting an ImageBrush for the
I want to set a background image for my form/window like this guy but
how can I programmatically set the background of a button to be an image?
I have an ImageBrush and a SolidColorBrush. The thing is that I, now, want
I have 7 different ListViews. There is a Sortmethod called SortClick(object sender, RoutedEventArgs e)

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.