or
I'm attempting (with limited success) to create a TreeView that contains a mixture of dynamic and static data.
You'll find my current best attempt at this below, however since I'm nesting TreeViews there is a side effect wherein it is possible to have multiple items within the parent TreeView selected. When I've tried nesting TreeViewItems the results were not positive, i.e. only the parent level TreeViewItem in the ItemTemplate is displayed and space for it's children is created but nothing is output.
I would really like to know how to acheive my goal without resorting to specifying the entire menu in collections which I bind to the TreeView.
Thank you
<
telerik:RadTreeView
Width
=
"225"
HorizontalAlignment
=
"Left"
Background
=
"Transparent"
FontWeight
=
"SemiBold"
>
<
telerik:RadTreeViewItem
Header
=
"Customer"
Command
=
"{Binding OpenCustomerCommand}"
/>
<
telerik:RadTreeViewItem
Header
=
"Sites"
Command
=
"{Binding OpenSiteBrowserCommand}"
ItemsSource
=
"{Binding Sites}"
>
<
telerik:RadTreeViewItem.ItemTemplate
>
<
DataTemplate
>
<
telerik:RadTreeView
>
<
telerik:RadTreeViewItem
Header
=
"{Binding Key}"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenSiteCommand}"
CommandParameter
=
"{Binding Value}"
>
<
telerik:RadTreeViewItem
Header
=
"Material Profiles"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenMaterialProfileBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
<
telerik:RadTreeViewItem
Header
=
"Prices"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenPriceBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
<
telerik:RadTreeViewItem
Header
=
"Orders"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenOrderBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
<
telerik:RadTreeViewItem
Header
=
"Activity"
>
<
telerik:RadTreeViewItem
Header
=
"Collection"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenActivityCollectionsBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
<
telerik:RadTreeViewItem
Header
=
"Call Outs"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenActivityCallOutBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
<
telerik:RadTreeViewItem
Header
=
"Gate"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenActivityGateBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
<
telerik:RadTreeViewItem
Header
=
"One Off Charges"
Command="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType
=
view
:WindowViewBase},
Path
=
DataContext
.OpenActivityOneOffChargeBrowserCommand}"
CommandParameter
=
"{Binding Value}"
/>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeView
>
</
DataTemplate
>
</
telerik:RadTreeViewItem.ItemTemplate
>
</
telerik:RadTreeViewItem
>
<
Window
x:Class
=
"CarSystem.AlarmsDialog"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:c
=
"clr-namespace:CarSystem"
xmlns:cc
=
"clr-namespace:CarSystem.CustomControls;assembly=CustomControls"
xmlns:tl
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
Background
=
"Transparent"
BorderBrush
=
"Black"
BorderThickness
=
"5"
Closing
=
"Window_Closing"
Foreground
=
"White"
HorizontalAlignment
=
"Center"
Height
=
"890"
Icon=". . .
Loaded
=
"Window_Loaded"
ResizeMode
=
"CanMinimize"
Title
=
". . ."
VerticalAlignment
=
"Center"
Width
=
"890"
WindowStartupLocation
=
"CenterScreen"
WindowStyle
=
"None"
>
<
StackPanel
Background
=
"#FF3C4B66"
>
. . .
<
StackPanel
FocusManager.IsFocusScope
=
"true"
HorizontalAlignment
=
"Right"
Orientation
=
"Horizontal"
>
<
Button
Background
=
"{DynamicResource ButtonBackground}"
Click
=
"CorrectButton_Click"
Content
=
"CORRECT"
FontSize
=
"20"
FontWeight
=
"Bold"
Foreground
=
"{DynamicResource ButtonForeground}"
Height
=
"60"
HorizontalAlignment
=
"Right"
Margin
=
"10"
Name
=
"CorrectButton"
Width
=
"156"
VerticalAlignment
=
"Center"
/>
<
telerik:RadSplitButton
Background
=
"{DynamicResource ButtonBackground}"
Click
=
"MisreadButton_Click"
CloseOnEscape
=
"False"
Content
=
"INCORRECT"
DropDownIndicatorVisibility
=
"Visible"
DropDownPlacement
=
"Top"
FontSize
=
"20"
FontWeight
=
"Bold"
Foreground
=
"{DynamicResource ButtonForeground}"
Height
=
"60"
HorizontalAlignment
=
"Right"
Margin
=
"10"
Name
=
"IncorrectButton"
Style
=
"{StaticResource RadSplitButtonStyle1}"
VerticalAlignment
=
"Center"
Width
=
"200"
>
<
telerik:RadSplitButton.DropDownContent
>
<
tl:RadContextMenu
>
<
tl:RadMenuItem
Header
=
"DEFER (8 hrs)"
Click
=
"DeferAlarm_Click"
/>
<
tl:RadMenuItem
Header
=
"MISREAD"
Click
=
"MisreadAlarm_Click"
/>
<
tl:RadMenuItem
Header
=
"NO PLATE"
Click
=
"NoPlate_Click"
/>
<
tl:RadMenuItem
Header
=
"HL ENTRY EXPIRED"
Click
=
"ExpiredHLEntry_Click"
/>
<
tl:RadMenuItem
Header
=
"WRONG STATE"
Click
=
"WrongState_Click"
/>
<
tl:RadMenuItem
Header
=
"UNKNOWN"
Click
=
"Unknown_Click"
/>
</
tl:RadContextMenu
>
</
telerik:RadSplitButton.DropDownContent
>
</
telerik:RadSplitButton
>
</
StackPanel
>
</
StackPanel
>
. . .
</
StackPanel
>
</
Window
>
System.Reflection.TargetInvocationException
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
System.Windows.Markup.XamlParseException
Failed to create a 'Path' from the text '(my:RadSplitButton.ToggleContentRotateAngle)'.
at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri) at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter) at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField) at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren) at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate) at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container) at System.Windows.FrameworkElement.ApplyTemplate() at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Border.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Designer.ZoomableViewPresenter.DesignerBackground.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at Microsoft.Windows.Design.Interaction.DesignerView.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Grid.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint) at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Controls.Control.MeasureOverride(Size constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) at System.Windows.UIElement.Measure(Size availableSize) at System.Windows.Interop.HwndSource.SetLayoutSize() at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at MS.Internal.DeferredHwndSource.ProcessQueue(Object sender, EventArgs e)
System.Xaml.XamlParseException
Prefix 'my' does not map to a namespace.
at MS.Internal.Xaml.XamlContext.ResolveXamlType(String qName, Boolean skipVisibilityCheck) at MS.Internal.Xaml.Context.ObjectWriterContext.ServiceProvider_Resolve(String qName) at MS.Internal.Xaml.ServiceProviderContext.System.Windows.Markup.IXamlTypeResolver.Resolve(String qName) at System.Windows.PropertyPath.GetTypeFromName(String name, Object context) at System.Windows.PropertyPath.ResolvePropertyName(String name, Object item, Type ownerType, Object context, Boolean throwOnError) at System.Windows.PropertyPath.ResolvePathParts(ITypeDescriptorContext typeDescriptorContext) at System.Windows.PropertyPath.PrepareSourceValueInfo(ITypeDescriptorContext typeDescriptorContext) at System.Windows.PropertyPath..ctor(String path, ITypeDescriptorContext typeDescriptorContext) at System.Windows.PropertyPathConverter.ConvertFrom(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, Object source) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value, XamlMember property) at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo)
<
telerik:RadCalendar
HeaderVisibility
=
"Collapsed"
Height
=
"150"
SelectableDateStart
=
"{Binding SelectedDateStart}"
SelectableDateEnd
=
"{Binding SelectedDateEnd}"
SelectedDate
=
"{Binding Date, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
/>
public
class
NextActionDate : INotifyPropertyChanged
{
public
DateTime SelectedDateStart {
get
;
set
; }
public
DateTime SelectedDateEnd {
get
;
set
; }
private
DateTime date;
public
DateTime Date
{
get
{
return
date;
}
set
{
date = value;
GenerateEvent(
"Date"
);
}
}
public
event
PropertyChangedEventHandler PropertyChanged;
private
void
GenerateEvent(
string
inName)
{
if
(PropertyChanged !=
null
)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(inName));
}
}
}