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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:05:10+00:00 2026-06-01T17:05:10+00:00

There in my mainwindow.xaml I’ve got the grid with: <CustomControl:GridControl ShowCustomGridLines=True Grid.Column=2 Grid.Row=0> <local:_13cap/>

  • 0

There in my mainwindow.xaml I’ve got the grid with:

<CustomControl:GridControl ShowCustomGridLines="True" Grid.Column="2" Grid.Row="0">
   <local:_13cap/>
</CustomControl:GridControl>

Where 13cap is my custom control:

<UserControl x:Class="TTTP._13cap"
             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" 
             xmlns:CustomControl="clr-namespace:WpfApplication1.CustomControl"
             mc:Ignorable="d">
        <CustomControl:GridControl ShowCustomGridLines="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="ВСЕГО" />
            <CustomControl:GridControl ShowCustomGridLines="True" Grid.Column="2" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="0" Grid.Row="1" Text="П" HorizontalAlignment="Center" VerticalAlignment="Center" />
                <TextBlock Grid.Column="1" Grid.Row="1" Text="Ф" HorizontalAlignment="Center" VerticalAlignment="Center" />
                <TextBlock Grid.Column="2" Grid.Row="1" Text="%" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </CustomControl:GridControl>
        </CustomControl:GridControl>
</UserControl>

But I want to call it with only one different text parameter ( Text=”ВСЕГО” ) alike I want to call <local:_13cap MyText="CustomText"/> to override “ВСЕГО”. How can I create UserControl with such parameter in it?

  • 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-01T17:05:12+00:00Added an answer on June 1, 2026 at 5:05 pm

    Implement a DependancyProperty that you can change from code-behind and bind to in XAML.


    Code behind:

    public class MyUserControl : UserControl, INotifyPropertyChanged
    {
        //INotifyPropertyChanged implementation
        public event PropertyChangedEventHandler PropertyChanged; 
        protected void OnPropertyChanged(string propertyName) 
        { 
            if (PropertyChanged != null) 
            { 
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 
            } 
        } 
    
        //The XAML binding uses this
        public static readonly DependencyProperty CaptionProperty = 
             DependencyProperty.Register("Caption", typeof(string), typeof(MyUserControl), 
             new PropertyMetadata(string.Empty, OnCaptionPropertyChanged));
    
        //Your code-behind uses this
        public string Caption 
        {  
            get { return GetValue(CaptionProperty).ToString(); }  
            set 
            {
                SetValue(CaptionProperty, value);
                OnPropertyChanged("Caption");
            } 
        }
    

    Xaml:

    <UserControl (...)>
        <Grid>
            <Label x:Name="labCaption" Content="{Binding Caption}"/>
        </Grid>
    </UserControl>
    

    There are lots of other questions here about this and lots of good articles and tutorial on google that explain it all better then I could.

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

Sidebar

Related Questions

There is solution with two projects: WPFProject and WPFResources . WPFProject has MainWindow.xaml. WPFResources
In my MainWindow.xaml, I have added my UserControl to the Window. There is also
I'm creating a webservice client. And I have the problem - in MainWindow.xaml there
My main MainWindow.xaml.cs has a lot of Task variables and as a consequence a
My app's main UI is in MainWindow.xaml. Firstly - what is causing this to
I'm exploring WPF and XAML for the first time, and there's a lot I
I'm trying to implement a login window, in WPF. I have a MainWindow.xaml: <Window
i have this code: <Window x:Class=WpfApplication8.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> <ScrollViewer Background=#FFADB9CD
Currently, I have this in MainWindow.xaml: <Image Name=LogoImage /> And this in MainWindow.xaml.cs: public
I have a text editor like program which is a QMainWindow inherited class. There,

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.