WPF Custom Radar Chart

Source: Internet
Author: User
Tags radar

3. Finally define the data title display list

Front desk:

<usercontrol x:class= "Wpfapplication4.radarcharttitlelist"
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= "d:designwidth=" loaded= "radarcharttitlelist_onloaded" >
<UserControl.Resources>
<style x:key= "Itemcontainer" targettype= "{x:type ListBoxItem}" >
<setter property= "Template" >
<Setter.Value>
<controltemplate targettype= "{x:type ListBoxItem}" >
<border x:name= "Iconborder" background= "Transparent" cornerradius= "4" borderthickness= "0" >
<contentpresenter/>
</Border>
<ControlTemplate.Triggers>
<trigger property= "IsSelected" value= "true" >
<setter targetname= "Iconborder" property= "BitmapEffect" >
<Setter.Value>
<outerglowbitmapeffect glowcolor= "Transparent" glowsize= "5"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<listbox x:name= "MyListBox" itemssource= "{Binding}" itemcontainerstyle= "{StaticResource Itemcontainer}" Focusvisualstyle= "{x:null}" >
<ListBox.Template>
<ControlTemplate>
<stackpanel background= "Transparent" isitemshost= "True" ></StackPanel>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate>
<grid horizontalalignment= "left" verticalalignment= "Center" background= "Transparent" >
<Grid.ColumnDefinitions>
<columndefinition width= "Auto" ></ColumnDefinition>
<columndefinition width= "*" ></ColumnDefinition>
</Grid.ColumnDefinitions>
<grid horizontalalignment= "Center" margin= "10,0" background= "Transparent" >
<ellipse fill= "{Binding Color}" height= "6" width= "6" horizontalalignment= "right" verticalalignment= "Center" > </Ellipse>
<canvas verticalalignment= "center" horizontalalignment= "Center" >
<path fill= "{Binding color}" height= "5" strokethickness= "1" stroke= "{Binding color}" verticalalignment= "Center" Data= "m-10,0 l10,0" ></Path>
</Canvas>
</Grid>
<textblock grid.column= "1" text= "{Binding Name}" foreground= "White" background= "Transparent" ></textblock >
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>

Background:

<summary>
The interactive logic of Radarcharttitlelist.xaml
</summary>
public partial class Radarcharttitlelist:usercontrol
{
Public Radarcharttitlelist ()
{
InitializeComponent ();
}
<summary>
Data
</summary>
Public list<chartitem> Itemsoure
{
get {return (list<chartitem>) GetValue (itemsoureproperty);}
set {SetValue (Itemsoureproperty, value);}
}

public static readonly DependencyProperty Itemsoureproperty = Dependencyproperty.register ("Itemsoure", typeof (List <ChartItem>),
typeof (Radarchartcontrol), New PropertyMetadata (New List<chartitem> ()));

private void Radarcharttitlelist_onloaded (object sender, RoutedEventArgs e)
{
This. DataContext = itemsoure;
}
}

WPF Custom Radar Chart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.