tags:

views:

65

answers:

1

I have FrameworkElement, for example Grid, that has children(Cells, implemented in another control). When main Window changes size, i handle sizeChanged in Grid at first, and after that in some of its children. How can i get notify that all children sizeChanged events finished processing? Of course, i can raise other event in child sizeChanged and increase some counter, but for some reasons it is not the best decision.

Can anyone recommend something? Thanks!

A: 

I think you are looking for the UIElement.LayoutUpdated Event. It fires whenever the layout gets updated which is a lot, so I would suggest subscribing to it in a handler for the containers SizeChanged event and unsubscribe in the LayoutUpdated handler.

Example:

    private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
    {
        // Size change started.
        LayoutUpdated += Window_LayoutUpdated;
    }

    private void Window_LayoutUpdated(object sender, EventArgs e)
    {
        // Size change completed.
        LayoutUpdated -= Window_LayoutUpdated;
    }
omdsmr
Looks like it works the way i need. Big thanks!The sense of my question was to set same font sizes(based on cell sizes) in different groups of cells in all tables(grids) in window.