Click here to Skip to main content
15,893,161 members
Articles / Desktop Programming / WPF

OpenWPFChart: assembling charts from components: Part I - Parts

Rate me:
Please Sign up or sign in to vote.
4.29/5 (17 votes)
19 Mar 2009CPOL14 min read 82.3K   4K   81  
Provides the component model along with base components to assemble charts.
<!--revision $Id: PointMarkerDialog.xaml 18093 2009-03-16 04:15:06Z unknown $-->
<Window x:Class="OpenWPFChart.Helpers.PointMarkerDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:collections="clr-namespace:System.Collections;assembly=mscorlib"
    Title="Select Point Marker" 
	Style="{DynamicResource dialogWindow}"
	MinWidth="150" MinHeight="100"  WindowStartupLocation="CenterOwner"
	>

	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="DialogStyle.xaml"/>
			</ResourceDictionary.MergedDictionaries>

			<!-- Marker Geometries -->
			<collections:ArrayList x:Key="markerShapes">
				<!--Circle-->
				<EllipseGeometry Center="0,0" RadiusX="4" RadiusY="4"/>
				<!--Square-->
				<RectangleGeometry Rect="-4,-4,8,8"/>
				<!--Triangle vertex up-->
				<PathGeometry>
					<PathFigure StartPoint="-4,4" IsClosed="True">
						<PolyLineSegment Points="4,4 0,-4" />
					</PathFigure>
				</PathGeometry>
				<!--Triangle side up-->
				<PathGeometry>
					<PathFigure StartPoint="-4,-4" IsClosed="True">
						<PolyLineSegment Points="4,-4 0,4" />
					</PathFigure>
				</PathGeometry>
			</collections:ArrayList>
		</ResourceDictionary>
	</Window.Resources>
	
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
			<ColumnDefinition/>
		</Grid.ColumnDefinitions>
		
		<Label Target="{Binding ElementName=lbxMarkers}">Marker Gometry</Label>
		<ListBox Grid.Column="1" Name="lbxMarkers" ItemsSource="{StaticResource markerShapes}"
				 SelectionChanged="lbxMarkers_SelectionChanged">
			<ListBox.ItemsPanel>
				<ItemsPanelTemplate>
					<WrapPanel/>
				</ItemsPanelTemplate>
			</ListBox.ItemsPanel>
			
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Path Data="{Binding}" Stroke="Black" Margin="5" />
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>

		<Label Grid.Row="1" Target="{Binding ElementName=btnMarkerStrokeColor}">Marker Color</Label>
		<Button Grid.Row="1" Grid.Column="1" Name="btnMarkerStrokeColor" Click="btnMarkerStrokeColor_Click" 
				ToolTip="Click to select the Marker Color">
			<Rectangle Width="50" Height="17">
				<Rectangle.Fill>
					<SolidColorBrush Color="{Binding MarkerStrokeColor}"/>
				</Rectangle.Fill>
			</Rectangle>
		</Button>

		<Label Grid.Row="2" Target="{Binding ElementName=btnMarkerFillColor}">Marker Fill Color</Label>
		<Button Grid.Row="2" Grid.Column="1" Name="btnMarkerFillColor" Click="btnMarkerFillColor_Click" 
				ToolTip="Click to select the Marker Fill Color">
			<Rectangle Width="50" Height="17">
				<Rectangle.Fill>
					<SolidColorBrush Color="{Binding MarkerFillColor}"/>
				</Rectangle.Fill>
			</Rectangle>
			
			<!--<Button.Style>
				<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
					<Style.Triggers>
						<Trigger Value="{x:Type GeometryDrawing}">
							<Trigger.Property>
								<Binding Path="MarkerType" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window}}"/>
							</Trigger.Property>
							<Setter Property="Visibility" Value="Visible"/>
						</Trigger>
					</Style.Triggers>
				</Style>
			</Button.Style>-->
		</Button>

		<StackPanel Grid.Row="3" Grid.ColumnSpan="2" Orientation="Horizontal" 
					HorizontalAlignment="Right" VerticalAlignment="Bottom">
			<Button Name="btnOK" Click="btnOK_Click" Style="{StaticResource dialogButton}" 
					IsEnabled="False" IsDefault="True">OK</Button>
			<Button Style="{StaticResource dialogButton}" IsCancel="True">Cancel</Button>
		</StackPanel>
	</Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions