Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
StackedFragmentSeries Title
posted

Hello,

I have a Problem with the StackedFragmentSeries. I want to bind the title to a string in the ViewModel:

<ig:StackedColumnSeries.Series>
     <ig:StackedFragmentSeries ValueMemberPath="Values" Title="{Binding SeriesTitleValues}"/>
     <ig:StackedFragmentSeries ValueMemberPath="Errors" />
</ig:StackedColumnSeries.Series>

Unfortunatly, this does not work. It will still display "Series Title" in the legend and I get the error:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=SeriesTitleValues; DataItem=null; target element is 'StackedFragmentSeries' (HashCode=32244734); target property is 'Title' (type 'Object')

Is there a way to solve this problem? I have attached the example.

Thanks,

Michael

StackedColumnSeriesHelp.zip
Parents
No Data
Reply
  • 405
    Verified Answer
    posted

    Hello MiSu,

    I've modified the sample application that you provided and I attach it here.

    StackedFragmentSeries doesn't not inherit from FrameworkObject and that means that it doesn't have data context by default. To use binding with StackedFrameworkSeries you need to specify the data context adding Source to the Binding expression.

    I've moved MainWindowViewModel in the Resources collection of the window and adding a Key to it. Then I've added Source to all Binding expressions that refer to the data context.

    To notify the view when SeriesTitleValues is changed I've made a change in the ViewModel:

    OnPropertyChanged("SeriesTitleValue"); changed to OnPropertyChanged("SeriesTitleValues"); since the property name is SeriesTitleValues.

    You will find the changes in the attached sample and you can apply them to your application.

    Let me know if you need any further assistance.

     

    Sincerely,

    Lazar Nikolov

    Infragistics

    www.infragistics.com/support

    StackedColumnSeriesHelp.zip
Children