0
그래서 각 항목 위로 마우스를 가져 가면 강조 표시된 GridView를 만들려고합니다. 나는 또한 하나의 항목을 선택할 수 있기를 원한다.2 차원 GridView
이 작업은 각 항목이 직사각형인데, 이것은 단일 행/방향 인 것 같습니다.
GRID (그리드에 행과 열이 있다는 것이 확실해 보이고 싶습니다.)하지만 더 많은 행을 추가하는 방법을 알지 못합니다.
코드 소스를 살펴 보았지만 소스 코드를 정의하는 지나치게 복잡한 코드 비헤이비어 파일을 모두 보았습니다.
GridView 요소에 단순히 Columns = "7"유형 속성이 없습니까? 분명히
스타일 자원
<ItemsPanelTemplate x:Key="colorSelectionRowTemplate">
<StackPanel Orientation="Horizontal">
<StackPanel.ChildrenTransitions>
<TransitionCollection/>
</StackPanel.ChildrenTransitions>
</StackPanel>
</ItemsPanelTemplate>
<Style x:Key="colorSelectionRow" TargetType="GridView">
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="GridView.ItemsPanel" Value="{StaticResource colorSelectionRowTemplate}"/>
</Style>
<Style x:Key="colorSelection" TargetType="Rectangle">
<Setter Property="Width" Value="30"/>
<Setter Property="Height" Value="30"/>
</Style>
행
<GridView Style="{StaticResource colorSelectionRow}">
<Rectangle Style="{StaticResource colorSelection}" Fill="AliceBlue" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="AntiqueWhite" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Aqua" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Aquamarine" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Azure" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Beige" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Bisque" Tapped="OnColorSelectionTapped"/>
</GridView>
<GridView Style="{StaticResource colorSelectionRow}">
<Rectangle Style="{StaticResource colorSelection}" Fill="AliceBlue" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="AntiqueWhite" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Aqua" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Aquamarine" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Azure" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Beige" Tapped="OnColorSelectionTapped"/>
<Rectangle Style="{StaticResource colorSelection}" Fill="Bisque" Tapped="OnColorSelectionTapped"/>
</GridView>
두 행의 예로서
...
그러나이 방법은 다음과 같습니다
는 내가 가지고있는 XAML입니다 각 행 (개별 GridView)에서 하나를 선택하면 여러 선택 항목이 있습니다.누구나이 간단한 수정을 알고 있으므로 동일한 GridView에서 7 개의 열로 각각 4 개의 행을 가질 수 있습니까?
감사합니다.이 모든 것을 읽어 주셔서 감사합니다.
케빈