Telerik Forums
UI for WPF Forum
2 answers
275 views

Hi!

I need to change the default timezone of my schedule view. Is there any way to do this? In this case, for example, I want to show every date and time in my scheduleview to be displayed in UTC or any other timezone that I can specify.

Stefan
Telerik team
 answered on 24 Dec 2018
1 answer
119 views

I want to use TreeListView for creating a financial statement. The columns are reporting periods determined at run time. The number of reporting periods is determined at run time.

It looks something like this.

Element                                     Jan                   Feb               Mar             April

AccountsReceivable                  10                     20                  40              90

Inventory                                    33                     66                  34            454

 

Column 1 is a heiractical list of elements

the other columns are a collection for each element that consists of:

Period (2018-Jan)

Value $100

How would I bind the reporting period column with the element row. I have the data. It is a matter of presenting it.

Yoan
Telerik team
 answered on 24 Dec 2018
1 answer
649 views

Hi, I'm relatively new in WPF and using the Telerik Controls. I'll go to my problem, I'm getting this error

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Trial.ViewModel.DeviceViewModel', AncestorLevel='1''. BindingExpression:Path=SelectedField; DataItem=null; target element is 'RadGridView' (Name='BitField'); target property is 'SelectedItem' (type 'Object')

I appreciate your help in giving the solution to my problem.

So... this is my current setup:

ListView.xaml

<UserControl x:Class="Trial.Views.RegisterListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Trial.Views"
             xmlns:viewmodel="clr-namespace:Trial.ViewModel"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="600">
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="RowDetailsTemplate">
                <telerik:RadGridView Name="BitField" ItemsSource="{Binding Fields}" SelectedItem="{Binding Path=SelectedField, RelativeSource={RelativeSource AncestorType={x:Type viewmodel:DeviceViewModel}}}" AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Value}"/>
                        <telerik:GridViewDataColumn Header="Command">
                            <telerik:GridViewDataColumn.CellEditTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <telerik:RadButton CornerRadius='15' Width="80" Height='30' Margin="10 10 0 0" ToolTip='Read Register' Content='Read' KeyboardNavigation.TabIndex="2" Command="{Binding Path=ReadRegisterCommand, RelativeSource={RelativeSource AncestorType={x:Type viewmodel:DeviceViewModel}}}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </telerik:GridViewDataColumn.CellEditTemplate>
                        </telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Documentation}"/>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
            </DataTemplate>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="300"/>
        </Grid.ColumnDefinitions>
        <telerik:RadGridView ItemsSource="{Binding Registers}" SelectedItem="{Binding SelectedRegister}" RowDetailsTemplate="{StaticResource RowDetailsTemplate}" AutoExpandGroups="False" RowIndicatorVisibility="Collapsed">
            <telerik:RadGridView.Columns>
                <telerik:GridViewToggleRowDetailsColumn/>
                <telerik:GridViewDataColumn Header="Register Name" DataMemberBinding="{Binding Name}"/>
                <telerik:GridViewDataColumn Header="Register Address" DataMemberBinding="{Binding Address}"/>
                <telerik:GridViewDataColumn Header="Register Value" DataMemberBinding="{Binding Value}"/>
                <telerik:GridViewDataColumn Header="Description" DataMemberBinding="{Binding Desc}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</UserControl>

=====================================================

DeviceViewModel.cs

public ObservableCollection<RegisterDetails> Registers
        {
            get
            {
                if (Registers != null)
                {
                    return this.Registers;
                }
                else
                {
                    return null;
                }
            }
        }

public RegisterDetails SelectedRegister
        {
            get
            {
                return this.selectedRegister;
            }

            set
            {
                this.selectedRegister = value;
                this.RaisePropertyChanged("SelectedRegister");
            }
        }

public FieldDetails SelectedField
        {
            get
            {
                return this.selectedField;
            }

            set
            {
                this.selectedField = value;
                this.RaisePropertyChanged("SelectedField");
            }
        }

=====================================================

RegisterDetails.cs

public class RegisterDetails
{
    public string Name { get; set; }
    public uint Address { get; set; }
    public uint Value { get; set; }
    public string Desc { get; set; }
    public FieldDetails[] Fields { get; set; }
}

=====================================================

FieldDetails.cs

public class FieldDetails
{
    public string Name { get; set; }
    public uint Value { get; set; }
    public string Documentation { get; set; }
}

Yoan
Telerik team
 answered on 24 Dec 2018
