Telerik Forums
UI for WPF Forum
2 answers
825 views

My problem is simple: In my RadExpander header template, I am unable to access the properties of the data context of the expander itself.  Why does the header not have the same data context?

Here is a simple example:  A main Window with a label and a RadExpander (with HeaderTemplate).  The simple label easily accesses the "Name" property.  The RadExpander's HeaderTemplate cannot

 

<Window x:Class="TestTelerik.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:tk="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:testTelerik="clr-namespace:TestTelerik"
                Title="MainWindow" Height="350" Width="525"
                >
    <StackPanel>
 
        <!-- This shows up just fine -->
 
       <Label Content="{Binding HeaderTitle}"/>
 
        <tk:RadExpander>
            <tk:RadExpander.HeaderTemplate>
                <DataTemplate>
                     <!-- This does not show.  Why not? -->
                    <Label Content="{Binding HeaderTitle}"/>
                </DataTemplate>
            </tk:RadExpander.HeaderTemplate>
        </tk:RadExpander>
    </StackPanel>
</Window>

 

The DataContext of this window is just itself:

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        DataContext = this;
    }
 
    public string HeaderTitle => "Items!";
}

My real-world use case it actually quite a bit more complicated so it's not a viable solution for me to try to bind the "RadExpander.Header" property directly. 

Nor can I use the  "ElementName=" binding syntax.  Not in my case

What is the best way to make the RadExpander HeaderTemplate inherit its the RadExpander's  data context?

 

Martin Ivanov
Telerik team
 answered on 18 Jun 2019
1 answer
122 views

I just added a datapager to my project but it does not seem to be honoring the Windows8touch theme.

I have the window8touch dll referenced properly as everything else works.

==> Telerik.Windows.Themes.Windows8Touch

What do I have wrong.

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/System.Windows.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.Chart.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.Input.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.Data.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.DataVisualization.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.Navigation.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.Docking.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Documents.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Documents.Proofing.xaml" />
    <ResourceDictionary Source="/Telerik.Windows.Themes.Windows8Touch;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
</ResourceDictionary.MergedDictionaries>

 

David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 17 Jun 2019
2 answers
153 views

Hi all,

I am updating some code and it appears the use of InsertReadOnlyPage(DocumentPosition start, DocumentPosition end) from RadDocument is obselete and replaced by RadDocumentEditor.InsertReadOnlyPage().

 

The original call was the following (note the parameters):

1.editor.Document.InsertReadOnlyRange(start, end);

Would this be equivalent the equivalent update?

1.RadDocumentEditor _radDocEditor = new RadDocumentEditor(editor.Document);
2._radDocEditor.Document.Selection.AddSelectionStart(start);
3._radDocEditor.Document.Selection.AddSelectionEnd(end);
4._radDocEditor.InsertReadOnlyRange();
Pavel
Top achievements
Rank 1
 answered on 14 Jun 2019
1 answer
211 views

Hello, I am trying to convert my existing C# program from the real Microsoft WPF components to the Telerik components. Now I have the problem that I use the function DataGrid.Items.GetItemAt with the Microsoft components. What is the equivalent in Telerik RadGridView?

Thank you in advance

Ivan Ivanov
Telerik team
 answered on 14 Jun 2019
2 answers
171 views

When a user drags a tab out of a host TabbedWindow it creates a new TabbedWindow to host the Tab but this new TabbedWindow  doesn't inherit the configuration of the original parent. 

What would be the best way to get a handle on this new TabbedWindow and apply configuration style. E.g. disable the new tab button. 

Thanks,

Richard

(PS. I love this new control, it has really helped me)

Richard
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 14 Jun 2019
5 answers
234 views

Is there a way to enable WPF RadDock to open floated windows in a standalone window rather than a ToolWindow? The feature looks like its available in the WinForms version of RadDock but not WPF RadDock.

Would this be achieved in the DockingPanesFactory?

 

<telerik:RadDocking Grid.Row="2" x:Name="radDocking"<br>                            prism:RegionManager.RegionName="DocumentsRegion"<br>                            BorderThickness="0"<br>                            CustomElementLoading="RadDocking_CustomElementLoading"<br>                            HasDocumentHost="False"><br>            <br>            <telerik:RadDocking.DockingPanesFactory><br>                <local1:ShellDockingPanesFactory /><br>            </telerik:RadDocking.DockingPanesFactory><br><br>            <telerik:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft"><br>                <telerik:RadPaneGroup HorizontalAlignment="Left"  x:Name="leftGroup" telerik:RadDocking.SerializationTag="leftGroup"/><br>            </telerik:RadSplitContainer><br>            <telerik:RadSplitContainer InitialPosition="DockedRight" ><br>                <telerik:RadPaneGroup HorizontalAlignment="Right" x:Name="rightGroup" telerik:RadDocking.SerializationTag="rightGroup"/><br>            </telerik:RadSplitContainer><br>            <telerik:RadSplitContainer InitialPosition="DockedBottom" ><br>                <telerik:RadPaneGroup x:Name="bottomGroup" telerik:RadDocking.SerializationTag="bottomGroup"/><br>            </telerik:RadSplitContainer><br>            <telerik:RadSplitContainer InitialPosition="FloatingOnly" ><br>                <telerik:RadPaneGroup x:Name="floatingOnlyGroup" telerik:RadDocking.SerializationTag="floatingOnlyGroup"/>   <br>            </telerik:RadSplitContainer><br>            <telerik:RadSplitContainer InitialPosition="FloatingDockable" ><br>                <telerik:RadPaneGroup x:Name="floatingDockableGroup" telerik:RadDocking.SerializationTag="floatingDockableGroup"/><br>            </telerik:RadSplitContainer><br>         <br>        </telerik:RadDocking>

 

