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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:31:31+00:00 2026-06-04T20:31:31+00:00

Current in code-behind, I dynamically create a WPF Image control and bind the source

  • 0

Current in code-behind, I dynamically create a WPF Image control and bind the source to a custom databinding. This will eventually be added to a grid to provide a background image:

Image myImage = new Image();
myImage.Stretch = Stretch.UniformToFill;
myImage.SetBinding(Image.SourceProperty, myBinding);

The problem is that I want to tile this image, so the only way I can find to do this is to create an ImageBrush and set the TileMode property. But there is no “SetBinding” function, so how can I accomplish what I need?

ImageBrush myBrush = new ImageBrush();
myBrush.TileMode = TileMode.Tile;
// Can't do this!
myBrush.SetBinding(ImageBrush.SourceImageProperty, myBinding);

Are there any other ways to tile an image like this in code-behind?

  • 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-06-04T20:31:32+00:00Added an answer on June 4, 2026 at 8:31 pm

    You need not to change anything but use the BindingOperations:

    BindingOperations.SetBinding(myBrush, ImageBrush.ImageSourceProperty, myBinding);
    

    And you need to define the Viewport and the fill the viewport with brush:

    MyBrush.Viewport = new Rect(0, 0, 0.1, 0.1);
    // Create a rectangle and paint it with the ImageBrush.
    Rectangle rec = new Rectangle();
    rec.Stroke = Brushes.LimeGreen;
    rec.StrokeThickness = 1;
    rec.Fill = MyBrush;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a Dynamic aspx Page in current solution through code-behind..forexample i
My current situation: I have a user control A.ascx with code behind A.ascx.cs and
Basically I want to create a user control in code behind, DataBind() it and
Possible Duplicate: Get URL of ASP.Net Page in code-behind I'm trying to hold current
My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('alex@example.com.au' => 'Alex')) ->setTo(array('alex@example.com.au' =>
This is my current code in order for each of my $('#fbNameS1').tipsy({fade: true}); $('#fbNameS2').tipsy({fade:
This is what my current code looks like: HTML: <a class=button href=#>Read More</a> CSS:
This is the current code im using for the encrypting and decrypting process also
This is my current code of the class Score in the Score.h file:- class
what my current Code do : i have this HTML <li> <span>Logged in as</span>&nbsp;

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.