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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:58:33+00:00 2026-05-22T20:58:33+00:00

<UserControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:toolkit=http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit xmlns:System_Windows_Controls_Primitives=clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Toolkit x:Class=SilverlightApplication5.MainPage Width=640 Height=480> <StackPanel x:Name=LayoutRoot Background=White> <TextBox x:Name=tbWidth TextWrapping=Wrap

  • 0
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Toolkit"
    x:Class="SilverlightApplication5.MainPage"
    Width="640" Height="480">
    <StackPanel x:Name="LayoutRoot" Background="White">
        <TextBox x:Name="tbWidth" TextWrapping="Wrap" 
           Text="{Binding Mode=TwoWay, ValidatesOnExceptions=True, Path=RoomWidth}"/>
        </StackPanel>
</UserControl>

RoomWidth – is property.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplication5
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
        private int roomWidth = 10;
        public int RoomWidth
        {
            get { return roomWidth; }
            set
            {
                if (value < 0 || value > 100)
                {
                    throw new Exception("Data not correct");
                }
                roomWidth = value;
            }
        }

    }
}

I need add to Binding source this class. How do 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-22T20:58:34+00:00Added an answer on May 22, 2026 at 8:58 pm

    Use the ElementName for example:

    <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Toolkit"
        x:Class="SilverlightApplication5.MainPage"
        Width="640" Height="480"
        Name="control">
    
        <!-- ... -->
        <TextBox Text="{Binding ElementName=control, Mode=TwoWay, ValidatesOnExceptions=True, Path=RoomWidth}" x:Name="tbWidth" TextWrapping="Wrap"/>
    

    If you have problems with basic bindings like that you sould read up on it. (WPF/Silverlight)

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

Sidebar

Related Questions

<UserControl 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 xmlns:myapp=clr-namespace:MyPlayer.Model mc:Ignorable=d x:Class=MyPlayer.VolumeButtons x:Name=UserControl d:DesignWidth=640 d:DesignHeight=480> <UserControl.Resources> <myapp:MusicPlayerModel x:Key=Model/>
Here is the current code I am using: <UserControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=ButtonPrototype.MainPage Width=640 Height=480>
<UserControl x:Class=SLGridImage.MainPage 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 d:DesignHeight=300 d:DesignWidth=400 xmlns:sdk=http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk> <UserControl.Resources> <local:LevelToVisibilityConverter x:Key=LevelToVisibility />
I' written this UserControl: <my:MyUserControl x:Class=MyClass xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:my=clr-namespace:MyNameSpace.MyControls;assembly=MyAssembly> </my:MyUserControl> public partial class Editor
This is my xaml file. <UserControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=SilverlightApplication1.Page Width=640 Height=480 xmlns:d=http://schemas.microsoft.com/expression/blend/2008 xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 mc:Ignorable=d
I have <Window x:Class=Repo.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:Repo=clr-namespace:Repo Title=Window1 Height=300 Width=300> <Grid> <Button Click=SaVeEverythingInDatabase></Button> <Repo:UserControlTasks/>
<UserControl x:Class=JIMS.View.Settings.Settings xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Name=SettingsWindow> <Border Style={StaticResource WindowBorderStyle} Height=100> <StackPanel Orientation=Vertical> <my:TitleBar Title=settings/> <StackPanel
I have this simplified version of my app in XAML: <UserControl 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
<UserControl x:Class=WpfApplication2.ProgressBar 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> <Grid> <ProgressBar Minimum=0 Maximum=1 Value=0.5
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>

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.