or
// Set font type and size in TextBlock
string fontName = "Verdana";
int fontSize = 12;
System.Windows.Media.FontFamily fontFamily = new System.Windows.Media.FontFamily(fontName);
TextBlock tagBlock = new TextBlock
{
Background = new SolidColorBrush(Colors.LightGoldenrodYellow),
FontFamily = fontFamily,
FontSize = fontSize,
Text = tagConent
};
// Get the size of TextBlock
tagBlock.Measure(new System.Windows.Size(Double.PositiveInfinity, Double.PositiveInfinity));
System.Windows.Size size = new System.Windows.Size(tagBlock.DesiredSize.Width, tagBlock.DesiredSize.Height);
// Create an InlineUIContainer containing the TextBlock
Telerik.Windows.Documents.Model.InlineUIContainer tagContainer = new Telerik.Windows.Documents.Model.InlineUIContainer(tagBlock, size);
// Insert the InlineUIContainer into the caret position
radRichTextBox1.InsertInline(tagContainer);
Hi,
I created RadMenu dynamically using HierarchicalDataTemplate
using following code.
<HierarchicalDataTemplate x:Key="MenuItemTemplate" ItemsSource="{Binding SubItems}"> <TextBlock Text="{Binding Text}" /> </HierarchicalDataTemplate>
<telerik:RadMenu x:Name="radMenu" Height="22" VerticalAlignment="Top" Orientation="Horizontal" ItemTemplate="{StaticResource MenuItemTemplate}" ItemClick="OnRadMenuItemClick" />
but in code behind of the OnRadMenuItemClick Event i am unable to find out name of the menu item that clicked.private void OnRadMenuItemClick(object sender, RadRoutedEventArgs e) { RadMenuItem item = e.OriginalSource as RadMenuItem; if (item != null) { switch (item.Name) { } } }
when i click on menu item .. item.Name allways comming as null.
can one please help me how to get the name of the menu item that clicked
but it is working for statically developed radmenu
Thanks
Rama
at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)<
br
>
at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)<
br
>
at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)<
br
>
at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)<
br
>
at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)<
br
>
at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)<
br
>
at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)<
br
>
at System.Windows.FrameworkElement.ApplyTemplate()<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Control.MeasureOverride(Size constraint)<
br
>
at Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(Size availableSize)<
br
>
at Telerik.Windows.Controls.GridView.GridViewHeaderRow.MeasureOverride(Size availableSize)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)<
br
>
at Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Border.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Control.MeasureOverride(Size constraint)<
br
>
at Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(Size availableSize)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)<
br
>
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)<
br
>
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Control.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Grid.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Control.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)<
br
>
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Border.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.Controls.Page.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)<
br
>
at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)<
br
>
at System.Windows.FrameworkElement.MeasureCore(Size availableSize)<
br
>
at System.Windows.UIElement.Measure(Size availableSize)<
br
>
at System.Windows.ContextLayoutManager.UpdateLayout()<
br
>
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)<
br
>
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()<
br
>
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()<
br
>
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)<
br
>
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)<
br
>
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)<
br
>
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)<
br
>
at System.Windows.Threading.DispatcherOperation.InvokeImpl()<
br
>
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)<
br
>
at System.Threading.ExecutionContext.runTryCode(Object userData)<
br
>
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)<
br
>
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)<
br
>
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)<
br
>
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<
br
>
at System.Windows.Threading.DispatcherOperation.Invoke()<
br
>
at System.Windows.Threading.Dispatcher.ProcessQueue()<
br
>
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)<
br
>
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)<
br
>
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)<
br
>
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)<
br
>
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)<
br
>
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)<
br
>
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)<
br
>
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)<
br
>
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)<
br
>
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)<
br
>
at System.Windows.Application.RunDispatcher(Object ignore)<
br
>
at System.Windows.Application.RunInternal(Window window)<
br
>
at System.Windows.Application.Run(Window window)<
br
>
at System.Windows.Application.Run()<
br
>
at STV.Application.StartUp.Main(String[] args)