<
UserControl
x:Class
=
"Sicant.Modules.PSCDocument.Controls.TreeView"
xmlns:example
=
"clr-namespace:Sicant.Modules.PSCDocument"
xmlns:tlkn
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:Commands
=
"clr-namespace:Sicant.Global.Commands;assembly=Sicant.Global"
d:DesignHeight
=
"600"
d:DesignWidth
=
"300"
mc:Ignorable
=
"d"
>
<
UserControl.Resources
>
<
Style
x:Key
=
"SquareButton"
TargetType
=
"{x:Type Button}"
>
<
Setter
Property
=
"Button.Height"
Value
=
"25"
/>
<
Setter
Property
=
"Button.Width"
Value
=
"25"
/>
<
Setter
Property
=
"Margin"
Value
=
"2,2,2,2"
/>
</
Style
>
<
Style
x:Key
=
"Menu"
TargetType
=
"Grid"
>
<
Setter
Property
=
"Height"
Value
=
"25"
/>
<
Setter
Property
=
"Width"
Value
=
"300"
/>
<
Setter
Property
=
"Background"
Value
=
"{StaticResource DarkBrush}"
/>
</
Style
>
<!-- nuovo per menù contestuale -->
<
DataTemplate
x:Key
=
"Risorsa1_Template"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/Document.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"Risorsa2_Template"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/Mail_Closed.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
DataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Account_HierTemplate"
ItemsSource
=
"{Binding Children}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/male.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Container_HierTemplate"
ItemsSource
=
"{Binding Children}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/Metal_Crate.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"PSC_HierTemplate"
ItemsSource
=
"{Binding Children}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/PSC.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Allegati_HierTemplate"
ItemsSource
=
"{Binding Children}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/Download.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
<
HierarchicalDataTemplate
x:Key
=
"Add_HierTemplate"
ItemsSource
=
"{Binding Children}"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Height
=
"30"
Source
=
"/Sicant.Global;component/Images/add-tab.png"
/>
<
TextBlock
Margin
=
"5 0 0 0"
Text
=
"{Binding Name}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
<
example:MyTemplateSelector
x:Key
=
"myTemplateSelector"
Template1
=
"{StaticResource Risorsa1_Template}"
Template2
=
"{StaticResource Risorsa2_Template}"
AccountTemplate
=
"{StaticResource Account_HierTemplate}"
ContainerTemplate
=
"{StaticResource Container_HierTemplate}"
PSCTemplate
=
"{StaticResource PSC_HierTemplate}"
AllegatiTemplate
=
"{StaticResource Allegati_HierTemplate}"
AddTemplate
=
"{StaticResource Add_HierTemplate}"
/>
<
DataTemplate
x:Key
=
"contextMenuItemTemplate"
>
<
tlkn:RadMenuItem
Grid.Column
=
"2"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Center"
Command
=
"{Binding MyCommand}"
CommandParameter="{
Binding #What is the correct binding?#,
RelativeSource={RelativeSource Self}
}"
Header
=
"{Binding Header}"
></
tlkn:RadMenuItem
>
</
DataTemplate
>
<
Style
x:Key
=
"contextMenuItemStyle"
TargetType
=
"tlkn:RadMenuItem"
>
<
Setter
Property
=
"Width"
Value
=
"200"
/>
<
Setter
Property
=
"Height"
Value
=
"30"
/>
<
Setter
Property
=
"Icon"
Value
=
"{Binding Icon}"
/>
<
Setter
Property
=
"IsSeparator"
Value
=
"{Binding IsSeparator}"
/>
</
Style
>
<
Style
x:Key
=
"treeViewStyle"
TargetType
=
"tlkn:RadTreeViewItem"
>
<
Setter
Property
=
"IsExpanded"
Value
=
"True"
/>
</
Style
>
</
UserControl.Resources
>
<
Grid
>
<
DockPanel
Name
=
"dockTreePanel1"
LastChildFill
=
"True"
>
<
ContentControl
Name
=
"TopTreePanel"
Height
=
"AUTO"
DockPanel.Dock
=
"Top"
/>
<
ContentControl
Name
=
"MainTreePanel"
DockPanel.Dock
=
"Top"
/>
<!-- contenitore di treeview complete -->
<
StackPanel
x:Name
=
"Contenitore"
Width
=
"300"
Margin
=
"0"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
Orientation
=
"Vertical"
>
<!-- contenitore di treeview Archivi completa -->
<
StackPanel
x:Name
=
"Contenitore_Archivi"
Width
=
"300"
Margin
=
"0"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
Orientation
=
"Vertical"
>
<!-- contenitore di Titolo Archivi -->
<
Grid
HorizontalAlignment
=
"Left"
Style
=
"{StaticResource Menu}"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"28"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"48"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
Image
Grid.Column
=
"0"
Width
=
"16"
Height
=
"16"
Margin
=
"0"
VerticalAlignment
=
"Center"
Source
=
"{StaticResource ArchiveImg}"
/>
<
TextBlock
Grid.Column
=
"1"
Margin
=
"15,0,0,0"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Center"
Text
=
"Documento PSC"
/>
<
Button
Grid.Column
=
"2"
Width
=
"20"
Height
=
"20"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Center"
Style
=
"{StaticResource SquareButton}"
ToolTip
=
"Copia nell'archivio utente"
Command
=
"{x:Static Commands:PSCCommand.CmdPSC_PrintAll}"
>
<
Image
Width
=
"14"
Height
=
"14"
Source
=
"{StaticResource PrintImg}"
/>
</
Button
>
</
Grid
>
<
tlkn:RadTreeView
x:Name
=
"radTreeView"
ItemContainerStyle
=
"{StaticResource treeViewStyle}"
ItemTemplateSelector
=
"{StaticResource myTemplateSelector}"
>
<
tlkn:RadContextMenu.ContextMenu
>
<
tlkn:RadContextMenu
x:Name
=
"radContextMenu"
ItemContainerStyle
=
"{StaticResource contextMenuItemStyle}"
ItemTemplate
=
"{StaticResource contextMenuItemTemplate}"
Opened
=
"RadContextMenu_Opened"
/>
</
tlkn:RadContextMenu.ContextMenu
>
</
tlkn:RadTreeView
>
</
StackPanel
>
</
StackPanel
>
</
DockPanel
>
</
Grid
>
</
UserControl
>
<
telerikGridView:RadGridView
Name
=
"grdScope"
ScrollMode
=
"RealTime"
DockPanel.Dock
=
"Bottom"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Stretch"
CanUserInsertRows
=
"False"
AutoGenerateColumns
=
"False"
CanUserSortColumns
=
"False"
CanUserFreezeColumns
=
"False"
CanUserReorderColumns
=
"False"
IsFilteringAllowed
=
"False"
CanUserResizeColumns
=
"True"
Telerik:StyleManager.Theme
=
"Office_Blue"
RowStyle
=
"{StaticResource GridViewRowStyleRow}"
ScrollViewer.VerticalScrollBarVisibility
=
"Auto"
SelectionMode
=
"Single"
ScrollViewer.HorizontalScrollBarVisibility
=
"Disabled"
ItemsSource
=
"{Binding}"
RowDetailsVisibilityMode
=
"Collapsed"
RowIndicatorVisibility
=
"Collapsed"
IsReadOnly
=
"True"
ShowGroupPanel
=
"False"
AutoExpandGroups
=
"True"
RowLoaded
=
"grdScope_RowLoaded"
SelectionUnit
=
"FullRow"
SelectionChanged
=
"grdScope_SelectionChanged"
MouseDoubleClick
=
"grdScope_MouseDoubleClick"
DataLoadMode
=
"Asynchronous"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"False"
>
var item = ((IList<Task>)
this
.grdScope.ItemsSource)[
this
.SelectedTaskIndex];
this
.grdScope.SelectedItem = item;
even when variable item has a non-null value, radGridView's SelectedItem property never changes from null to anything else when this code runs.var seriesDefinition = new LineSeriesDefinition();
seriesMapping.SeriesDefinition = seriesDefinition;
var binding = new Binding(){ Path= new PropertyPath("IsChecked"), Converter = new BooleanToVisibilityConverter(), Source = toggleVisible1, Mode = BindingMode.OneWay};
BindingOperations.SetBinding(seriesDefinition, SeriesDefinition.VisibilityProperty, binding);
Format Code Block
XAML
<CheckBox x:Name="toggleVisible1" Content="Show Line" HorizontalAlignment="Right" Margin="5,2,15,2" FlowDirection="RightToLeft" IsChecked="True" />
converter code - for the most part boils down to this:
return (value? Visibility.Visible : Visibility.Collapsed);
Again, the converter fires when the checkbox is toggle, but the series always stays visible. what am i doing wrong?
i am using latest version of wpf controls.
var copyBinding =
new
CommandBinding(RadGridViewCommands.Copy, ExecuteGridViewCopyCommand,
CanExecuteGridViewCopyCommand);
CommandManager.RegisterClassCommandBinding(
typeof
(RadGridView), copyBinding);
var copyBinding =
new
CommandBinding(RadGridViewCommands.Copy, ExecuteGridViewCopyCommand,
CanExecuteGridViewCopyCommand);
gridViewCategories.CommandBindings.Add(copyBinding);void
RadMapMouseMove(
object
sender, MouseEventArgs e)
{
if
(!vm.DrawingShape || vm.CurrentShape ==
null
)
return
;
if
(vm.CurrentShape.LocationWrappers.Count < 2)
return
;
var locationWrapper = vm.CurrentShape.LocationWrappers[vm.CurrentShape.LocationWrappers.Count - 1];
var location = Location.GetCoordinates(RadMap, e.GetPosition(RadMap));
locationWrapper.Location = location;
// updates databound LocationCollection
}
<
Telerik:RadChart
Height
=
"750"
x:Name
=
"WeightsChart"
Width
=
"1400"
>
<
Telerik:RadChart.DefaultView
>
<
Telerik:ChartDefaultView
>
<
Telerik:ChartDefaultView.ChartTitle
>
<
Telerik:ChartTitle
Content
=
"Catia Part and Assembly Weights"
HorizontalAlignment
=
"Center"
/>
</
Telerik:ChartDefaultView.ChartTitle
>
<
Telerik:ChartDefaultView.ChartLegend
>
<
Telerik:ChartLegend
Visibility
=
"Collapsed"
/>
</
Telerik:ChartDefaultView.ChartLegend
>
<
Telerik:ChartDefaultView.ChartArea
>
<
Telerik:ChartArea
>
<
Telerik:ChartArea.AxisX
>
<
Telerik:AxisX
LabelRotationAngle
=
"90"
/>
</
Telerik:ChartArea.AxisX
>
</
Telerik:ChartArea
>
</
Telerik:ChartDefaultView.ChartArea
>
</
Telerik:ChartDefaultView
>
</
Telerik:RadChart.DefaultView
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"1*"
/>
<
RowDefinition
Height
=
"1*"
/>
</
Grid.RowDefinitions
>
<
Telerik:ChartArea
x:Name
=
"BarChart"
NoDataString
=
"No Bar Series Data"
/>
<
Telerik:ChartArea
x:Name
=
"LineChart"
Grid.Row
=
"1"
NoDataString
=
"No Line Series Data"
/>
</
Grid
>
<
Telerik:RadChart.HierarchicalViewDescriptors
>
<!--Bar Chart Descriptors-->
<
Telerik:ChartHierarchicalViewDescriptor
>
<
Telerik:ChartHierarchicalViewDescriptor.SeriesMappings
>
<
Telerik:SeriesMapping
LegendLabel
=
"Weights"
ChartAreaName
=
"BarChart"
>
<
Telerik:SeriesMapping.SeriesDefinition
>
<
Telerik:BarSeriesDefinition
LegendDisplayMode
=
"None"
ItemStyle
=
"{StaticResource BarStyle}"
SeriesItemLabelStyle
=
"{StaticResource LabelStyle}"
>
</
Telerik:BarSeriesDefinition
>
</
Telerik:SeriesMapping.SeriesDefinition
>
<
Telerik:SeriesMapping.ItemMappings
>
<
Telerik:ItemMapping
FieldName
=
"Weight"
DataPointMember
=
"YValue"
/>
<
Telerik:ItemMapping
FieldName
=
"InstanceNumber"
DataPointMember
=
"XCategory"
/>
</
Telerik:SeriesMapping.ItemMappings
>
</
Telerik:SeriesMapping
>
</
Telerik:ChartHierarchicalViewDescriptor.SeriesMappings
>
</
Telerik:ChartHierarchicalViewDescriptor
>
<
Telerik:ChartHierarchicalViewDescriptor
>
<
Telerik:ChartHierarchicalViewDescriptor.Relation
>
<
Telerik:PropertyRelation
ParentPropertyName
=
"Children"
/>
</
Telerik:ChartHierarchicalViewDescriptor.Relation
>
<
Telerik:ChartHierarchicalViewDescriptor.SeriesMappings
>
<
Telerik:SeriesMapping
LegendLabel
=
"Weights"
ChartAreaName
=
"BarChart"
>
<
Telerik:SeriesMapping.SeriesDefinition
>
<
Telerik:BarSeriesDefinition
LegendDisplayMode
=
"None"
ItemStyle
=
"{StaticResource BarStyle}"
SeriesItemLabelStyle
=
"{StaticResource LabelStyle}"
/>
</
Telerik:SeriesMapping.SeriesDefinition
>
<
Telerik:SeriesMapping.ItemMappings
>
<
Telerik:ItemMapping
FieldName
=
"Weight"
DataPointMember
=
"YValue"
/>
<
Telerik:ItemMapping
FieldName
=
"InstanceNumber"
DataPointMember
=
"XCategory"
/>
</
Telerik:SeriesMapping.ItemMappings
>
</
Telerik:SeriesMapping
>
</
Telerik:ChartHierarchicalViewDescriptor.SeriesMappings
>
</
Telerik:ChartHierarchicalViewDescriptor
>
<
Telerik:ChartHierarchicalViewDescriptor
>
<
Telerik:ChartHierarchicalViewDescriptor.Relation
>
<
Telerik:PropertyRelation
ParentPropertyName
=
"Children"
/>
</
Telerik:ChartHierarchicalViewDescriptor.Relation
>
<
Telerik:ChartHierarchicalViewDescriptor.SeriesMappings
>
<
Telerik:SeriesMapping
LegendLabel
=
"Weights"
ChartArea
=
"BarChart"
>
<
Telerik:SeriesMapping.SeriesDefinition
>
<
Telerik:BarSeriesDefinition
LegendDisplayMode
=
"None"
/>
</
Telerik:SeriesMapping.SeriesDefinition
>
<
Telerik:SeriesMapping.ItemMappings
>
<
Telerik:ItemMapping
FieldName
=
"Weight"
DataPointMember
=
"YValue"
/>
<
Telerik:ItemMapping
FieldName
=
"InstanceNumber"
DataPointMember
=
"XCategory"
/>
</
Telerik:SeriesMapping.ItemMappings
>
</
Telerik:SeriesMapping
>
</
Telerik:ChartHierarchicalViewDescriptor.SeriesMappings
>
</
Telerik:ChartHierarchicalViewDescriptor
>
</
Telerik:RadChart.HierarchicalViewDescriptors
>
</
Telerik:RadChart
>