Telerik Forums
UI for WPF Forum
2 answers
126 views
Hi all,

I am using a treeview bound to a hierarchy of ObservableCollections, and the bindings appear fine (including to a dependency property IsExpanded on the objects, and a pdependency property SelectedNode on the hierarchy as a whole) apart from one issue. My user can select a node and a control that fires this method:

public void NewConsolidation(object args)
        {
            SelectedNode.IsExpanded = true;
            var newNode = _hierarchy.AddNode(SelectedNode, "Another Child"); <-- inserts a node
            SelectedNode = newNode;
            SelectedNode.ParentNode.IsExpanded = true;
            SelectedNode.ParentNode.NodeName += "(has children)";
        }

With more than one node, collapsed, I see

+   Root Node <-- selected
 
go to

-  Root Node (has children)
     First Child
     Another Child <-- selected

but with only the root:

Root Node <-- selected 

goes to

+ Root Node (has children)

- that is, setting IsExpanded makes no difference if the node in question has never had children and been opened. I can see the binding is working, though, because the name change takes effect. I understand this is related to the treeview items not yet being generated - so how can I force them to be generated for this parent?
Julia
Top achievements
Rank 1
 answered on 07 Mar 2012
1 answer
154 views
application crashes on pressing the access key for ribbontab with following error.
System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls.RibbonView
  StackTrace:
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.ShowVisualChildrenTips(UIElement element)
       at Telerik.Windows.Controls.RibbonView.KeyTipService.<>c__DisplayClass16.<ShowTips>b__8()
       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)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       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)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run()
     
Miro Miroslavov
Telerik team
 answered on 07 Mar 2012
2 answers
173 views
Hi

I am using a Telerik radcombobox in a ItemsControl like below. The itemscontrol is populated with some data, and I want the combobox to be default selected to one of the fields in the data. Why doesn't this work?


<Window.Resources>
   <CollectionViewSource x:Key="orderViewSource" />
</Window.Resources>
 
<Grid>
   <ItemsControl x:Name="rptOrders" ItemsSource="{Binding Source={StaticResource orderViewSource}}">
      <ItemsControl.ItemTemplate>
         <DataTemplate>
            <Grid>
               <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="160px" />
                  <ColumnDefinition Width="Auto" />
               </Grid.ColumnDefinitions>
               <Label Content="{Binding Path=Name}" Grid.Column="0" VerticalAlignment="Center"></Label>
               <telerik:RadComboBox x:Name="rcbOrder" Grid.Column="1" SelectedItem="{Binding Path=Order}">
                  <telerik:RadComboBoxItem Content="Extra Hot" />
                  <telerik:RadComboBoxItem Content="Hot" />
                  <telerik:RadComboBoxItem Content="Mild" />
               </telerik:RadComboBox>
            </Grid>
         </DataTemplate>
      </ItemsControl.ItemTemplate>
   </ItemsControl>
</Grid>


Data:
((CollectionViewSource)(FindResource("orderViewSource"))).Source = Data.StaffOrders;
 
