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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:21:51+00:00 2026-06-13T12:21:51+00:00

I am using the Caliburn.Micro framework for building my application. I am trying to

  • 0

I am using the Caliburn.Micro framework for building my application. I am trying to create a custom chart control derived from the WPF toolkit chart, which needs to have 2 custom dependency properties added to it.

For some reason, Caliburn.Micro is not binding correctly to the DP’s that I created, but is working fine for existing ones. Is there something that I need to do for CM to recognize these additional properties?

(In my example, the binding Title="{Binding ChartSeriesType}" works correctly. The ChartData and ChartType are not being updated.)

SampleChart.xaml.cs

public partial class SampleChart : Chart
{
    public ChartSeriesType ChartType
    {
        get { return (ChartSeriesType)GetValue(ChartTypeProperty); }
        set
        {
            SetValue(ChartTypeProperty, value);
            dataChaged();
        }
    }

    // Using a DependencyProperty as the backing store for ChartType.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty ChartTypeProperty =
        DependencyProperty.Register("ChartType", typeof(ChartSeriesType), typeof(SampleChart), new UIPropertyMetadata(null));


    public AgilityTableBase ChartData
    {
        get { return (AgilityTableBase)GetValue(ChartDataProperty); }
        set
        {
            SetValue(ChartDataProperty, value);
            dataChaged();
        }
    }

    // Using a DependencyProperty as the backing store for ChartData.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty ChartDataProperty =
        DependencyProperty.Register("ChartData", typeof(AgilityTableBase), typeof(SampleChart), new UIPropertyMetadata(null));

    private void dataChaged()
    {
        Console.WriteLine("data changed");
    } 
}

SampleChartView.xaml:

<UserControl x:Class="Agility.Presentation.ReportViewing.SampleChartView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.caliburnproject.org"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:Agility.Presentation.ReportViewing"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="300"
         d:DesignWidth="300" mc:Ignorable="d">
<local:SampleChart Title="{Binding ChartSeriesType}" ChartData="{Binding ReportTable}" ChartType="{Binding ChartSeriesType}" />

SampleChartViewModel.cs:

public class SampleChartViewModel : PropertyChangedBase
{
    private ChartSeriesType _chartType;
    private SampleTableBase _reportTable;

    public SampleChartViewModel(SampleTableBase reportTable)
    {
        _reportTable = reportTable;
    }

    public SampleTableBase ReportTable
    {
        get { return _reportTable; }
        set
        {
            _reportTable = value;
            this.NotifyOfPropertyChange(() => ReportTable);
        }
    }

    public ChartSeriesType ChartSeriesType
    {
        get { return _chartType; }
        set
        {
            _chartType = value;
            this.NotifyOfPropertyChange(() => ChartSeriesType);
        }
    }
}

EDIT

The correct way to register the ChartType DependencyProperty is:

// Using a DependencyProperty as the backing store for ChartType.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty ChartTypeProperty =
        DependencyProperty.Register("ChartType", typeof(ChartSeriesType), typeof(AgilityChart), new UIPropertyMetadata(ChartSeriesType.Bar
            , new PropertyChangedCallback(dataChanged)));

    private static void dataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        Console.WriteLine("data changed");
    } 

Now, the dataChanged() method is being called.

  • 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-13T12:21:52+00:00Added an answer on June 13, 2026 at 12:21 pm

    One mistake I see in your code is that you add dataChaged() call to your property setter. This setter is only a convenience for you. It wont be called by binding. To react to dependency property change set callback delegate in UIPropertyMetadata that you pass while registering dp.

    Moreover first argument of UIPropertyMetadata constructor is default value of property and ChartSeriesType looks like an enum so null in not appropriate default.

    Next thing is that the dp owner type is set to AgilityChart and should be SampleChart, because that is your class name.

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

Sidebar

Related Questions

I'm learning about using Caliburn.Micro as a MVVM framework for a WPF application. In
I am using Caliburn Micro with WPF. I want to create an application with
I have a wpf application using Caliburn.Micro. I need to bind a ListBox to
I have a wpf application using caliburn.micro. It has a datagrid and a combobox.
I'm using Caliburn and the MVVM pattern in a WPF application, and am trying
I have an .NET 4.0 application using Caliburn.Micro. I want to create a dynamic
I started using ComponentOne's C1FlexGrid for my WPF Caliburn.Micro application. I wonder how I
I have a WPF application using Caliburn.Micro. A DataGrid is bound to a collection
I'm trying to learn using Caliburn.Micro with WPF. How can I add multiple views
I'm wanting to start a WPF application using caliburn.micro so I can use TDD

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.