Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara authored Nov 7, 2022
1 parent a8e04a3 commit 3cf00e7
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
75 changes: 75 additions & 0 deletions test/ModernWpfTestApp/CommonStylesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,81 @@
</StackPanel>
</Border>
</StackPanel>
<StackPanel Style="{DynamicResource CompactPanelStyle}">
<TextBlock Text="ListViewItem/GridViewItem testing area" Style="{DynamicResource StandardGroupHeader}"/>
<StackPanel Orientation='Horizontal' Background="{DynamicResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<StackPanel Orientation='Horizontal'>
<TextBlock Text='ListView - SelectionMode=' VerticalAlignment='Center' Margin='2'/>
<ComboBox x:Name='cmbListViewSelectionMode' SelectedIndex='2' SelectionChanged="CmbListViewSelectionMode_SelectionChanged">
<ComboBoxItem>None</ComboBoxItem>
<ComboBoxItem>Single</ComboBoxItem>
<ComboBoxItem>Multiple</ComboBoxItem>
<ComboBoxItem>Extended</ComboBoxItem>
</ComboBox>
</StackPanel>
<CheckBox x:Name='chkListViewIsEnabled' Content='IsEnabled?' IsChecked='True' Margin='2' Checked="ChkListViewIsEnabled_Checked" Unchecked="ChkListViewIsEnabled_Unchecked"/>
<ui:ListView x:Name='listView1' AllowDrop='True' SelectionMode='Multiple' Width='300' HorizontalAlignment='Left' Margin='2'>
<ui:ListViewItem x:Name='listViewItem1' Content='List Item 1'/>
<ui:ListViewItem x:Name='listViewItem2' Content='List Item 2'/>
<ui:ListViewItem x:Name='listViewItem3' Content='List Item 3' IsSelected='true'/>
</ui:ListView>
</StackPanel>
<StackPanel>
<StackPanel Orientation='Horizontal'>
<TextBlock Text='GridView - SelectionMode=' VerticalAlignment='Center' Margin='2'/>
<ComboBox x:Name='cmbGridViewSelectionMode' SelectedIndex='2' SelectionChanged="CmbGridViewSelectionMode_SelectionChanged">
<ComboBoxItem>None</ComboBoxItem>
<ComboBoxItem>Single</ComboBoxItem>
<ComboBoxItem>Multiple</ComboBoxItem>
<ComboBoxItem>Extended</ComboBoxItem>
</ComboBox>
</StackPanel>
<CheckBox x:Name='chkGridViewIsEnabled' Content='IsEnabled?' IsChecked='True' Margin='2' Checked="ChkGridViewIsEnabled_Checked" Unchecked="ChkGridViewIsEnabled_Unchecked"/>
<ui:GridView x:Name='gridView1' AllowDrop='True' SelectionMode='Multiple' Width='300' HorizontalAlignment='Left' Margin='2'>
<ui:GridViewItem x:Name='gridViewItem1' Content='Item 1' MinWidth='120' MinHeight='60'/>
<ui:GridViewItem x:Name='gridViewItem2' Content='Item 2' MinWidth='120' MinHeight='60'/>
<ui:GridViewItem x:Name='gridViewItem3' Content='Item 3' MinWidth='120' MinHeight='60' IsSelected='true'/>
</ui:GridView>
</StackPanel>
</StackPanel>
<StackPanel Orientation='Horizontal' Background="{DynamicResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<TextBlock Text='ListView - SelectionMode=Extended:' Margin='2'/>
<ui:ListView x:Name='listView2' AllowDrop='True' SelectionMode='Extended' Width='300' HorizontalAlignment='Left' Margin='2'>
<ui:ListViewItem x:Name='listViewItem4' Content='List Item 4' Height='5'/>
<ui:ListViewItem x:Name='listViewItem5' Content='List Item 5' Height='70'/>
<ui:ListViewItem x:Name='listViewItem6' Content='List Item 6' Height='90' IsSelected='true'/>
</ui:ListView>
</StackPanel>
<StackPanel>
<TextBlock Text='GridView - SelectionMode=Extended:' Margin='2'/>
<ui:GridView x:Name='gridView2' AllowDrop='True' SelectionMode='Extended' Width='300' HorizontalAlignment='Left' Margin='2'>
<ui:GridViewItem x:Name='gridViewItem4' Content='Item 4' MinWidth='120' MinHeight='60'/>
<ui:GridViewItem x:Name='gridViewItem5' Content='Item 5' MinWidth='120' MinHeight='60'/>
<ui:GridViewItem x:Name='gridViewItem6' Content='Item 6' MinWidth='120' MinHeight='60' IsSelected='true'/>
</ui:GridView>
</StackPanel>
</StackPanel>
<StackPanel Orientation='Horizontal' Background="{DynamicResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<TextBlock Text='ListView - SelectionMode=Single:' Margin='2'/>
<ListView x:Name='listView3' AllowDrop='True' SelectionMode='Single' Width='300' HorizontalAlignment='Left' Margin='2'>
<ListViewItem x:Name='listViewItem7' Content='List Item 7'/>
<ListViewItem x:Name='listViewItem8' Content='List Item 8'/>
<ListViewItem x:Name='listViewItem9' Content='List Item 9' IsSelected='true'/>
</ListView>
</StackPanel>
<StackPanel>
<TextBlock Text='GridView - SelectionMode=Single:' Margin='2'/>
<ui:GridView x:Name='gridView3' AllowDrop='True' SelectionMode='Single' Width='300' HorizontalAlignment='Left' Margin='2'>
<ui:GridViewItem x:Name='gridViewItem7' Content='Item 7' MinWidth='120' MinHeight='60'/>
<ui:GridViewItem x:Name='gridViewItem8' Content='Item 8' MinWidth='120' MinHeight='60'/>
<ui:GridViewItem x:Name='gridViewItem9' Content='Item 9' MinWidth='120' MinHeight='60' IsSelected='true'/>
</ui:GridView>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel>
<TextBlock
Text="Validating"
Expand Down
49 changes: 49 additions & 0 deletions test/ModernWpfTestApp/CommonStylesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using ComboBox = System.Windows.Controls.ComboBox;
using ListViewItem = System.Windows.Controls.ListViewItem;
using SelectionChangedEventArgs = System.Windows.Controls.SelectionChangedEventArgs;

