locked
Which is MaximumRowsOrColumns in VariableSizedWrapGrid ?

    Question

  • I use:

    public class VariableGridView : GridView
        {
            protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
            {
                var viewModel = item as IResizable;
                element.SetValue(VariableSizedWrapGrid.ColumnSpanProperty, viewModel.Width);
                element.SetValue(VariableSizedWrapGrid.RowSpanProperty, viewModel.Height);
                base.PrepareContainerForItemOverride(element, item);
            }
        }
      public class SizeOffer
        {
            public static int GREAT_Width = 4;

            public static int GREAT_Height = 2;

            public static int MEDIUM_Width = 2;

            public static int MEDIUM_Height = 3;

            public static int SMALL_Width = 2;

            public static int SMALL_Height = 2;

    }

    42 items. 7 Great, 16 Medium, 18 Small.

    Not all display correctly

    <Grid Margin="0,0,0.167,0" Background="#FFE2E2E2">
                                <Controls:VariableGridView x:Name="GridOfertas" ItemsSource="{Binding ListaOfertas, Source={StaticResource ViewModel}}"   Tapped="GridOfertas_Tapped" HorizontalContentAlignment="Left" Margin="0,0,0,0" >
                                    <Controls:VariableGridView.ItemTemplate>
                                        <DataTemplate>
                                            <Grid Margin="3" Background="WhiteSmoke" VariableSizedWrapGrid.RowSpan="{Binding Width}" VariableSizedWrapGrid.ColumnSpan="{Binding Height}" HorizontalAlignment="Left">
                                                <Image Source="{Binding value.ImagenGrid__c, FallbackValue=ms-appx:///Assets/no-image.png, TargetNullValue=ms-appx:///Assets/no-image.png}" Stretch="Fill"/>
                                                <Grid x:Name="gridFooter" Margin="0" Background="#FF272727" Opacity="0.7" Height="40" VerticalAlignment="Bottom">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition/>
                                                        <ColumnDefinition Width="74.833"/>
                                                    </Grid.ColumnDefinitions>
                                                    <TextBlock x:Name="tbTitleOferta" Text="{Binding value.Name}" RenderTransformOrigin="0.492,0.522" TextWrapping="Wrap" FontSize="14.667" Margin="2,1,5,1" MinWidth="50" MaxLines="2" />
                                                    <Grid Width="75" HorizontalAlignment="Right" Grid.Column="1" MinWidth="50" Margin="0,0,-0.167,0">
                                                        <Image x:Name="imagenOferta" Margin="0,19,46,-3" HorizontalAlignment="Right" Width="24" Source="{Binding iconType}" Stretch="UniformToFill" Height="24"/>
                                                        <TextBlock x:Name="tbDuracion" Text="{Binding value.HorasRestantes}" HorizontalAlignment="Right" Width="27" TextAlignment="Center" FontSize="13.333" Margin="0,0,3,2" Foreground="white" Height="16" VerticalAlignment="Bottom"/>
                                                        <Image x:Name="ImagenReloj" Margin="0,19,27,-3" HorizontalAlignment="Right" Width="24" Source="ms-appx:///Assets/Iconos/ic_clockwhite.png" Stretch="Fill" Height="24"/>
                                                    </Grid>
                                                </Grid>
                                            </Grid>
                                        </DataTemplate>
                                    </Controls:VariableGridView.ItemTemplate>
                                    <Controls:VariableGridView.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <VariableSizedWrapGrid
    ItemHeight="{Binding ItemHeight, Source={StaticResource ViewModel}}"
    ItemWidth="{Binding ItemWidth, Source={StaticResource ViewModel}}" MaximumRowsOrColumns="{Binding MaximumRowsOrColumns, Source={StaticResource ViewModel}}"/>
                                            <!--{Binding MaximumRowsOrColumns, Source={StaticResource ViewModel}} -->
                                        </ItemsPanelTemplate>
                                    </Controls:VariableGridView.ItemsPanel>
                                </Controls:VariableGridView>
                                <Grid x:Name="GridFilter" Background="#FF232323" Opacity="0.9" Visibility="Collapsed">
                                    <ListView x:Name="listViewFilter" Margin="0,176,0,0" ItemsSource="{Binding Catergorias, Source={StaticResource ViewModel},Mode=TwoWay}" Foreground="Black" Background="White"  HorizontalContentAlignment="Stretch" >
                                        <ListView.ItemTemplate>
                                            <DataTemplate>
                                                <Grid Height="41" HorizontalAlignment="Stretch" Width="360">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="43*"/>
                                                        <ColumnDefinition Width="280*"/>
                                                        <ColumnDefinition Width="40*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Image Margin="-2,0,1.5,0" Source="{Binding Icon}"/>
                                                    <TextBlock TextWrapping="Wrap" Text="{Binding Name}" FontSize="18.667" Margin="3.5,6,9.833,9" Grid.Column="1" Foreground="#FF595959"/>
                                                    <CheckBox Width="33" HorizontalAlignment="Right"  MinWidth="0" Grid.Column="2" Margin="0,-9,0,-7" Height="57" BorderThickness="2" Foreground="#FF5F5F5F" BorderBrush="#FF646464" IsChecked="{Binding IsSelected,Mode=TwoWay}" Tag="{Binding Id}" Style="{StaticResource CheckBoxStyleRedondo}"  />
                                                </Grid>
                                            </DataTemplate>
                                        </ListView.ItemTemplate>
                                    </ListView>
                                    <ComboBox x:Name="cbProvincias"  VerticalAlignment="Top" Margin="0,101,0,0" ItemsSource="{Binding Provincias.records, Source={StaticResource ViewModel}}" DisplayMemberPath="{Binding Name}" PlaceholderText="Selecciona una provincia" Style="{StaticResource ComboBoxStyleProvinicia}" Background="White" SelectedItem="{Binding ProvinciaSeleted, Mode=TwoWay, Source={StaticResource ViewModel}}" Header="Provincia">
                                        <ComboBox.ItemTemplate>
                                            <DataTemplate>
                                                <!--<RadioButton Content="{Binding Name}" IsChecked="{Binding IsSelected}"></RadioButton>-->
                                                <TextBlock Text="{Binding Name}"/>
                                            </DataTemplate>
                                        </ComboBox.ItemTemplate>
                                    </ComboBox>
                                </Grid>
                            </Grid>

    Wednesday, January 21, 2015 3:40 PM

Answers

All replies

  • Solved. Problem was RowSpan.

    Wednesday, January 21, 2015 4:33 PM
  • Thanks for sharing :)

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 22, 2015 2:07 AM
    Moderator