Hello,
I am trying to achieve the behaviour in which each CarouselListBoxItem occupies 95% of the visible area. We have the ViewSettings in which we have set ItemsPerPage as 1. In order to achieve the 95% occupancy we have put a behaviour in place which gets executed on the Carousel SizeChanged event which eventually sets the ItemSize property of the ViewSettings to 95% of actual size.
Carousel.ViewSettings.ItemSize = new Size(Carousel.ActualWidth * Percentage, Carousel.ActualHeight * Percentage);
When running the attached sample, we are not able to achieve this behaviour. Could you please let us know why is that so and any alternative of achieving this.
(See attachment for sample)
Thanks.
Hello Himmat and thank you for posting!
I have been looking into it and currently having the items displayed in a part of the available space would be possible by setting the CarouselViewSettigns.ScalingEffectStops collection rather than having it calculated using the actual size: <igWindows:CarouselViewSettings.ScalingEffectStops> <igWindows:ScalingEffectStop Offset=".5" Value="3" /> </igWindows:CarouselViewSettings.ScalingEffectStops>Here is an example of the same with the currently supported approach: http://www.infragistics.com/help/wpf/infragisticswpf4.v15.1~infragistics.windows.controls.carouselviewsettings~usescaling.html
Thanks Maria for the response.
I tried to do changes as suggested, i.e. removed the behavior that sets the itemSize and instead used the ScalingEffect. Couple of problems with the solution - 1. Tried various values but cannot achieve the 95% occupied area requirement, additionally the item is getting truncated on the left 2. Scaling does not appear to be autoscale with the container being resized.
I have modified the solution and attached back with the changes.
Hi Himmat,
The location of the items on the path could be controlled by modifying the ItemPathPrefixPercent and ItemPathSuffixPercent properties to modify the position of the item to the start/end of the path. By default the size of the items is not changed when the container they are placed in are resized. You can try to setting the size of the items when the windows is resized to control this behavior.
Hello Maria,
I have created a behaviour that hooks onto XamCarouselListBox sizeChanged event and then resizes the ItemSize dynamically
This works fine as long as I dont dock the ContentPanel. When I dock the panel, then the resize event does not get fired.
Please see the attached sample explaining the problem. You may just resize the window and see that the Item does resize, but when you dock the panel, the resize is not called.
thanks for the response.
Hi,
I have been looking into this and it seems that unhandling the SizeChanged event in the behavior is preventing it from firing when the docked pane is being resized. To verify this I have used MS DockPanel and a button and the result was the same so would suggest you to try to use LayoutUpdated event instead. It is fired multiple times and will allow you to set the size of the item that you would like.
Hi Maria,
Any idea why the Carousel Unloaded event is getting fired when we are trying to move the window from undocked into docked state. If we cannot use the Unloaded event to unhook the handlers, any idea what could be used instead, as we would need to unsubscribe the events in any case to avoid leaks. Using the LayoutUpdated event also has similar problems if we unsubscribe from it in the Unloaded eventhandler.
Appreciate your help in this regards. Thanks.
Himmat,
It seems that unhandling the SizeChanged event when the item is docked in this scenario will prevent the event from firing the next time the size is changed. You may want to have a look at the following forum thread and use the windows closing event for detaching: http://stackoverflow.com/questions/30638292/ondetaching-function-of-behavior-is-not-called.