namespace MUXControlsTestApp
{
Expand Down Expand Up @@ -313,5 +315,52 @@ private void StandardBackground_Click(object sender, RoutedEventArgs e)
RootSampleControlsPanel.Background = new SolidColorBrush(Colors.Transparent);
}

private void CmbListViewSelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (listView1 != null)
{
listView1.SelectionMode = (SelectionMode)(sender as ComboBox).SelectedIndex;
}
}

private void CmbGridViewSelectionMode_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (gridView1 != null)
{
gridView1.SelectionMode = (SelectionMode)(sender as ComboBox).SelectedIndex;
}
}

private void ChkListViewIsEnabled_Checked(object sender, RoutedEventArgs e)
{
if (listView1 != null)
{
listView1.IsEnabled = true;
}
}

private void ChkListViewIsEnabled_Unchecked(object sender, RoutedEventArgs e)
{
if (listView1 != null)
{
listView1.IsEnabled = false;
}
}

private void ChkGridViewIsEnabled_Checked(object sender, RoutedEventArgs e)
{
if (gridView1 != null)
{
gridView1.IsEnabled = true;
}
}

private void ChkGridViewIsEnabled_Unchecked(object sender, RoutedEventArgs e)
{
if (gridView1 != null)
{
gridView1.IsEnabled = false;
}
}
}
}

0 comments on commit 3cf00e7

Please sign in to comment.