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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:36:47+00:00 2026-05-26T18:36:47+00:00

I have defined a dependency propery as follows: public static readonly DependencyProperty AnimateColumnWidthProperty =

  • 0

I have defined a dependency propery as follows:

public static readonly DependencyProperty AnimateColumnWidthProperty =
    DependencyProperty.Register("AnimateColumnWidthProperty", typeof(double), typeof(MainWindow), new PropertyMetadata(0.0));

public double AnimateColumnWidth
{
    get { return (double)GetValue(AnimateColumnWidthProperty); }
    set { SetValue(AnimateColumnWidthProperty, value); }
}

When my application starts I do this….

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    AnimateColumnWidth = Properties.Settings.Default.ProductInfoWidthExpanded;
}

… which should initialise the value to its starting value – in this case 400.

I have then bound a column of a grid in my UI to this property…

<ColumnDefinition 
    Name="ProductInfo" 
    Width="{Binding Path=AnimateColumnWidth,
                    Converter={StaticResource doubleToGridLength},
                    Mode=TwoWay}" />

As I understand it, as the column width is bound to this property, whenever I update the property the column width should also update.

What am I doing wrong as the width does not update when I change the property? I am also trying to update it via an animation which also doesnt work. Additionally, a breakpoint set on the getter of the AnimateColumnWidth property is never hit – meaning that nothing ever tried to retrieve the property.

(This did work so clearly I have broken something somewhere!!)

Footnote:

The value converted is defined in the root namespace of my app (I believe that WPF would complain if it couldnt find it).

[ValueConversion(typeof(Double), typeof(GridLength))]
public class DoubleToGridLength : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return new GridLength((double)value);
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return ((GridLength)value).Value;
    }
}
  • 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-26T18:36:47+00:00Added an answer on May 26, 2026 at 6:36 pm

    One thing I hadnt done was set the datacontext of the grid who’s column I wanted to affect to “this”.

    public MainWindow()
    {
        InitializeComponent();
        ProductsArea.DataContext = this;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom Dependency Property defined like so: public static readonly DependencyProperty MyDependencyProperty
I have a dependency property defined in my window as below: public static readonly
I have defined a Control with: static member ItemsProperty : DependencyProperty = DependencyProperty.Register( Items,
I have an attached behavior defined thusly,.. public static class FileBrowserBehaviour { public static
I have defined a new dialog and its controls in an already existing resource
I have defined the global nls_date_format on Oracle 10.2 XE as follows: alter system
I have defined a class A and derived a new class B from A
I have DataDependentControl with dependency properties defined: TextVisibility, CalendarVisibility, ComboControlVisibility . When I select
I'm fairly new to WPF. Suppose I defined an int dependency property. The purpose
I have a rather simple user control (RatingControl) that has a dependency property defined

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.