fix: fix toggle soulshot method

This commit is contained in:
k0t9i
2023-02-10 19:00:56 +04:00
parent 81e26a7e52
commit 7276b24249
22 changed files with 261 additions and 70 deletions

View File

@ -0,0 +1,36 @@
<Button x:Class="Client.Application.Components.Item"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Client.Application.Components"
xmlns:services="clr-namespace:Client.Application.Services"
mc:Ignorable="d"
ToolTipService.ShowOnDisabled="True"
x:Name="root">
<Button.InputBindings>
<MouseBinding Gesture="LeftClick" Command="{Binding MouseLeftClickCommand}" />
<MouseBinding Gesture="RightClick" Command="{Binding MouseRightClickCommand}" />
</Button.InputBindings>
<Button.Resources>
<services:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<services:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
<DataTemplate x:Key="ToolTipContent">
<StackPanel MaxWidth="300">
<TextBlock Text="{Binding ItemName,Mode=OneWay}" TextWrapping="Wrap" FontWeight="Bold" FontSize="14" Margin="0,0,0,5" />
<TextBlock
TextWrapping="Wrap"
Text="{Binding Source={x:Reference root},Path=Description,Mode=OneWay}"
/>
</StackPanel>
</DataTemplate>
</Button.Resources>
<Button.Content>
<Grid>
<Image Source="{Binding Path=ImageSource,ElementName=root}" Height="32" Width="32" />
</Grid>
</Button.Content>
<Button.ToolTip >
<ContentControl ContentTemplate="{StaticResource ToolTipContent}"/>
</Button.ToolTip>
</Button>

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Client.Application.Components
{
/// <summary>
/// Interaction logic for Item.xaml
/// </summary>
public partial class Item : Button
{
public static readonly DependencyProperty ImageSourceProperty =
DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(Item), new PropertyMetadata(default(ImageSource)));
public static readonly DependencyProperty ItemNameProperty =
DependencyProperty.Register("ItemName", typeof(string), typeof(Item), new PropertyMetadata("Item"));
public static readonly DependencyProperty DescriptionProperty =
DependencyProperty.Register("Description", typeof(string), typeof(Item), new PropertyMetadata(""));
public Item()
{
InitializeComponent();
}
public ImageSource ImageSource
{
get { return (ImageSource)GetValue(ImageSourceProperty); }
set { SetValue(ImageSourceProperty, value); }
}
public string ItemName
{
get { return (string)GetValue(ItemNameProperty); }
set { SetValue(ItemNameProperty, value); }
}
public string? Description
{
get { return (string?)GetValue(DescriptionProperty); }
set { SetValue(DescriptionProperty, value); }
}
}
}