Си диез / Говнокод #8273 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
<Grid Grid.Row="2" Margin="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <ContentPresenter Grid.Row="0" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[0]}"/>
            <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[1]}"/>
            <ContentPresenter Grid.Row="0" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[2]}"/>
            <ContentPresenter Grid.Row="1" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[3]}"/>
            <ContentPresenter Grid.Row="1" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[4]}"/>
            <ContentPresenter Grid.Row="1" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[5]}"/>
            <ContentPresenter Grid.Row="2" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[6]}"/>
            <ContentPresenter Grid.Row="2" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[7]}"/>
            <ContentPresenter Grid.Row="2" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[8]}"/>
            <ContentPresenter Grid.Row="3" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[9]}"/>
            <ContentPresenter Grid.Row="3" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[10]}"/>
            <ContentPresenter Grid.Row="3" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[11]}"/>
            <ContentPresenter Grid.Row="4" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[12]}"/>
            <ContentPresenter Grid.Row="4" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[13]}"/>
            <ContentPresenter Grid.Row="4" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[14]}"/>
            <ContentPresenter Grid.Row="5" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[15]}"/>
            <ContentPresenter Grid.Row="5" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[16]}"/>
            <ContentPresenter Grid.Row="5" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[17]}"/>
            <ContentPresenter Grid.Row="6" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[18]}"/>
            <ContentPresenter Grid.Row="6" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[19]}"/>
            <ContentPresenter Grid.Row="6" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[20]}"/>            
        </Grid>

Запостил: legat legat, (Updated )

Комментарии (6) RSS

    • Ну по крайней мере.
      Сам автор исправил на следующее
      <ItemsControl Grid.Row="2" Margin="5" ItemsSource="{Binding ElementName=root,Path=Items}">
                  <ItemsControl.ItemsPanel>
                      <ItemsPanelTemplate>
                          <Grid IsItemsHost="True">
                              <Grid.ColumnDefinitions>
                                  <ColumnDefinition/>
                                  <ColumnDefinition/>
                                  <ColumnDefinition/>
                              </Grid.ColumnDefinitions>
                              <Grid.RowDefinitions>
                                  <RowDefinition Height="auto"/>
                                  <RowDefinition Height="auto"/>
                                  <RowDefinition Height="auto"/>
                                  <RowDefinition Height="auto"/>
                                  <RowDefinition Height="auto"/>
                                  <RowDefinition Height="auto"/>
                                  <RowDefinition Height="auto"/>
                              </Grid.RowDefinitions>
                          </Grid>
                      </ItemsPanelTemplate>
                  </ItemsControl.ItemsPanel>            
              </ItemsControl>

      а у итемов в коде задает позицию в гриде при изменении коллекции
      Ответить
      • Можно даже при помощи такого биндинга Grid.Row="{Binding SomeDerivedValue}"
        Grid.Column="{Binding SomeOtherDerivedValue}"
        Ответить
  • Ну если на то пошло, то в WPF есть ListView, который показать может все что душе угодно, а так извращаться это ппц. Говнецо изрядное)))

    Да и на худой конец есть UniformGrid. 😀
    Ответить
    • +1

      <ItemsControl Grid.Row="2" Margin="5" ItemsSource="{Binding ElementName=root,Path=Items}">
      <ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
      <UniformGrid Columns="3"/>
      </ItemsPanelTemplate>
      </ItemsControl.ItemsPanel>
      </ItemsControl>
      Ответить

Добавить комментарий

Из-за тебя ушел bormand, guest!

    А не использовать ли нам bbcode?


    8