WPF实现特殊统计图
2021-06-08 11:04
标签:ora 背景颜色 opened eve nap value sources container ide 效果图: ActiveFunItem.xaml代码: ActiveFunItem.xaml.cs代码: ActiveFunction.xaml代码: ActiveFunction.xaml.cs代码: WPF实现特殊统计图 标签:ora 背景颜色 opened eve nap value sources container ide 原文地址:https://www.cnblogs.com/lonelyxmas/p/10699321.htmlUserControl x:Class="SunCreate.Vipf.Client.UI.ActiveFunItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="74" d:DesignWidth="50">
Grid>
Grid.RowDefinitions>
RowDefinition Height="{Binding ItemWidth}">RowDefinition>
RowDefinition Height="24">RowDefinition>
Grid.RowDefinitions>
Border Width="{Binding ItemWidth}" Height="{Binding ItemWidth}" Background="{Binding FillColor}" BorderBrush="{Binding BorderColor}" BorderThickness="2" CornerRadius="{Binding ItemWidthHalf}" >
Border.ToolTip>
ToolTip>
ToolTip.Template>
ControlTemplate>
Border Background="#88333333" CornerRadius="4">
TextBlock Margin="5" Foreground="#f2f2f2" Text="{Binding FunName}">TextBlock>
Border>
ControlTemplate>
ToolTip.Template>
ToolTip>
Border.ToolTip>
Image Width="{Binding IconWidth}" Height="{Binding IconWidth}" Stretch="Fill" Source="{Binding Image}" VerticalAlignment="Center" HorizontalAlignment="Center">Image>
Border>
StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
TextBlock Text="{Binding Count}" Foreground="#008bf1" FontSize="20" VerticalAlignment="Center">TextBlock>
TextBlock Text="次" Foreground="#008bf1" FontSize="20" VerticalAlignment="Center">TextBlock>
StackPanel>
Grid>
UserControl>
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Navigation;
using System.Windows.Shapes;
namespace SunCreate.Vipf.Client.UI
{
///
UserControl x:Class="SunCreate.Vipf.Client.UI.ActiveFunction"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SunCreate.Vipf.Client.UI"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" Loaded="UserControl_Loaded">
Grid>
Grid.RowDefinitions>
RowDefinition Height="30">RowDefinition>
RowDefinition Height="1*">RowDefinition>
Grid.RowDefinitions>
Border CornerRadius="5 5 0 0" Background="#368bf0">
StackPanel Orientation="Horizontal" Margin="10 0 0 0">
Image Width="14" Source="/SunCreate.Vipf.Client.Resources;component/Image/_ZZ/ManagerMainPage/面板-活跃功能.png">Image>
TextBlock Margin="10 0 0 0" Text="活跃功能" FontSize="14" Foreground="#fff" VerticalAlignment="Center">TextBlock>
StackPanel>
Border>
Border Grid.Row="1" CornerRadius="0 0 5 5" Background="#ffffff" BorderThickness="1 0 1 1" BorderBrush="#dddddd" SnapsToDevicePixels="True">
Grid>
Viewbox x:Name="viewbox" Stretch="Fill" Height="260" Width="260">
Canvas Width="320" Height="320">
Grid>
Grid Width="300" Height="300">
Grid.Background>
ImageBrush Stretch="Fill" ImageSource="/SunCreate.Vipf.Client.Resources;component/Image/_ZZ/ManagerMainPage/活跃总量.png"/>
Grid.Background>
Grid>
Grid x:Name="container" Width="320" Height="320">
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="76,20,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="173,20,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="240,79,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="241,182,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="171,247,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="75,247,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="11,178,0,0">local:ActiveFunItem>
local:ActiveFunItem VerticalAlignment="Top" HorizontalAlignment="Left" Margin="12,82,0,0">local:ActiveFunItem>
Grid>
TextBlock Text="{Binding Count}" FontSize="30" FontWeight="Bold" Foreground="#ff2121" VerticalAlignment="Center" HorizontalAlignment="Center">TextBlock>
Grid>
Canvas>
Viewbox>
Grid>
Border>
Grid>
UserControl>
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Navigation;
using System.Windows.Shapes;
namespace SunCreate.Vipf.Client.UI
{
///