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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:44:49+00:00 2026-06-05T01:44:49+00:00

My control has 5 dependency properties. I set them in XAML like this: <MyControl

  • 0

My control has 5 dependency properties. I set them in XAML like this:

<MyControl Prop1="1" Prop2="2" Prop3="3" Prop4="4" />

As you can see, I am only setting 4 of the 5 properties in XAML.

What I need to find is some mechanism to indicate that all the properties set in XAML have been processed. With this event, I can run my SetItAllUp() method.

Option 1. Use the DP setter

FAIL: Not an option because I cannot call SetItAllUp() but one time. This also has the side effect of activating based on the ordinal declaration of each DP in the XAML. If there is some type of chaining or dependency between my properties, this undermines it.

Option 2. Use the DP setter, and test all values are set

FAIL: Not an option because sometimes certain DP values are optional – let’s just pretend that the logic necessary to determine if optional values are properly set or not is too complex to implement this solution for now, please.

Option 3. Use MyControl.Loaded

FAIL: Not an option because this fires too early. In fact, every event I can see fires too early. It is almost as if the object is created and then something under the hood starts to set the DP values based on the declarations.


Update! Loaded is the solution. My question was flawed.

There’s some event or something, right?
// Thanks

  • 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-05T01:44:50+00:00Added an answer on June 5, 2026 at 1:44 am

    Loaded works fine. Sorry for the confusion.

    I tested this class:

    public class MyPath : Path
    {
        public MyPath()
        {
            Loaded += MyPath_Loaded;
        }
    
        void MyPath_Loaded(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("Loaded");
        }
        public int Test1
        {
            get { return (int)GetValue(Test1Property); }
            set
            {
                SetValue(Test1Property, value);
                System.Diagnostics.Debug.WriteLine("Test1");
            }
        }
        public static readonly DependencyProperty Test1Property =
            DependencyProperty.Register("Test1", typeof(int), typeof(MyPath),
            new PropertyMetadata(DependencyProperty.UnsetValue, null));
    
        public int Test2
        {
            get { return (int)GetValue(Test2Property); }
            set
            {
                SetValue(Test2Property, value);
                System.Diagnostics.Debug.WriteLine("Test2");
            }
        }
        public static readonly DependencyProperty Test2Property =
            DependencyProperty.Register("Test2", typeof(int), typeof(MyPath),
            new PropertyMetadata(DependencyProperty.UnsetValue, null));
    
        public int Test3
        {
            get { return (int)GetValue(Test3Property); }
            set
            {
                SetValue(Test3Property, value);
                System.Diagnostics.Debug.WriteLine("Test3");
            }
        }
        public static readonly DependencyProperty Test3Property =
            DependencyProperty.Register("Test3", typeof(int), typeof(MyPath),
            new PropertyMetadata(DependencyProperty.UnsetValue, null));
    
        public int Test4
        {
            get { return (int)GetValue(Test4Property); }
            set
            {
                SetValue(Test4Property, value);
                System.Diagnostics.Debug.WriteLine("Test4");
            }
        }
        public static readonly DependencyProperty Test4Property =
            DependencyProperty.Register("Test4", typeof(int), typeof(MyPath),
            new PropertyMetadata(DependencyProperty.UnsetValue, null));
    
        public int Test5
        {
            get { return (int)GetValue(Test5Property); }
            set
            {
                SetValue(Test5Property, value);
                System.Diagnostics.Debug.WriteLine("Test5");
            }
        }
        public static readonly DependencyProperty Test5Property =
            DependencyProperty.Register("Test5", typeof(int), typeof(MyPath),
            new PropertyMetadata(DependencyProperty.UnsetValue, null));
    }
    

    With this XAML:

    <Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
        <local:MyPath Test1="1" Test2="2" Test3="3" Test4="4" />
    </Grid>
    

    And got this Trace:

    Test1
    Test2
    Test3
    Test4
    Loaded
    

    And it turns out Loaded works just fine.
    My previous testing must have had some other factor.
    My simplified test shows Loaded seems perfect.

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

Sidebar

Related Questions

I have an user control named GraphPanel. It has two dependency properties, one custom,
I am working on a user control that has some dependency properties, namely; public
How do you handle source control setup of a non-compiled project that has dependency
I have a custom user control on my windows forms. This control has a
I am creating a Windows forms user control. This control has a textbox and
I have a wpf control named DataPicker which has a dependency property named SelectedDate.
I find that when I make Dependency Properties, most of them conflict with names
I am trying to make custom conmtrol in windows phone. My control has dependency
I created a UserControl in WPF. This user control has several text boxes that
This is the part where is not working. My dependency property has a default

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.