Telerik Forums
UI for WPF Forum
0 answers
135 views

Hi,
I am creating a generic grid solution, based on the Telerik grid with dynamic data source.
This is my ItemsSource:

var data = new ObservableCollection<MyDataRow>(); //DynamicObject

Where MyDataRow is created from 2D array of various objects (MyClass, Strings, etc).

And I would like to choose template based on value (or type of object) which will be presented in the cell, but the only way, that achieved the desired result, was to add TemplateSelector which dynamicly creates a concrete datatemplate for each column/cell.
Simplified version of my Selector:

public class MyTemplateSelector : DataTemplateSelector
{
	public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
	{
		if(container is GridViewCell gridViewCell && item != null)
		{
			int columnIndex = gridViewCell.Column.DisplayIndex;
			DataTemplate dataTemplate = null;
			MyDataRow myDataRow = item as MyDataRow;
			if (myDataRow["Column" + columnIndex] is MyClass)
			{	// Template example 1
				StringReader stringReader = new StringReader(
				@"<DataTemplate 
				xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""> 
					<TextBlock Text=""{Binding Column" + columnIndex + @".ResultText}""/> 
				</DataTemplate>");
				XmlReader xmlReader = XmlReader.Create(stringReader);
				dataTemplate = XamlReader.Load(xmlReader) as DataTemplate;
			}
			else
			{   // Template example 2
				StringReader stringReader = new StringReader(
				@"<DataTemplate 
				xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""> 
					<TextBlock Text=""{Binding Column" + columnIndex + @"}""/> 
				</DataTemplate>");
				XmlReader xmlReader = XmlReader.Create(stringReader);
				dataTemplate = XamlReader.Load(xmlReader) as DataTemplate;
			}
			if (!dataTemplates.ContainsKey(columnIndex))
			{
				dataTemplates.Add(columnIndex, dataTemplate);
			}
			return dataTemplates[columnIndex];
		}
		return null;
	}
	// Dictionary of already defined templates
	Dictionary<int, DataTemplate> dataTemplates = new Dictionary<int, DataTemplate>();
}

So in this case, there can be up to c*x number of slightly different templates:
(c - number of columns, x - number of specific templates)

Is there any more performance wise or clearer way to solve this problem?

Thank you for any help.

Radek
Top achievements
Rank 1
 asked on 17 Feb 2022
1 answer
159 views

I've been working with the yWorks for WPF technology for a few years now and have a chance to compare it to the Telerik WPF Diagramming framework and API sets; in my mind, these are complex and advanced UI frameworks. However, getting started is a long learning curve in many areas of geometry, some trigonometric calculations, systems programming, and some advanced animations work.  We are working to create the following technologies using the Diagramming frameworks:

  • OWL 2 DSL Logic and Visualization facilities
  • DSL Composition Editor and Visualization facilities
  • Microsoft Graph Engine TSL Editor
  • Real-time Workflow CMN and DMN Materializer and Interactive Visualization Facilities

I've been using yWorks - a fantastic technology and product, but expensive; it would be great if there was a better set of samples and tutorials around the dynamic use of the Diagramming APIs set for runtime capabilities. I think I've seen what guidance Telerik has made available to date; are there some additional resources available and what type of "professional services" might be available.

Tavi

0 answers
113 views

 

How to set the default first node unselected when page is loaded?

wang
Top achievements
Rank 1
 asked on 17 Feb 2022
1 answer
124 views

Hi,

This used to work:

<telerik:RadTransitionControl
            HorizontalContentAlignment="Stretch"
            VerticalContentAlignment="Stretch"
            Margin="10,0,0,0"
            Content="{Binding EventContent}">
            <telerik:RadTransitionControl.Transition>
                <telerikTransitions:RollTransition IsRollOut="True" IsTopToBottom="False" />
            </telerik:RadTransitionControl.Transition>
        </telerik:RadTransitionControl>

with 2022 update the control no longer shows *anything*

For testing, I hardcoded the Content:

        <telerik:RadTransitionControl
            HorizontalContentAlignment="Stretch"
            VerticalContentAlignment="Stretch"
            Margin="10,0,0,0">
            <TextBlock Foreground="Aqua" FontSize="44">This is a test</TextBlock>
            <telerik:RadTransitionControl.Transition>
                <telerikTransitions:RollTransition IsRollOut="True" IsTopToBottom="False" />
            </telerik:RadTransitionControl.Transition>
        </telerik:RadTransitionControl>

This showed the textbox while in Design mode, but when the app ran, nothing was displayed

 

Vladimir Stoyanov
Telerik team
 answered on 16 Feb 2022
1 answer
184 views

Hello,

is it possible to use the CardLayout-Property Rows but prevent wrapping?

I want to have just a single row with a horizontal scroll bar.

regards,

Tobias

 

Stenly
Telerik team
 answered on 16 Feb 2022
1 answer
1.8K+ views

Hi,

Xaml designer can't displayed content in the runtime design mode

but,  complie and excute all OK

The VS2019 project was made with WPF R3 2020, updated to WPF R1 2022  with VS2022 and compiled.

when installing wpf r1 2022, the installation folder was designated separately, and framework 4.6.2 was used.

Also, i tried to create a new one using the telerik template tool in vs2022 and tried it with

telerik ui for wpf->confiure project or upgrade wizard in 2019 existing project, but it didn't work.

 

Nikolay Mishev
Telerik team
 answered on 16 Feb 2022
1 answer
182 views
Hi, I'm trying to recreate a comparison view like the one attached. Is there a recommended way of going about this? I was hoping to be able to just use RadGridView but I can't get the data to show in columns properly. Maybe a RadListBox?
Martin Ivanov
Telerik team
 answered on 15 Feb 2022
1 answer
780 views

Dear Team,

how i can show/load Dashboard.xaml page in RadNavigationView.Content on click of Dashboard View Item

 

<telerik:RadNavigationView x:Name="navigationView"
                                   PaneHeader="RadNavigationView"
                                   SelectedIndex="0"
                                   DisplayMode="Expanded"
                                   AutoChangeDisplayMode="False">
            <telerik:RadNavigationView.Items>
                <telerik:RadNavigationViewItem Content="Dashbard" Icon="&#xe303;" IconTemplate="{StaticResource IconTemplate}"  Click="RadNavigationViewItem_Click" />
                <telerik:RadNavigationViewItem Content="a" Icon="&#xe301;" IconTemplate="{StaticResource IconTemplate}"  />
                <telerik:RadNavigationViewItem Content="B" Icon="&#xe132;" IconTemplate="{StaticResource IconTemplate}"  />
                <telerik:RadNavigationViewItem Content="c" Icon="&#xe906;" IconTemplate="{StaticResource IconTemplate}"  />
            </telerik:RadNavigationView.Items>
            <telerik:RadNavigationView.PaneFooter>
                <telerik:RadNavigationViewItem Content="About" Icon="&#xe401;" 
                                               IconTemplate="{StaticResource IconTemplate}" 
                                               CommandParameter="{Binding ElementName=navigationView}"  />
            </telerik:RadNavigationView.PaneFooter>
            <telerik:RadNavigationView.Content>
                <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                   
                </StackPanel>
            </telerik:RadNavigationView.Content>
        </telerik:RadNavigationView>


Stenly
Telerik team
 answered on 14 Feb 2022
1 answer
152 views

Hello,

I have a cartesian chart with line series based on data like this for every chart point

public class ChartEntry
{
    public int Number;
    public DateTime TimeStamp;
    public double Value1;
    public double Value2;
}

My series use Value1/2 for ValueBinding and Number for CategoryBinding. Horizontal axis is of type CategoricalAxis.

I want to add a (toggle)button to switch the horizontal axis from Number to TimeStamp (and back) during runtime.

Means, that I have to change CategoryBinding of series to TimeStamp and horizontal axis to type DateTimeContinuousAxis.

 

At the moment I have no clue how to do that. Any ideas? 

 

Thanks and regards

Stenly
Telerik team
 answered on 14 Feb 2022
1 answer
163 views

I am trying to update themes in a WPF application at run time.   The application is using the no XAML dlls.  The theme is being updated by replacing the resource dictionaries according to Theme change instructions.

When the resource dictionaries are replaced the theme updates for the entire application but all the tabs in the dock disappear.  New tab can be added to the Items Observable collection and they will appear in the dock.

 

        <telerik:RadDocking x:Name="Dock" 
                            AllowDragReorder="True"
                            PanesSource="{Binding Items, UpdateSourceTrigger=PropertyChanged}"
                            CloseButtonPosition="InPane">
            <telerik:RadDocking.DockingPanesFactory >
                <telerik:DockingPanesFactory />
            </telerik:RadDocking.DockingPanesFactory>
        </telerik:RadDocking>


Stenly
Telerik team
 answered on 11 Feb 2022
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
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?