public class Data
{
   public static ObservableCollection<StaffMember> StaffOrders { get { return //loaddata; } }
   public class StaffMember
   {
      public Int32 StaffID { get; set; }
      public String Name { get; set; }
      public String Email { get; set; }
      public String Order { get; set; }
   }
}


Jeremy
Top achievements
Rank 1
 answered on 07 Mar 2012
2 answers
211 views
Hello,

I think I've found a bug with applying a Telerik style to a ListBox - with the style applied, ListBox items appear as though the ListBox had HorizontalContentAlignment="Left", even when I specify HorizontalContentAlignment="Stretch" .

I've made a little test project to demonstrate, and attached a screen shot of what the app looks like. The only bit omitted is the code-behind - in the window's constructor I add a single empty string to each listbox's items.

You can see that the border on the un-styled listbox extends all the way across the list box, but the border for the telerik styled version is left aligned. Does anyone know why this might be occuring/if there is a workaround I could use?

<Window x:Class="RadControlsWpfApp1.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style TargetType="ListBox" x:Key="TelerikListBoxStyle" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Office_BlueTheme, ElementType=ListBox}}"/>
    </Window.Resources>
 
    <StackPanel Orientation="Vertical">
        <ListBox Style="{StaticResource TelerikListBoxStyle}" x:Name="telerikStyledListBox" HorizontalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Label Content="telerik style" BorderThickness="1" BorderBrush="Black"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
 
        <ListBox x:Name="listBox" HorizontalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Label Content="standard style" BorderThickness="1" BorderBrush="Black"/>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </StackPanel>
</Window>


Regards,
James.
James
Top achievements
Rank 1
 answered on 06 Mar 2012
4 answers
123 views
If you zoom in to a tiny scale using the pan & zoom behaviour, the control will throw an exception and crash completely.  This is clearly not desired.

Will this be fixed shortly?
Gareth McNicol
Top achievements
Rank 1
 answered on 06 Mar 2012
0 answers
103 views
I have a few questions I need answered:

1. How do I turn off the grouping feature?

2. When the data in a RadGridView is being exported in text format, is there a way that I can change the format of the data output?  Meaning, I don't want the text surrounded by double quotes and I want each column to occupy a certain number of columns.

Thanks

Tony

P.S. I deleted the other questions that were originally in this post as I don't need them answered any more.  These two, though, I still need answers to.

Thanks
Tony
Top achievements
Rank 1
 asked on 06 Mar 2012
1 answer
363 views
Hi, I am very new to Telerik, and I am trying to get an old half finished project that uses Telerik working in VS2010. It builds fine but when I try to debug I get an XamlParseException exception, here is the details:

System.Windows.Markup.XamlParseException was unhandled
  Message=Cannot create instance of 'OMWindow' defined in assembly 'CCMSOM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation.  Error in markup file 'View/Main/OMWindow.xaml' Line 1 Position 9.
  Source=PresentationFramework
  LineNumber=1
  LinePosition=9
  StackTrace:
       at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
       at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
       at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
       at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
       at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
       at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
       at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
       at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
       at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
       at System.Windows.Markup.TreeBuilder.Parse()
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
       at System.Windows.Application.DoStartup()
       at System.Windows.Application.<.ctor>b__0(Object unused)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunInternal(Window window)
       at CCMSOM.App.Main() in C:\Users\mcgrath1\CCMSOM\trunk\obj\Debug\View\Main\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Reflection.TargetInvocationException
       Message=Exception has been thrown by the target of an invocation.
       Source=mscorlib
       StackTrace:
            at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
            at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
            at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
            at System.Activator.CreateInstance(Type type, Boolean nonPublic)
            at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
       InnerException: System.TypeInitializationException
            Message=The type initializer for 'CCMSOM.View.OMWindow' threw an exception.
            TypeName=CCMSOM.View.OMWindow
            InnerException: System.IO.DirectoryNotFoundException
                 Message=Could not find a part of the path 'C:\Users\mcgrath1\CCMSOM\trunk\bin\Config\CCMSOM_Config.xml'.
                 Source=mscorlib
                 StackTrace:
                      at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
                      at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
                      at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
                      at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
                      at CCMSOM.ViewModel.DataManager.LoadFromXml() in C:\Users\mcgrath1\CCMSOM\trunk\Worker\DataManager.cs:line 96
                      at CCMSOM.ViewModel.DataManager..ctor() in C:\Users\mcgrath1\CCMSOM\trunk\Worker\DataManager.cs:line 44
                      at CCMSOM.View.OMWindow..cctor() in C:\Users\mcgrath1\CCMSOM\trunk\View\Main\OMWindow.xaml.cs:line 34
                 InnerException: 

Vlad
Telerik team
 answered on 06 Mar 2012
1 answer
78 views
Is there any COMPLETE example to create a custom theme based on Windows7 theme? I tried a lot of ways to do my own reading this forum but no one supports Q1 2012 version; not even WPF. Thank you!
Tina Stancheva
Telerik team
 answered on 06 Mar 2012
1 answer
73 views
Hello,

When I display a RadCalendar control in a WPF application with the property IsEnabled=false, and then change the property to true. The number days remain grey and when I move the mouse over them they change it Forecolor to black.

<telerik:RadCalendar Grid.Row="1" Grid.Column="0"  Grid.ColumnSpan="2" Grid.RowSpan="2" MinHeight="620" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
		Columns="4" Rows="3" SelectionMode="Multiple" Name="calMain" IsTodayHighlighted="False" AreWeekNumbersVisible="False"
		FontFamily="Segoe UI" HeaderVisibility="Hidden" ViewsHeaderVisibility="Visible"
		IsEnabled="False" Background="White" Foreground="Black" />

private void btnEnabled_Click(object sender, RoutedEventArgs e)
{            
    calMain.IsEnabled = true;
}

How can I avoid this behaviour?

Regards,
Gerardo.
Dani
Telerik team
 answered on 06 Mar 2012
2 answers
230 views

I'm wondering about the reason why RadPane and RadDocumentPane fire the IsVisibleChanged and Unloaded events when I'm just dragging the Pane to an other place on the screen (in my case out of my MainWindow)?

IsVisibleChanged might be plausible, because the Pane becomes invisible for the split of a second, but Unloaded is not plausible, because the the Pane still exists.

So to which event do I have to listen if I want to react on the user clicking on the small cross on the pane to close it, if  IsVisibleChanged and Unloaded happen also when the user is only dragging the Pane?

Miroslav Nedyalkov
Telerik team
 answered on 06 Mar 2012
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?