<p>public class ShellDockingPanesFactory : DockingPanesFactory<br>    {<br>        <br>        protected override void AddPane(RadDocking radDocking, RadPane pane)<br>        {<br>           <br>            var paneModel = pane as IPaneModel;<br>            if (paneModel != null && !(pane is RadDocumentPane))<br>            {<br>                RadPaneGroup group = null;<br>                switch (paneModel.Position)<br>                {<br>                    case DockState.DockedRight:<br>                        group = radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name == "rightGroup") as RadPaneGroup;<br>                        if (group != null)<br>                        {<br>                            group.Items.Add(pane);<br>                        }<br>                        return;<br>                    case DockState.DockedBottom:<br>                        group = radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name == "bottomGroup") as RadPaneGroup;<br>                        if (group != null)<br>                        {<br>                            group.Items.Add(pane);<br>                        }<br>                        return;<br>                    case DockState.DockedLeft:<br>                        group = radDocking.SplitItems.ToList().FirstOrDefault(i => i.Control.Name == "leftGroup") as RadPaneGroup;<br>                        if (group != null)<br>                        {<br>                            group.Items.Add(pane);<br>                        }<br>                        return;<br>                    case DockState.FloatingOnly:<br>                        var foSplitContainer = radDocking.GeneratedItemsFactory.CreateSplitContainer();<br>                        group = radDocking.GeneratedItemsFactory.CreatePaneGroup();<br>                        foSplitContainer.Items.Add(group);<br>                        group.Items.Add(pane);<br>                        radDocking.Items.Add(foSplitContainer);<br>                        pane.MakeFloatingOnly();<br>                        return;<br>                    case DockState.FloatingDockable:<br>                        var fdSplitContainer = radDocking.GeneratedItemsFactory.CreateSplitContainer();<br>                        group = radDocking.GeneratedItemsFactory.CreatePaneGroup();<br>                        fdSplitContainer.Items.Add(group);<br>                        group.Items.Add(pane);<br>                        radDocking.Items.Add(fdSplitContainer);<br>                        pane.MakeFloatingDockable();<br>                        return;<br>                    case DockState.DockedTop:<br>                    default:<br>                        return;<br>                }<br>            }<br>           base.AddPane(radDocking, pane);<br>        }<br>    }</p><p></p>

 

Dilyan Traykov
Telerik team
 answered on 14 Jun 2019
9 answers
591 views

Hi,

I'm able to reproduce this error "Cannot change or check the contents or Current position of the QueryableCollectionView while Refresh is being deferred" even on the latest release. The exception is caught only if we use exceptional handling (try, catch).  

I'm using QueryableDataServiceCollectionView with autoload set to true. Now, I am using DeferRefresh() to defer the irrelevant web requests that go out  when I make any changes on RadGridView (i.e changing sort, filter descriptors and column index). 

My problem here occurs when we are trying to change the index of the gridview column. The process is exiting from the PersistenceManager.Load() operation (because of the exception) and skipping the remaining part of execution. Henceforth, it also exits the DeferRefresh() which in turn sends out an irrelevant query to the database, overriding my gridview with different data.

In the sample project that I'm attaching, I couldn't reproduce the same situation by using QueryableDataServiceCollectionView as it needs a DataServiceContext and DataServiceQuery. 

Please provide any fix for this exception.

Here is the link to my sample project: 

https://hexmet-my.sharepoint.com/:u:/g/personal/shravya_kusuma_hexagon_com/EXier5S_YydBr9eljF9NN64BCFM_TUqJQ73F5ojPxDM15Q

Thanks,

Mohan.

Vladimir Stoyanov
Telerik team
 answered on 13 Jun 2019
6 answers
332 views

I've got a RadCartesianChart3D that uses a SurfaceSeries3D to show a colorized surface I've attached a sample image to show how it looks now ("Current_Surface.png")

  1. I colorize this surface using  a SurfaceSeries3dValueGradientColorizer.
  2. I build the colorizer in code-behind one single time.  It consists of 64 hard-coded color values that I use to colorize the my surface.
  3. The gradient stops are evenly distributed throughout the 0.0 to 1.0 range.  I just manually set each GradientStop's "Offset" value to be (1.0 / 64.0) apart

