View Issue Details

IDProjectCategoryView StatusLast Update
0001552NoesisGUIC# SDKpublic2020-07-16 11:50
ReporterlupodAssigned Tosfernandez 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.2.3 
Target Version3.0.4Fixed in Version3.0.4 
Summary0001552: Sharing column or row sizes between grids with BaseDefinition.ShareSizeGroup does not work.
DescriptionColumns (or rows) in different grids can sync their sizes using the ShareSizeGroup attribute. This requires the Grid.IsSharedSizeScope property on any ancestor to be set to true.
An example where this is useful (and actually quite critical) is displaying items with multiple columns in an ItemsControl. This could be a list of key value pairs where we want all the values aligned in a common column. We cannot use one common grid for all items because the templates for the ItemsPanel and the Items itself are defined separately.

The ShareSizeGroup attribute has no effect and the official example, which works in Blend, does not work in Noesis (see below).

The feature is described in this article from the .NET docs: https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-share-sizing-properties-between-grids
Steps To ReproduceTry the example from the .NET docs, it does not work: (https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/how-to-share-sizing-properties-between-grids)

Here is a simplified version of the code sample from the link above, but with the (in Noesis unsupported) Grid.ShowGridLines removed. And I removed the toggling logic.
This code does work flawlessly in Blend (design and runtime) but the same code does not work in Noesis for Unity.

Expected Result: The columns and row of the right grid should be resized to the corresponding sizes in the left grid.
Actual Result: No size sharing is happening when running in unity.

    <DockPanel Name="dp1" Grid.IsSharedSizeScope="True" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10">

        <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">

            <Grid Margin="0,0,10,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition SharedSizeGroup="FirstColumn"/>
                    <ColumnDefinition SharedSizeGroup="SecondColumn"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" SharedSizeGroup="FirstRow"/>
                </Grid.RowDefinitions>

                <Rectangle Fill="Silver" Grid.Column="0" Grid.Row="0" Width="200" Height="100"/>
                <Rectangle Fill="Blue" Grid.Column="1" Grid.Row="0" Width="150" Height="100"/>

                <TextBlock Grid.Column="0" Grid.Row="0" FontWeight="Bold">First Column</TextBlock>
                <TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">Second Column</TextBlock>
            </Grid>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition SharedSizeGroup="FirstColumn"/>
                    <ColumnDefinition SharedSizeGroup="SecondColumn"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" SharedSizeGroup="FirstRow"/>
                </Grid.RowDefinitions>

                <Rectangle Fill="Silver" Grid.Column="0" Grid.Row="0"/>
                <Rectangle Fill="Blue" Grid.Column="1" Grid.Row="0"/>

                <TextBlock Grid.Column="0" Grid.Row="0" FontWeight="Bold">First Column</TextBlock>
                <TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">Second Column</TextBlock>
            </Grid>

        </StackPanel>
        
    </DockPanel>
TagsC#, Unity, xaml
PlatformWindows

Activities

lupod

lupod

2019-09-09 14:16

reporter  

expected.png (3,379 bytes)
expected.png (3,379 bytes)
actual.png (3,603 bytes)
actual.png (3,603 bytes)
jsantos

jsantos

2019-09-09 20:49

manager   ~0005957

Thanks for the awesome report!
ai_enabled

ai_enabled

2020-06-15 10:18

updater   ~0006439

@jsantos, hello! I wonder if you can consider including this in 3.0.3?
sfernandez

sfernandez

2020-06-18 13:12

manager   ~0006443

Ok, we will study this feature and see if we can include it in the next version.
ai_enabled

ai_enabled

2020-07-14 05:45

updater   ~0006537

I've implemented a hacky version of this feature with the attached property. It's a nightmare ha-ha! :-) I wish to see a proper support of this feature in NoesisGUI but now I know how much pain it is to do something like this. :-)

By the way, I've attached a screenshot to demonstrate where this feature is useful in our case. All the columns are properly aligned but in fact, this is a composition of several independent grids. Different weapons have different sets of stats that are defined in different XAML files with a ton of visibility binding and conditions...

Regards!

Screenshot at 07-41-02.png (869,286 bytes)
sfernandez

sfernandez

2020-07-16 11:50

manager   ~0006538

We didn't have time to include it in 3.0.3 but it is finally finished for our next release.

Issue History

Date Modified Username Field Change
2019-09-09 14:16 lupod New Issue
2019-09-09 14:16 lupod Tag Attached: C#
2019-09-09 14:16 lupod Tag Attached: Unity
2019-09-09 14:16 lupod Tag Attached: xaml
2019-09-09 14:16 lupod File Added: expected.png
2019-09-09 14:16 lupod File Added: actual.png
2019-09-09 14:17 lupod Steps to Reproduce Updated View Revisions
2019-09-09 14:23 lupod Description Updated View Revisions
2019-09-09 14:23 lupod Steps to Reproduce Updated View Revisions
2019-09-09 14:26 lupod Category Unity3D => C# SDK
2019-09-09 20:49 jsantos Note Added: 0005957
2019-09-10 03:12 sfernandez Assigned To => sfernandez
2019-09-10 03:12 sfernandez Status new => assigned
2019-09-10 03:12 sfernandez Target Version => 2.3.0
2020-06-15 10:18 ai_enabled Note Added: 0006439
2020-06-18 13:12 sfernandez Note Added: 0006443
2020-06-18 13:12 sfernandez Target Version => 3.0.3
2020-07-13 13:32 jsantos Target Version 3.0.3 => 3.0.4
2020-07-14 05:45 ai_enabled File Added: Screenshot at 07-41-02.png
2020-07-14 05:45 ai_enabled Note Added: 0006537
2020-07-16 11:50 sfernandez Status assigned => resolved
2020-07-16 11:50 sfernandez Resolution open => fixed
2020-07-16 11:50 sfernandez Fixed in Version => 3.0.4
2020-07-16 11:50 sfernandez Note Added: 0006538