asteele Posted October 19, 2012 Report Share Posted October 19, 2012 Is databinding supported for the properties of a chart. For example I have a chart control right now where I am trying to bind and modify the axis settings through a view model but after the modification nothing happens to the chart? Quote Link to comment Share on other sites More sharing options...
JuanC Posted October 19, 2012 Report Share Posted October 19, 2012 DataBinding is supported on some but not all of the properties of the chart. The reason for this is that for a property to support binding it has to be a DependencyProperty which has a performance/memory/implementation cost. Unfortunately I don't think we have a list of which properties are DPs but in each class, if you see a static property with the same name as the property + "Property" it will mean it is a DP, e.g. ChartFX.WPF.Chart.GalleryProperty implies Gallery is a DP of the Chart class. Most axis properties are in fact DPs if you are having problems, please try to create a simplified sample where the you can show the unexpected behavior and post the sample. This will allow us to fix any issues or point out alternatives. Note that most collections are not DPs, e.g. the ConditionalAttributes collection of the Chart class is not a DP, this is similar to most WPF built-in controls, for example the ColumnDefinitions property of the Grid class is not a DP. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
asteele Posted October 19, 2012 Author Report Share Posted October 19, 2012 AxisX ="{Binding Path=AxisXControl}" AxisY="{Binding Path=AxisYControl}" is the binding I tried. Then ahveing properties in the viewmodel of: ChartFX.WPF.Axis AxisXControl { get; set; } ChartFX.WPF.Axis AxisYControl { get; set; } and finally trying to set them as so: AxisXControl.Max = Convert.ToDouble(GraphViewModel.Xmax); AxisXControl.Min = Convert.ToDouble(GraphViewModel.Xmin); AxisYControl.Max = Convert.ToDouble(GraphViewModel.Ymax); AxisYControl.Min = Convert.ToDouble(GraphViewModel.Ymin); Afterwhich nothing happens to the min and max of the X and Y axes on the graph. Quote Link to comment Share on other sites More sharing options...
JuanC Posted October 19, 2012 Report Share Posted October 19, 2012 Even though AxisX and AxisY are DPs (and we will check if the bindings you wrote are working as expected), I would recommend you consider binding against the particular properties of Axis that you care about (e.g. Min and Max) JuanC Quote Link to comment Share on other sites More sharing options...
asteele Posted October 22, 2012 Author Report Share Posted October 22, 2012 I looked into attempting to bind to the Max and Min fo the axes but I cant seem to find a way in XAML to expose those properies for binding properly? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.