This all works very well and looks great.  It produces the image I referred to above.

Here is the XAML I use. 

<tk:RadCartesianChart3D.Series>
     <tk:SurfaceSeries3D ItemsSource="{Binding Points}"
                         XValueBinding="X"
                         YValueBinding="Y"
                         ZValueBinding="Z"
                         x:Name="Series"                                   
                         >
 
         <tk:SurfaceSeries3D.Colorizer>
             <tk:SurfaceSeries3DValueGradientColorizer x:Name="Colorizer" IsAbsolute="False" />
         </tk:SurfaceSeries3D.Colorizer>
     </tk:SurfaceSeries3D>
</tk:RadCartesianChart3D.Series>

And here is how my XAML builds the GradientStops

// "Colors" is an array of 64 custom colors.
// Return an evenly distributed array of them for gradient stops.
 
 var step = 1.0 / Colors.Length;
 var stops = Colors.Select((color, index) => new GradientStop(color, index * step));
 return new GradientStopCollection(stops);

 

But now I have a new requirement.  I need to add a RadSlider that allows the user to dynamically change the colors instantaneously.  The slider sets "cut-off" values distribution of the colors, limiting the range to a subset of 1.0.  The visual effect is to highlight certain values.  Basically I am emulating something that is already done  a different application of ours (that app uses OpenGL).  

To illustrate, I have also attached an image ("Desired_Surface.png") of this alternate application (the one that already has this slider) and the same surface showing.     You can see the the user has adjusted the bottom slider upwards and this has totally compressed the color distribution.  (You can even see the compressed distribution in the slider itself, though I don't need that). 

My problem is that I cannot see how to emulate this with SurfaceSeries3D without using Deferred Dragging .   The user needs to see the colors change immediately as he/she adjusted either of the sliders indicators;  But the only way I can see to implement this is far too slow for anything but deferred dragging.

First I tried binding the Colorizer's GradientStop property.  As you no doubt already know, that is not allowed by WPF

 

<tk:SurfaceSeries3D.Colorizer>
    <tk:SurfaceSeries3DValueGradientColorizer IsAbsolute="False" GradientStops="{Binding GradientStops}"/>

 

Then I tried declaring all 64 gradient stops directly in XAML and binding each one's GradientStop.Offset to a backing view-model property but that is also not allowed (because Gradient stops must be Freezable and always sorted)

<tk:SurfaceSeries3D.Colorizer>
    <tk:SurfaceSeries3DValueGradientColorizer IsAbsolute="False">
 
        <tk:SurfaceSeries3DValueGradientColorizer.GradientStops>
            <GradientStopCollection>
                <GradientStop Color="sc# 1.0,    0.0,    0.0, 0.5625" Offset="{Binding Offset_0}"/>
                <GradientStop Color="sc# 1.0,    0.0,    0.0, 0.6250" Offset="{Binding Offset_1}"/>

So the only way I could get this working was to completely rebuild the entire Colorizer every single time the user adjusts the slider.  I construct 64 new Gradient stops with the new Offset values and put them into a new GradientStop collection.  Unfortunately, this is far, far too laggy and slow.  It's too much work to do for a slider drag.  So I am left with using deferred dragging.  But that's not what my boss wants.

Is there any other approach I might take to speed up the adjustment of the colors? 

 


Martin Ivanov
Telerik team
 answered on 12 Jun 2019
6 answers
312 views
What I’m trying to do is to have a backstage button (Save) and a backstage list item (Save As) be disabled when there is no document open in the application. I’ve been able to bind IsEnabled successfully for the list item, but not the button. Is it possible to bind the IsEnabled property of a RadRibbonBackstageItem to a Boolean when that backstage item is functioning as a button (e.g. IsSelectable= “False”)? Even if I manually set the IsEnabled property to False rather than trying to bind it, the results are still an active “button”.
Zhenyan
Top achievements
Rank 1
 answered on 12 Jun 2019
1 answer
277 views
for (int i = 0; i < 20; i++)
    {
    chart.Annotations.Add (
           new CartesianGridLineAnnotation
               {
               Axis = chart.HorizontalAxis,
               Value = i,
               Margin = new Thickness (0, topMargin, 0, topMargin),
               Stroke = this.m_supportLineBrush,
               StrokeThickness = 1,
               Label = $"Dyanmic{i}",
               ClipToPlotArea = false,
               LabelDefinition = new ChartAnnotationLabelDefinition ()
                   {
                   Location = ChartAnnotationLabelLocation.Right, HorizontalOffset = -15
                   }
               });
    }

I have a chart with dynamically created CartesianGridLineAnnotations with labels. In some cases these annotations are very close together and the labels overlap.  How do I keep this from happening? Is there any kind of "Smart Label" for grid line annotation? 

 

Here is a simple example you can use to simulate my problem

 

Drago
Telerik team
 answered on 12 Jun 2019
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
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
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?