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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:46:39+00:00 2026-06-03T10:46:39+00:00

I have the following code: XAML: <UserControl x:Class=RBSoft.WPF.RedConsoleViewer xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:d=http://schemas.microsoft.com/expression/blend/2008 mc:Ignorable=d d:DesignHeight=355

  • 0

I have the following code:
XAML:

<UserControl x:Class="RBSoft.WPF.RedConsoleViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="355" d:DesignWidth="691" Name="ConsoleUI_Control" KeyDown="ConsoleUI_Control_KeyDown">
    <Grid Name="_Layout">
        <Rectangle Name="BackgroundLayout">
            <!--...-->
        </Rectangle>
    </Grid>
</UserControl>

Code:

public Rectangle IBackground
{
    get { return this.BackgroundLayout; }
    set { this.BackgroundLayout = value; }
}

What I’m tying to do is edit the rectangle (BackgroundLayout) from the XAML editor like so:

<Window x:Class="LifeEnvironment.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="1064" Width="910"
        xmlns:my="clr-namespace:RBSoft.WPF;assembly=RBSoft.WPF"
        WindowStyle="None"
        WindowState="Maximized"
        WindowStartupLocation="CenterScreen">
    <Grid>
        <my:userControlTest>
            <my:userControlTest.IBackground>
                <Background ...>
            </my:userControlTest.IBackground>
        </my:userControlTest>
    </Grid>
</Window>

But I have no access to this, what I need to do?

  • 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-03T10:46:45+00:00Added an answer on June 3, 2026 at 10:46 am

    The correct way to do it, is by wrapping up the Rectangle with an User Control, like this:

    <UserControl x:Class="RBSoft.WPF.RedConsoleViewer" ...>
        <Grid Name="_Layout">
            <UserControl Name="BackgroundLayout">
                <Rectangle .../>
            </UserControl>
        </Grid>
    </UserControl>
    

    and then, change the Content property instead the object itself, so you don’t lose the reference(BackgroundLayout):

    public Rectangle IBackground
    {
        get { return (Rectangle)this.BackgroundLayout.Content; }
        set { this.BackgroundLayout.Content = value; }
    }
    

    and finally, it will work:

    <my:userControlTest>
        <my:userControlTest.IBackground>
            <Background ...>
        </my:userControlTest.IBackground>
    </my:userControlTest>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: <Window x:Class=kkk.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <Window.Resources> <Style
I have the following XAML: <UserControl x:Class=WpfWindow.MyControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:d=http://schemas.microsoft.com/expression/blend/2008 mc:Ignorable=d d:DesignHeight=300 d:DesignWidth=300>
I have the following code: XAML: <Window x:Class=ContextMenuIssue.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <Grid>
I have a user control as follows: <UserControl x:Class=CaseDatabase.Controls.SearchResultControl 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
I have made the following sample user control: <UserControl x:Class=DLSAdministration.Controls.CombinedTextBoxControl 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
I am NEW to WPF. I have the following XAML code: </Window> ... <Canvas>
The following code-behind binding works for the SmartFormView user control: View: <UserControl x:Class=CodeGenerator.Views.PageItemManageSettingsView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
I have the following XAML code: <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar IsVisible=True IsMenuEnabled=False x:Name=PageBar> <shell:ApplicationBarIconButton IconUri=/Assets/Icons/appbar.questionmark.rest.png Text=Help
I have the following XAML code : <Image Source="a.jpg" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform"/> and I,
Currently, I have the following XAML code which is able to achieve the following

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.