1 Star 3 Fork 5

沙漠尽头的狼(dotnet9.com)/Dotnet9WPFControls

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
GuideControlView.xaml 6.81 KB
Copy Edit Raw Blame History
<Window
x:Class="Dotnet9WPFControls.Demo.Views.GuideControlView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dotnet9="https://dotnet9.com"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
Title="Dotnet9 WPF自定义控件"
Width="800"
Height="600"
prism:ViewModelLocator.AutoWireViewModel="True"
AllowsTransparency="True"
Background="Transparent"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.Resources>
<dotnet9:BindControlToGuideConverter x:Key="BindControlToGuideConverter" />
<Style
x:Key="Styles.ButtonDemo"
BasedOn="{StaticResource MainButtonStyle}"
TargetType="{x:Type Button}">
<Setter Property="Width" Value="100" />
<Setter Property="Height" Value="30" />
<Setter Property="Margin" Value="5" />
</Style>
</Window.Resources>
<Border
Background="White"
BorderBrush="#ccc"
BorderThickness="1"
MouseLeftButtonDown="Border_MouseDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="左上引导"
Style="{StaticResource Styles.ButtonDemo}">
<dotnet9:GuideHelper.GuideInfo>
<MultiBinding Converter="{StaticResource BindControlToGuideConverter}">
<Binding RelativeSource="{RelativeSource Self}" />
<Binding Path="BtnLeftTopGuide" />
</MultiBinding>
</dotnet9:GuideHelper.GuideInfo>
</Button>
<ListBox
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Top">
<Button Content="ListBox中的按钮" Style="{StaticResource Styles.ButtonDemo}">
<dotnet9:GuideHelper.GuideInfo>
<MultiBinding Converter="{StaticResource BindControlToGuideConverter}">
<Binding RelativeSource="{RelativeSource Self}" />
<Binding Path="DataContext.ListBoxItemGuide"
RelativeSource="{RelativeSource AncestorType={x:Type Window}}" />
</MultiBinding>
</dotnet9:GuideHelper.GuideInfo>
</Button>
</ListBox>
<Button
Grid.Row="0"
Grid.Column="2"
Margin="5"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Click="Close_Click"
FontSize="32"
IsCancel="True"
Style="{StaticResource CloseButtonStyle}">
<dotnet9:GuideHelper.GuideInfo>
<MultiBinding Converter="{StaticResource BindControlToGuideConverter}">
<Binding RelativeSource="{RelativeSource Self}" />
<Binding Path="BtnCloseGuide" />
</MultiBinding>
</dotnet9:GuideHelper.GuideInfo>
<materialDesign:PackIcon Kind="Close" />
</Button>
<Button
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="显示新手引导"
Style="{StaticResource Styles.ButtonDemo}">
<dotnet9:GuideHelper.GuideInfo>
<MultiBinding Converter="{StaticResource BindControlToGuideConverter}">
<Binding RelativeSource="{RelativeSource Self}" />
<Binding Path="BtnShowGuide" />
</MultiBinding>
</dotnet9:GuideHelper.GuideInfo>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:ChangePropertyAction
PropertyName="Display"
TargetName="GuideControl"
Value="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Button
Grid.Row="2"
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Content="左下引导"
Style="{StaticResource Styles.ButtonDemo}">
<dotnet9:GuideHelper.GuideInfo>
<MultiBinding Converter="{StaticResource BindControlToGuideConverter}">
<Binding RelativeSource="{RelativeSource Self}" />
<Binding Path="BtnLeftBottomGuide" />
</MultiBinding>
</dotnet9:GuideHelper.GuideInfo>
</Button>
<Button
Grid.Row="2"
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Content="右下引导"
Style="{StaticResource Styles.ButtonDemo}">
<dotnet9:GuideHelper.GuideInfo>
<MultiBinding Converter="{StaticResource BindControlToGuideConverter}">
<Binding RelativeSource="{RelativeSource Self}" />
<Binding Path="BtnRightBottomGuide" />
</MultiBinding>
</dotnet9:GuideHelper.GuideInfo>
</Button>
<dotnet9:GuideControl
x:Name="GuideControl"
Grid.Row="0"
Grid.RowSpan="3"
Grid.Column="0"
Grid.ColumnSpan="3"
Guides="{Binding GuideLists}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:ChangePropertyAction PropertyName="Display" Value="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</dotnet9:GuideControl>
</Grid>
</Border>
</Window>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/dotnet9/Dotnet9WPFControls.git
git@gitee.com:dotnet9/Dotnet9WPFControls.git
dotnet9
Dotnet9WPFControls
Dotnet9WPFControls
main

Search