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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:51:39+00:00 2026-05-25T23:51:39+00:00

In my WPF UserControl I have this resource, please observe the comments in the

  • 0

In my WPF UserControl I have this resource, please observe the comments in the Xml sample.

<UserControl.Resources>
    <DataTemplate x:Key="AxisXLabelTemplate">
        <ContentPresenter Content="{Binding Path=Content}">
            <ContentPresenter.LayoutTransform>
                <RotateTransform Angle="{Binding XAxisLabelRotation, UpdateSourceTrigger=PropertyChanged}" /> <!-- This does not work -->
                <!-- <RotateTransform Angle="-90" /> This works -->
            </ContentPresenter.LayoutTransform>
        </ContentPresenter>
    </DataTemplate>
</UserControl.Resources>

In the code I have a dependency property defined as follows:

class MyChart: INotifyPropertyChanged
{
        public static readonly DependencyProperty XAxisLabelRotationProperty =
            DependencyProperty.Register("XAxisLabelRotation", typeof(RotateTransform), typeof(BarChart),
                new FrameworkPropertyMetadata((RotateTransform)new RotateTransform(-90.0)));

        public RotateTransform XAxisLabelRotation
        {
            get { return (RotateTransform)GetValue(XAxisLabelRotationProperty); }
            set { SetValue(XAxisLabelRotationProperty, value); }
        }
...
}

The AxisXLabelTemplate DataTemplate is assigned to an element farther below as follows:

<chart:AxisLabel ElementTemplate="{StaticResource AxisXLabelTemplate}"/>

The problem is that when I use the unbound value for Angle and hard-code it to -90, it works beautifully, and when I try with the bound value to XAxisLabelRotation it doesn’t.

Can anyone please help?

  • 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-25T23:51:40+00:00Added an answer on May 25, 2026 at 11:51 pm

    I recreated similar setting as you and it did not work for me either. Curiously there are no binding errors. I did relativesource binding too and it didnt work.

    Although if I bind tooltip

      <ContentPresenter ToolTip="{Binding XAxisLabelRotation, 
                                          RelativeSource={RelativeSource
                                              AncestorType={x:Type ContentControl}},
                                                 UpdateSourceTrigger=PropertyChanged}" ..>
    

    shows the tooltip to me. So I changed the rotate transform,

      <RotateTransform Angle="{Binding XAxisLabelRotation, 
                                          RelativeSource={RelativeSource
                                              AncestorType={x:Type ContentControl}},
                                                 UpdateSourceTrigger=PropertyChanged}" ..>
    

    But still the transform did not work. Still no binding errors.

    Then I introduced a dummy converter …

    public class AngleConverter : IValueConverter
    {
        public object Convert(...)
        {
            return value;
        }
        ....
    }
    
    <RotateTransform Angle="{Binding XAxisLabelRotation, 
                                     RelativeSource={RelativeSource
                                          AncestorType={x:Type ContentControl}},
                                     UpdateSourceTrigger=PropertyChanged,
                                     Converter={StaticResource AngleConverter}}" ..>
    

    and it worked miraculously!!!

    Unexplanable world of WPF???

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

Sidebar

Related Questions

I have a context menu situated inside a User Control Resource. <UserControl.Resources> <ContextMenu x:Key=Menu1>
I have a WPF UserControl with binding converters referenced like this: <UserControl x:Class=MyControl x:Name=MyControl
I have created a UserControl in WPF. This user control consists of a border,
WPF controls have certain properties (UserControl.Resources, UserControl.CommandBindings) that can have items added to them
I have this XML file: <?xml version=1.0 encoding=utf-8?> <Wpf> <wpfctrl id=NavBtnTemplate>#FFCFDEFF</wpfctrl> </Wpf> and i
I have a custom WPF Line and its style. UserControl Resources: <!-- Framework properties
I have the following XAML: <UserControl.Resources> <local:MainPageViewModel x:Key=ViewModel /> </UserControl.Resources> <Grid x:Name=LayoutRoot DataContext={Binding Source={StaticResource
I have got some custom WPF UserControl . And it has implementation like this
I have a WPF user control with a number of textboxes, this is hosted
Background: I have a WPF UserControl (MainControl - not shown in code below) that

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.