Files
aistudio-wpf-diagram/AIStudio.Wpf.BaseDiagram/Extensions/ViewModels/PersistDesignerItemViewModel.xaml
2021-07-29 13:55:18 +08:00

80 lines
3.4 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:viewmodel="clr-namespace:AIStudio.Wpf.BaseDiagram.Extensions.ViewModels"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
xmlns:converter="clr-namespace:AIStudio.Wpf.BaseDiagram.Converters"
xmlns:controls="clr-namespace:AIStudio.Wpf.BaseDiagram.Controls"
xmlns:dd="https://astudio.github.io/diagram"
xmlns:Fluent="urn:fluent-ribbon"
xmlns:s="clr-namespace:Util.DiagramDesigner;assembly=Util.DiagramDesigner"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors">
<converter:BoolVisibilityConverter x:Key="BoolVisibilityConverter"/>
<converter:DoubleToThickness x:Key="DoubleToThickness"/>
<s:ColorBrushConverter x:Key="ColorBrushConverter"/>
<ControlTemplate x:Key="infoButtonTemplate" TargetType="Button">
<Grid x:Name="grid" Opacity="0.1">
<Ellipse Width="16"
Height="16"
Stroke="Black"
StrokeThickness="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="White"/>
<Label Content="i"
FontWeight="Bold"
FontStyle="Italic"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
FontSize="12" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="grid"
Property="Opacity"
Value="1.0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- DataTemplate for DesignerCanvas look and feel -->
<DataTemplate DataType="{x:Type viewmodel:PersistDesignerItemViewModel}">
<Grid>
<Image IsHitTestVisible="False"
Stretch="Fill"
Source="/AIStudio.Wpf.BaseDiagram;component/Images/Persist.png"
Tag="setting" />
<Button x:Name="btnSetting" HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="5"
Template="{StaticResource infoButtonTemplate}"
Command="{Binding EditCommand}" />
</Grid>
</DataTemplate>
<!-- DataTemplate for Popup look and feel -->
<DataTemplate DataType="{x:Type viewmodel:PersistDesignerItemData}">
<Grid Background="{DynamicResource Fluent.Ribbon.Brushes.AccentBaseColorBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0"
Content="HostUrl"
Margin="5" />
<TextBox Grid.Row="1"
HorizontalAlignment="Left"
Text="{Binding HostUrl}"
Width="150"
Margin="5" />
</Grid>
</DataTemplate>
</ResourceDictionary>