资源简介
WPF 数据可视化 大屏展示 实现地图仿echarts模拟迁移效果 Telerik图表 仪表盘
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
using System.Reflection;
using System.Windows.Media.Animation;
using MapData;
namespace WpfMap
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = GetData(12);
try
{
MapGrid.Children.Clear();
string fullName = "Map.Controls.MapChina";//命名空间.类型名
UserControl map = (UserControl)Assembly.Load("Map.Controls").CreateInstance(fullName);
map.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
map.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
map.Margin = new Thickness(0);
if (map is Map.Controls.MapChina)
{
(map as Map.Controls.MapChina).MapClick = new RoutedPropertyChangedEventHandler<object>(MainWindow_MapClick);
}
MapGrid.Children.Add(map);
}
catch
{
;
}
}
public static List<ChartData> GetData(int dataSize)
{
Random rnd = new Random(0);
var result = new List<ChartData>();
for (int i = 0; i < dataSize; i )
{
result.Add(new ChartData()
{
Category = i,
Value = rnd.Next(1, 100),
Color = new SolidColorBrush(
Color.FromArgb(255, (byte)rnd.Next(0, 256), (byte)rnd.Next(0, 256), (byte)rnd.Next(0, 256)))
});
}
return result;
}
private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
MapGrid.Children.Clear();
ListBoxItem lbi = listBox1.SelectedItem as ListBoxItem;
string fullName = "Map.Controls." lbi.Tag.ToString();//命名空间.类型名
UserControl map = (UserControl)Assembly.Load("Map.Controls").CreateInstance(fullName);
map.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
map.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
map.Margin = new Thickness(0);
if (map is Map.Controls.MapChina)
{
(map as Map.Controls.MapChina).MapClick = new RoutedPropertyChangedEventHandler<object>(MainWindow_MapClick);
}
MapGrid.Children.Add(map);
}
catch
{
;
}
}
void MainWindow_MapClick(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (sender is Path)
{
}
MapGrid.Children.Clear();
UserControl map = new Map.Controls.MapHeNan();
map.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
map.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
map.Margin = new Thickness(0);
map.Name = "CMap";
map.Loaded = new RoutedEventHandler(map_Loaded);
MapGrid.Children.Add(map);
}
void map_Loaded(object sender, RoutedEventArgs e)
{
//Storyboard storyboard = new Storyboard();
////添加X轴方向的动画
//ThicknessAnimationUsingKeyFrames doubleAnimation = new ThicknessAnimationUsingKeyFrames();
//EasingThicknessKeyFrame ef = new EasingThicknessKeyFrame();
//ef.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1));
//ef.Value = new Thickness(150);
//doubleAnimation.KeyFrames.Add(ef);
//ef = new EasingThicknessKeyFrame();
//ef.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(2));
//ef.Value = new Thickness(0);
//doubleAnimation.KeyFrames.Add(ef);
//Storyboard.SetTarget(doubleAnimation, MapGrid);
//Storyboard.SetTargetProperty(doubleAnimation, new System.Windows.PropertyPath(MarginProperty));//new PropertyPath("(Canvas.Left)")--(FrameworkElement.Margin)
//storyboard.Children.Add(doubleAnimation);
//storyboard.Begin();
}
private void Image_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
ImageBrush b = new ImageBrush();
b.ImageSource = (sender as Image).Source;
b.Stretch = Stretch.Fill;
RootGrid.Background = b;
}
}
}
代码片段和文件信息
/*Copyright (c) 2009 T.Evelyn (evescode@gmail.com)
All rights reserved.
Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met:
1.Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer.
2.Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ‘‘AS IS‘‘ AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE D
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-04-15 09:16 WpfMap\
目录 0 2020-04-15 09:16 WpfMap\.vs\
目录 0 2020-04-15 09:16 WpfMap\.vs\WpfMap\
目录 0 2020-04-15 09:16 WpfMap\.vs\WpfMap\v14\
文件 174080 2020-04-15 09:16 WpfMap\.vs\WpfMap\v14\.suo
目录 0 2020-04-15 09:16 WpfMap\Map.Controls\
文件 4924 2020-04-15 09:16 WpfMap\Map.Controls\Map.Controls.csproj
文件 228 2020-04-15 09:16 WpfMap\Map.Controls\Map.Controls.csproj.user
目录 0 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\
文件 10478 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\Gauge.xaml
文件 49783 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\Gauge.xaml.cs
文件 197896 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\MapAnHui.xaml
文件 626 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\MapAnHui.xaml.cs
文件 280986 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\MapChina.xaml
文件 3666 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\MapChina.xaml.cs
文件 114874 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\MapHeNan.xaml
文件 5294 2020-04-15 09:16 WpfMap\Map.Controls\MapControl\MapHeNan.xaml.cs
目录 0 2020-04-15 09:16 WpfMap\Map.Controls\Properties\
文件 2481 2020-04-15 09:16 WpfMap\Map.Controls\Properties\AssemblyInfo.cs
文件 2876 2020-04-15 09:16 WpfMap\Map.Controls\Properties\Resources.Designer.cs
文件 5612 2020-04-15 09:16 WpfMap\Map.Controls\Properties\Resources.resx
文件 1099 2020-04-15 09:16 WpfMap\Map.Controls\Properties\Settings.Designer.cs
文件 201 2020-04-15 09:16 WpfMap\Map.Controls\Properties\Settings.settings
目录 0 2020-04-15 09:16 WpfMap\Map.Controls\Themes\
文件 448 2020-04-15 09:16 WpfMap\Map.Controls\Themes\Generic.xaml
文件 8230 2020-04-15 09:16 WpfMap\Map.Controls\TypeConverters.cs
目录 0 2020-04-15 09:16 WpfMap\Map.Controls\Utils\
文件 25847 2020-04-15 09:16 WpfMap\Map.Controls\Utils\MapFlow.cs
目录 0 2020-04-15 09:16 WpfMap\OutBin\
文件 413696 2020-04-15 09:16 WpfMap\OutBin\Map.Controls.dll
文件 103936 2020-04-15 09:16 WpfMap\OutBin\Map.Controls.pdb
............此处省略42个文件信息
- 上一篇:C# 动态绘制曲线
- 下一篇:仿QQ界面(非常不错的 winform UI界面)
相关资源
- 第二代Kinect WPF开发从入门到精通资料
- gmap离线地图执行文件
- WPF21个优秀项目及源码
- SciChart控件破解方法见包内
- WPF开发框架
- wpf特效轮播图
- WPF做的监控程序
- wpf 图片滑动效果
- Telerik_UI_for_WPF破解版
- Telerik_UI_for_WPF_2019_1_116_Dev.msi
- WPF编程宝典2012源码和书(全)
- 深入浅出WPF刘铁猛 重新整理书签 带源
- WPF程序设计指南完整PDF高清版
- Telerik UI for WPF 2018_1_116
- 深入浅出WPF 重新整理目录,带源码
- Pro WPF 4.5 in C# Pro WPF系列第四版 英文书
- WPF学习书籍pdf《葵花宝典_WPF自学手册
- Telerik_UI_for_WPF_Documentation
- WPF编程宝典C#2012 第4版(包含源码)
- WPF编程宝典 第四版
- c# WPF 动态曲线显示
- WPF高级编程PDF
- WPF崩溃重启
- 基于MapX的二次开发
- C#/WPF下的通用自动更新模块修正
- 基于WPF的USB设备浏览器
- WPF实现类似安卓,ISO的日期选择器
- WPF MVVM模式下 TreeView 右键菜单
- wpf入门第五篇 WPF with ECharts 项目源码
- wpf界面与类之间的交互
评论
共有 条评论