3 answers
218 views
I'm using UriImage provider as a base class to allow me to display various image files (e.g. floor plans). I don't have geographic coordinates for the images but I want to overlay data on the image relative to the image bottom left, using pixel coordinates. I've configured my provider class to use EPSG900913Projection as its spatial reference. Effectively my image should be displayed with the bottom left corner at 0,0. This is what my provider class looks like:
public class SchematicProvider : UriImageProvider, ICloneable
{
    private SchematicViewModel _viewModel;
    // EPSG900913Projection is a proportional projection so should work for arbitrary units (i.e. IPSC schematic maps)
    private readonly EPSG900913Projection _projection = new EPSG900913Projection();
 
    public override ISpatialReference SpatialReference => _projection;
 
    public SchematicProvider(SchematicViewModel viewModel)
    {
        _viewModel = viewModel;
        var mediaFileName = viewModel.GetMediaFileName();
 
        var topLeft = new Location(6000, 0);
        var bottomRight = new Location(0, 8000);
        // If I don't include this line, I can't zoom in and out of the image
        // but including this line makes the app crash when I click on the minimap button
        GeoBounds = new LocationRect(topLeft, bottomRight);
 
        Uri = new Uri(mediaFileName);
    }
 
    public new object Clone()
    {
        var provider = new SchematicProvider(_viewModel);
        InheritCurrentSource(provider);
        InheritParameters(provider);
        return provider;
    }
 
    protected override void Dispose(bool disposing)
    {
        _viewModel = null;
        base.Dispose(disposing);
    }
}

My view model looks like this:

public class SchematicViewModel
{
    private readonly string _imageName;
 
    public SchematicViewModel(string imageName)
    {
        _imageName = imageName;
    }
 
    public string GetMediaFileName()
    {
        return _imageName;
    }
}

And the code behind looks like this:

public MainWindow()
{
    InitializeComponent();
    RadMap1.SpatialReference = new EPSG900913Projection();
    RadMap1.Provider = new SchematicProvider(new SchematicViewModel("C:\\temp\\image.png"));
    // image is 8000 wide by 6000 high and I want to position the map center on the image center
    RadMap1.Center = new Location(3000, 4000);
}

 

If I don't set the GoeBounds in the provider then I can't zoom and pan as expected. If I do set the GeoBounds then when I click the minimap button the app crashes with the following exception:

System.ArgumentException
  HResult=0x80070057
  Message=Width and Height must be non-negative.
  Source=WindowsBase
  StackTrace:
   at System.Windows.Size..ctor(Double width, Double height)
   at Telerik.Windows.Controls.Map.SpatialReference.GetSizeInKilometers(Location basePoint, Size size)
   at Telerik.Windows.Controls.Map.LocationRect.CalculateGeographicalSize()
   at Telerik.Windows.Controls.Map.TilesVisualizationLayer.CalculateRegion()
   at Telerik.Windows.Controls.Map.TilesVisualizationLayer.OnMapChanged(RadMap oldMap, RadMap newMap)
   at Telerik.Windows.Controls.Map.InformationLayer.InformationLayerLoaded(Object sender, RoutedEventArgs e)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext 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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(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.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at ProvidersUriImageProvider.App.Main()

 

What am I doing wrong?

Thanks

Pete

 

 

 

Peter
Top achievements
Rank 1
Veteran
 answered on 22 Dec 2018
2 answers
528 views

I have been trying without success to edit a copy of the Material theme for RadGridView in order to make the scrollbars wider.  I have been able to make the outer part wider, but not the inner bar. (that you drag)  Would you happen to have an example?  I would also accept changing the scrollbars globally. (I have tried that too but with no success)

I did try to follow the steps in https://docs.telerik.com/devtools/wpf/styling-and-appearance/how-to/styling-apperance-styling-scrollbars

but have had no luck with that either.  Advanced WPF styling is still bewildering to me or I might have been able to figure this out on my own.

Joshua
Top achievements
Rank 2
 answered on 21 Dec 2018
5 answers
171 views

I would like to change the order to Drag & Drop between two or more groups in the GridView.

However, the contents of the sample works normally, but the code I wrote does not work.

I do not have any other options, but I do not know why. What did he do wrong? Please help me.

We are using version 2017.2.614.40.

Work Code...

<telerik:RadGridView x:Name="ui_lsvGridView" GroupRenderMode="Flat" RowIndicatorVisibility="Collapsed"
                             CanUserFreezeColumns="False"  
                             AutoGenerateColumns="False"
                             IsFilteringAllowed="{Binding UseGridFilter}"
                             CanUserResizeColumns="true"
                             GridLinesVisibility="Horizontal"                                                             
                             telerik:StyleManager.Theme="Windows8"                                                              
                             SelectionUnit="FullRow"
                             SelectionMode="Single"
                             IsReadOnly="True"
                             ShouldReorderColumnsOnUngrouping="True"
                             ItemsSource="{Binding DataList}"
                             SelectedItem="{Binding SelectedItem, Mode=TwoWay}"     
                             MouseRightButtonDown="ui_lsvGridView_MouseRightButtonDown"
                             MouseDoubleClick="ui_lsvGridView_MouseDoubleClick">
            <telerik:RadGridView.GroupHeaderTemplate>
                <DataTemplate>
                    <TextBlock Foreground="{Binding Group.Key, Converter={StaticResource EmptyValuetoColorStringConverter}}" Text="{Binding Group.Key, Converter={StaticResource EmptyValuetoEmptyConverter}}" FontWeight="Bold" />
                </DataTemplate>
            </telerik:RadGridView.GroupHeaderTemplate>
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Name="rno"  Header="{x:Static Locale:Res.MNU_No}" Width="40" DataMemberBinding="{Binding [rno]}" CellStyle="{StaticResource tGridRowStyle_Number}" IsFilterable="False" IsGroupable="False" >
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:CountFunction ResultFormatString="{}{0:N0}"  />
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>

..........

Stefan
Telerik team
 answered on 21 Dec 2018
3 answers
224 views

I checked this in a new project and see the same results. Seeing this with multiple versions, including the latest.

MouseWheelMode="ZoomToPoint" does not work. It zooms but does not center on the point.

The ZoomLevel binding is not updating correctly and/or partially ignoring MaxZoomLevel. For example, if I set a MaxZoomLevel of 19, and use the mouse wheel to zoom, I will receive the following values:

17,18,19,20

If I keep zooming in with the mouse wheel, I will continue to receive "20", even though the zoom isn't changing. If I then zoom out with the wheel, the ZoomLevel then changes from 20 to 18.

<telerik:RadMap MaxZoomLevel="19" UseSpringAnimations="False"
    ZoomLevel="{Binding ZoomLevel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Center="30.11,-91"
    MouseClickMode="None" MouseWheelMode="ZoomToPoint">
    <telerik:RadMap.Provider>
        <telerik:OpenStreetMapProvider/>
    </telerik:RadMap.Provider>
</telerik:RadMap>
Vladimir Stoyanov
Telerik team
 answered on 21 Dec 2018
3 answers
143 views

Hi guys, 

I need to make StrokeThickness bigger for the relation of the selected tasks.  What I want is to make easier for the user to understand each task's dependencies.  How can I do it?

Best regards

Paolo

Dinko | Tech Support Engineer
Telerik team
 answered on 21 Dec 2018
6 answers
328 views
Is there any way to use RadMultiColumnComboBox in RadGridView.Columns?
Dinko | Tech Support Engineer
Telerik team
 answered on 21 Dec 2018
1 answer
272 views

Hi,
I need to implement a grid where the user can select a list of itemes from a TreeView. Once the items are selected, the cell must show the concatenation of selected items. Attached you can find a sample screenshot of what I need.

I tried to do that creating a custom column (https://docs.telerik.com/devtools/wpf/controls/radgridview/managing-data/how-to/howto-create-custom-editor). 
This is an extract from the code of my custom column.

 

public override FrameworkElement CreateCellEditElement(GridViewCell cell, object dataItem)
        {
            var treeView = new RadTreeView
            {
                IsOptionElementsEnabled = true,
                ItemsSource = TreeViewItemsSource,
                ItemContainerStyle = TreeViewItemContainerStyle,
                ItemTemplate = HierarchicalItemTemplate,
            };

            var dropDownButton = new RadDropDownButton
            {
                DropDownContent = treeView,
                DropDownMaxHeight = 250,
            };

            //this.BindingTarget = ???;

            return dropDownButton as FrameworkElement;
        }

My question is how to bind the checked items of the TreeView to the BindingTarget dependency property of the GridViewBoundColumnBase in order to update the field of the data item bound to the column, once the cell edit is committed.

Thanks in advance.

Dinko | Tech Support Engineer
Telerik team
 answered on 21 Dec 2018
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?