整理Drawer的示例代码;

This commit is contained in:
zeroone 2024-09-11 00:13:55 +08:00
parent 4b48728176
commit 7809d2ef20

View File

@ -112,7 +112,7 @@
OpenOn="{atom:TopLevel}" OpenOn="{atom:TopLevel}"
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}"> Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
<atom:ConfirmDrawerFrame ConfirmCommand="{atom:Toast Text=Drawer Confirmed!, Header=Tips}" Header="Drawer with extra actions"> <atom:ConfirmDrawerFrame ConfirmCommand="{atom:Toast Text=Drawer Confirmed!, Header=Tips}" Header="Drawer with extra actions">
<TextBlock Margin="50" Text=" TODO " /> <TextBlock Margin="50" Text="Some contents..." />
</atom:ConfirmDrawerFrame> </atom:ConfirmDrawerFrame>
</atom:Drawer> </atom:Drawer>
@ -120,7 +120,7 @@
OpenOn="{atom:TopLevel}" OpenOn="{atom:TopLevel}"
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}"> Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
<atom:SubmitDrawerFrame ConfirmCommand="{atom:Toast Text=Drawer Confirmed!, Header=Tips}" Header="Drawer with extra actions"> <atom:SubmitDrawerFrame ConfirmCommand="{atom:Toast Text=Drawer Confirmed!, Header=Tips}" Header="Drawer with extra actions">
<TextBlock Margin="50" Text=" TODO " /> <TextBlock Margin="50" Text="Some contents..." />
</atom:SubmitDrawerFrame> </atom:SubmitDrawerFrame>
</atom:Drawer> </atom:Drawer>
</Panel> </Panel>
@ -129,9 +129,7 @@
<!-- Render in current area --> <!-- Render in current area -->
<desktop:ShowCaseItem Title="Render in current area" Description="Render in current area."> <desktop:ShowCaseItem Title="Render in current area" Description="Render in current area.">
<Panel> <Panel>
<StackPanel Height="120" <StackPanel Height="120" Classes="ControllerPanel">
atom:Watermark.Glyph="{atom:TextGlyph AtomUI}"
Classes="ControllerPanel">
<ListBox Classes="PlacementList" <ListBox Classes="PlacementList"
ItemsSource="{desktop:Enum atom:DrawerPlacement}" ItemsSource="{desktop:Enum atom:DrawerPlacement}"
SelectedIndex="2" /> SelectedIndex="2" />
@ -149,9 +147,7 @@
<!-- Multi-level drawer - Overlay --> <!-- Multi-level drawer - Overlay -->
<desktop:ShowCaseItem Title="Multi-level drawer - Overlay" Description="Open a new drawer on top of an existing drawer to handle multi branch tasks."> <desktop:ShowCaseItem Title="Multi-level drawer - Overlay" Description="Open a new drawer on top of an existing drawer to handle multi branch tasks.">
<Panel> <Panel>
<StackPanel Height="120" <StackPanel Height="120" Classes="ControllerPanel">
atom:Watermark.Glyph="{atom:TextGlyph AtomUI}"
Classes="ControllerPanel">
<ListBox Classes="PlacementList" <ListBox Classes="PlacementList"
ItemsSource="{desktop:Enum atom:DrawerPlacement}" ItemsSource="{desktop:Enum atom:DrawerPlacement}"
SelectedIndex="2" /> SelectedIndex="2" />
@ -188,9 +184,7 @@
<!-- Multi-level drawer - Push --> <!-- Multi-level drawer - Push -->
<desktop:ShowCaseItem Title="Multi-level drawer - Push" Description="Open a new drawer on top of an existing drawer to handle multi branch tasks."> <desktop:ShowCaseItem Title="Multi-level drawer - Push" Description="Open a new drawer on top of an existing drawer to handle multi branch tasks.">
<Panel> <Panel>
<StackPanel Height="120" <StackPanel Height="120" Classes="ControllerPanel">
atom:Watermark.Glyph="{atom:TextGlyph AtomUI}"
Classes="ControllerPanel">
<ListBox Classes="PlacementList" <ListBox Classes="PlacementList"
ItemsSource="{desktop:Enum atom:DrawerPlacement}" ItemsSource="{desktop:Enum atom:DrawerPlacement}"
SelectedIndex="2" /> SelectedIndex="2" />
@ -198,7 +192,7 @@
</StackPanel> </StackPanel>
<atom:Drawer IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}" <atom:Drawer IsOpen="{Binding $parent[Panel].((Panel)Children[0]).((atom:ToggleSwitch)Children[1]).IsChecked}"
OpenOn="{Binding $parent[showCase:DrawerShowCase]}" OpenOn="{Binding $parent[desktop:ShowCaseItem]}"
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}"> Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
<StackPanel Margin="50"> <StackPanel Margin="50">
<TextBlock Foreground="Green" Text="Drawer with Overlay OpenMode #1... " /> <TextBlock Foreground="Green" Text="Drawer with Overlay OpenMode #1... " />
@ -208,7 +202,7 @@
<atom:Drawer IsOpen="{Binding #ToggleSwitchOpenDrawer4.IsChecked}" <atom:Drawer IsOpen="{Binding #ToggleSwitchOpenDrawer4.IsChecked}"
OpenMode="Push" OpenMode="Push"
OpenOn="{Binding $parent[showCase:DrawerShowCase]}" OpenOn="{Binding $parent[desktop:ShowCaseItem]}"
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}"> Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
<StackPanel Margin="50"> <StackPanel Margin="50">
<TextBlock Foreground="Red" Text="Drawer with Push OpenMode #2... " /> <TextBlock Foreground="Red" Text="Drawer with Push OpenMode #2... " />
@ -218,7 +212,7 @@
<atom:Drawer IsOpen="{Binding #ToggleSwitchOpenDrawer5.IsChecked}" <atom:Drawer IsOpen="{Binding #ToggleSwitchOpenDrawer5.IsChecked}"
OpenMode="Overlay" OpenMode="Overlay"
OpenOn="{Binding $parent[showCase:DrawerShowCase]}" OpenOn="{Binding $parent[desktop:ShowCaseItem]}"
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}"> Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
<StackPanel Margin="50"> <StackPanel Margin="50">
<TextBlock Foreground="DeepPink" Text="Drawer with Overlay OpenMode #2... " /> <TextBlock Foreground="DeepPink" Text="Drawer with Overlay OpenMode #2... " />
@ -228,7 +222,7 @@
<atom:Drawer IsOpen="{Binding #ToggleSwitchOpenDrawer6.IsChecked}" <atom:Drawer IsOpen="{Binding #ToggleSwitchOpenDrawer6.IsChecked}"
OpenMode="Push" OpenMode="Push"
OpenOn="{Binding $parent[showCase:DrawerShowCase]}" OpenOn="{Binding $parent[desktop:ShowCaseItem]}"
Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}"> Placement="{Binding $parent[Panel].((Panel)Children[0]).((ListBox)Children[0]).SelectedItem}">
<TextBlock Margin="50" <TextBlock Margin="50"
Foreground="DodgerBlue" Foreground="DodgerBlue"
@ -237,13 +231,11 @@
</Panel> </Panel>
</desktop:ShowCaseItem> </desktop:ShowCaseItem>
<!-- Open on a target element -->
<desktop:ShowCaseItem Title="Basic" Description="Basic drawer."> <desktop:ShowCaseItem Title="Open on a target element" Description="Drawer can be opened on a special target element by property OpenOn.">
<Grid ColumnDefinitions="Auto,*"> <Grid ColumnDefinitions="Auto,*">
<Border Grid.ColumnSpan="2" <Border Grid.ColumnSpan="2" Height="300" />
Height="300" <StackPanel Grid.Column="0" Spacing="8">
atom:Watermark.Glyph="{atom:TextGlyph 'AtomUI'}" />
<StackPanel Grid.Column="0">
<atom:CheckBox x:Name="ToggleButton1" <atom:CheckBox x:Name="ToggleButton1"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
@ -252,30 +244,27 @@
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
Content="Open Drawer #2" /> Content="Open Drawer #2" />
<ComboBox x:Name="CbxHorizontalAlignment" ItemsSource="{desktop:Enum atom:DrawerPlacement}" /> <ListBox x:Name="CbxHorizontalAlignment"
<Button Click="ButtonOpenOnCurrentParent_OnClick" Content="Open On Current's Parent" /> Classes="PlacementList"
ItemsSource="{desktop:Enum atom:DrawerPlacement}"
SelectedIndex="2" />
<atom:Button Click="ButtonOpenOnCurrentParent_OnClick" Content="Open On Current's Parent" />
</StackPanel> </StackPanel>
<Grid Grid.Column="1" ColumnDefinitions="*,*"> <atom:Drawer x:Name="Drawer1"
<TextBlock Text="Left between a drawer." /> Grid.Column="1"
<Panel Grid.Column="1"> Background="Gray"
<atom:Drawer x:Name="Drawer1" IsOpen="{Binding #ToggleButton1.IsChecked}"
Background="Gray" OpenOn="{Binding $parent[desktop:ShowCaseItem]}"
IsOpen="{Binding #ToggleButton1.IsChecked}" Placement="{Binding #CbxHorizontalAlignment.SelectedItem}"
OpenOn="{Binding $parent[Panel]}" ShowMask="True">
Placement="{Binding #CbxHorizontalAlignment.SelectedItem}" <atom:Button Margin="16"
ShowMask="True"> HorizontalAlignment="Right"
<Border Background="White"> VerticalAlignment="Top"
<atom:Button HorizontalAlignment="Right" ButtonType="Primary"
VerticalAlignment="Top" Click="Button_OnClick"
ButtonType="Primary" Text="Button #1" />
Click="Button_OnClick" </atom:Drawer>
Text="Button in Drawer #1" />
</Border>
</atom:Drawer>
</Panel>
</Grid>
<atom:Drawer x:Name="Drawer2" <atom:Drawer x:Name="Drawer2"
Grid.Column="1" Grid.Column="1"
@ -283,13 +272,12 @@
IsOpen="{Binding #ToggleButton2.IsChecked}" IsOpen="{Binding #ToggleButton2.IsChecked}"
Placement="{Binding #CbxHorizontalAlignment.SelectedItem}" Placement="{Binding #CbxHorizontalAlignment.SelectedItem}"
ShowMask="True"> ShowMask="True">
<Border Background="White"> <atom:Button Margin="16"
<atom:Button HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Top" VerticalAlignment="Top"
ButtonType="Text" ButtonType="Text"
Click="Button_OnClick" Click="Button_OnClick"
Text="Button in Drawer #2" /> Text="Button #2" />
</Border>
</atom:Drawer> </atom:Drawer>
</Grid> </Grid>
</desktop:ShowCaseItem> </desktop:ShowCaseItem>