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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:20:42+00:00 2026-05-15T17:20:42+00:00

I have an object in my business layer (let’s call it Car for example’s

  • 0

I have an object in my business layer (let’s call it Car for example’s sake), and I have created a UserControl (CarIcon). The user control has a property that is a Car object and when the Car object is set it calls a method that configures the various properties of the user control.

Now I am rewriting it to use dependency properties so that I can use data templates and bind the backing Car object to the CarIcon user control at run time. Ideally, I want to bind the object to the user control and have the user control automatically update it’s display.

It seems like the dependency property is not being set and the app is display blank icons (because without the backing object there is no data to display). Am I binding things incorrectly?

Also Is this a reasonable approach (considering I don’t want to implement a full MVVM for a simple control)?

Binding the Car to the CarIcon in xaml

<ItemsControl Name="m_itemsControl" Focusable="false"
    pixellabs:AnimatingTilePanel.ItemHeight="100" pixellabs:AnimatingTilePanel.ItemWidth="300">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <pixellabs:AnimatingTilePanel Width="300" />
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <sample:CarIcon CurrentCar="{Binding}" />
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

Code for the dependency property

    public Car CurrentCar {
        get { return (Car)GetValue( CarProperty ); }
        set { SetValue( CarProperty, value ); }
    }

    public static readonly DependencyProperty CarProperty =
        DependencyProperty.Register( 
            "CurrentCar", 
            typeof( Car ), 
            typeof( CarIcon ), 
            new UIPropertyMetadata() );
  • 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-15T17:20:43+00:00Added an answer on May 15, 2026 at 5:20 pm

    Change the first argument to name of property (CurrentCar instead of Car). You should also provide some default value, for example null or new Car()

    public static readonly DependencyProperty CarProperty = 
            DependencyProperty.Register(  
                "CurrentCar",  
                typeof(Car),  
                typeof(CarIcon),  
                new UIPropertyMetadata(new Car())); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a business object that compiles into a DLL that handles all calculations
I have a business object project, which contains composite structure: public class Tree {
Lets say that you have a business object whose current state implies that there
I have a service object that is responsible for some business logic validation. What
I have this code: using DC = MV6DataContext; using MV6; // Business Logic Layer
I want to write a business object layer in a way that makes each
I have a Data layer and Business layer in my App. In data layer
I've got a system where all changes to business objects have to be audited.
I have a question regarding the integration of business objects developed using Linq To
I have the following sort descriptors that sort an array of my business objects,

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.