Telerik Forums
UI for Universal Windows Platform Forum
3 answers
61 views

Hi, I have a RadMap with separate ShapeLayers for boundaries and roads.  I would like to toggle the display of the roads. How do I do this with UI for UWP?

I tried binding the Visibility of the MapShapeLayer to a VM property.  This seems to allow me to turn visibility 'on' (show the ShapeLayer), but not off again.  

I have found I **can** toggle the Visibility of the entire RadMap using binding.  Is the only way to have two maps (one with the boundaries ShapeLayer and one with both boundaries and roads) in order to toggle the display of a ShapeLayer?

Many thanks

 

mcalex

Yana
Telerik team
 answered on 05 Aug 2019
6 answers
339 views

I create a 16299 UWP project and use DateView as ItemsSource for DataGrid. But the UI cannot show the data.

<my:RadDataGrid x:Name="dataGrid" AutoGenerateColumns="False" >
 </my:RadDataGrid>
public sealed partial class MainPage : Page
    {
        private ObservableCollection<Dictionary<string, string>> items = new ObservableCollection<Dictionary<string, string>>();
 
        public ObservableCollection<Dictionary<string, string>> ItemDictionary
        {
            get
            {
                return items;
            }
            set
            {
                items = value;
            }
        }
 
        public DataTable Items { get; set; }
        public MainPage()
        {
            this.InitializeComponent();
            CreateItems();
            CreateTable();
        }
 
        private void CreateItems()
        {
            for (int i = 0; i < 5; i++)
            {
                Dictionary<string, string> row = new Dictionary<string, string>();
                row["A"] = "A" + i.ToString();
                row["B"] = "B" + i.ToString();
                row["C"] = "C" + i.ToString();
 
                ItemDictionary.Add(row);
 
            }
        }
 
        private void CreateTable()
        {
            Items = new DataTable();
 
            if (ItemDictionary.Count == 0) return;
 
            foreach (KeyValuePair<string, string> entry in ItemDictionary[0])
            {
                DataColumn column = new DataColumn(entry.Key);
                Items.Columns.Add(column);
                Telerik.UI.Xaml.Controls.Grid.DataGridTextColumn dgc = new Telerik.UI.Xaml.Controls.Grid.DataGridTextColumn();
                dgc.Name = entry.Key;
                dgc.Header = entry.Key;
                dgc.PropertyName = entry.Key;
                dataGrid.Columns.Add(dgc);
            }
 
            foreach (Dictionary<string, string> rowEntry in ItemDictionary)
            {
                DataRow row = Items.NewRow();
                int col = 0;
                foreach (KeyValuePair<string, string> entry in rowEntry)
                {
                    row[entry.Key] = entry.Value;
                }
                Items.Rows.Add(row);
            }
            DataView dv = Items.DefaultView;
            dataGrid.ItemsSource = dv;
        }
    }
Lance | Manager Technical Support
Telerik team
 answered on 02 Aug 2019
0 answers
67 views

Is there a property that I can set to turn this behavior off? If I click on the a resize handle, even if I do not resize, the grid scrolls back to the beginning. Therefore, if the whole grid won't fit on the screen without horizontal scrolling, the user won't be able to resize columns that are only visible by scrolling to the right. As soon as they click on the resize handle, the grid scrolls back to the beginning and the column they are trying to resize if off screen.

My code for the table looks like this:

<tg:RadDataGrid

RelativePanel.Below="ColumnsVisibleCheckboxes"

RelativePanel.AlignLeftWithPanel="True"

RelativePanel.AlignRightWithPanel="True"

ColumnDataOperationsMode="Flyout"

x:Name="grid" ItemsSource="{x:Bind ViewModel.Source}"

AutoGenerateColumns="False"

VerticalAlignment="Stretch"

GridLinesVisibility="Both" GridLinesBrush="LightGray"

GridLinesThickness="1" AlternationStep="2"

AlternationStartIndex="0" RowBackground="#3D3B3B"

AlternateRowBackground="#3A494F"

UserEditMode="Inline"

SelectionMode="Extended"

ColumnResizeHandleDisplayMode="Always"

UserGroupMode="Auto"

ScrollViewer.VerticalScrollMode="Auto"

ScrollViewer.VerticalScrollBarVisibility="Auto"

ScrollViewer.HorizontalScrollMode="Auto"

ScrollViewer.HorizontalScrollBarVisibility="Auto">

Thanks for your help!

Matthew
Top achievements
Rank 1
 asked on 23 Jul 2019
2 answers
115 views

I've implemented custom filtering based on the how-to article in the KB, but I see this odd behavior where, after clearing the last checkbox in my filter, the filter control appears to still run the PassesFilter logic, resulting in 0 matches, and the column header still has the visual treatment indicating that it is filtered. What I'd like to do is have an un-check of the last item in a filter behave as if the user has clicked the 'Clear Filter' button.

I've tried several things and havethe following conclusions:

  • The custom filter is applied to the column when the CommandId.FilterButtonTap command executes, but the Clear button executes CommandId.FilterRequested, so if I want to reset the filter I'd need to do so in my custom GridFilterRequestedCommand
  • IsFiltering and Descriptor are both read-only properties on the FilterRequestContext in CommandId.FilterRequested so I can't try to set the first to false or null the second
  • It looks like the Clear Filters button removes the FilterDescriptor from the owner, but this didn't make any difference when I tried it because I can't un-set IsFiltering
  • I can't create my own FilterRequestedContext to fake an invocation because of the internal sets on all the properties
  • WPF appears to have a ClearFilters method which UWP lacks

I'm hoping there's some way to hack around these shortcomings. I also think that a CommandId.FilterRequested should be able to notify the Grid column filter that there are no items chosen to filter on, and that the column should act as if the filter has been cleared.

Nasko
Telerik team
 answered on 28 Jun 2019
3 answers
1.1K+ views

Hi all

I have been looking at the example (App7), specifically this line:

 <commands:DataGridUserCommand Id="CommitEdit" Command="{Binding Source={StaticResource ViewModel}, Path=MyCommand}" />

I am trying to pass my ViewModel as a parameter so I can access it here:

 private void OnMyCommandExecute(object obj)

At the moment, the Parameter property is empty but CellInfo is populated.

I hope my question is clear.

Thanks

 

 

Lance | Manager Technical Support
Telerik team
 answered on 13 Jun 2019
0 answers
85 views

So I am having an issue with Telerik's RadDataGrid for UWP. I have a command that updates an item in the collection that is bound to the RadDataGrid. It sets 3 properties, the one I'm having issues with is an enum property; Status. The Status enumeration is used in a couple of DataTemplateSelectors and StyleSelectors. There is no column defined for the Status property. When it gets updated, an exception gets thrown:

System.InvalidOperationException
  HResult=0x80131509
  Message=Failed to compare two elements in the array.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Collections.Generic.ArraySortHelper`1.BinarySearch(T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Array.BinarySearch[T](T[] array, Int32 index, Int32 length, T value, IComparer`1 comparer)
   at System.Collections.Generic.List`1.BinarySearch(Int32 index, Int32 count, T item, IComparer`1 comparer)
   at Telerik.Data.Core.Group.IndexOf(Object item, IComparer`1 sortComparer)
   at Telerik.Data.Core.Engine.ParallelDataEngine.Telerik.Data.Core.Engine.IDataEngine.GetFilteredItemIndex(Object item)
   at Telerik.Data.Core.LocalDataSourceProvider.ProcessPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Telerik.Data.Core.LocalDataSourceProvider.DataView_ItemPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Telerik.Data.Core.EnumerableDataSourceView.HandlePropertyChanged(Object sender, PropertyChangedEventArgs e)
   at Telerik.Data.Core.EnumerableDataSourceView.Telerik.Core.IWeakEventListener.ReceiveEvent(Object sender, Object args)
   at Telerik.Core.WeakEventHandlerList`1.OnPropertyChanged(Object sender, PropertyChangedEventArgs e)
   at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
   at GalaSoft.MvvmLight.ObservableObject.RaisePropertyChanged(String propertyName)
   at GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged[T](String propertyName, T oldValue, T newValue, Boolean broadcast)
   at GalaSoft.MvvmLight.ViewModelBase.Set[T](T& field, T newValue, Boolean broadcast, String propertyName)
   at MyLineItemViewModel.set_Status(Status value) in MyLineItemViewModel.cs:line 121
 
Inner Exception 1:
ArgumentException: Object must be of type String.

 

I have gone through an changed the enum property's data type to string, but I still get the same issue. For what it's worth, I am sorting the collection via PropertySortDescriptors, filtering via a DelegateFilterDescriptor, and grouping via PropertyGroupDescriptor. Does anyone have any suggestions?


Tony
Top achievements
Rank 1
 asked on 11 Jun 2019
1 answer
99 views

In my UWP program there is the potential that a very large number of lines may be drawn on the single chart. This can result in the Legend going down below the bottom of the app, cutting off the remaining items in the legend. This is basically an "excessive" example of the usage of this chart and I'm wanting to make sure it can function effectively when put under this kind of use. I have attached a snip of this chart.

Is there a way to add a scrollbar to the Legend Control so that a user can scroll through the legend? Or should I be looking at a different method for showing the legend?

Note: I am aware that the palette colours are repeating, that's next on my list to resolve.

Thanks for the help in advance.

Lance | Manager Technical Support
Telerik team
 answered on 28 May 2019
2 answers
69 views

G'day,

I have a Chart area that I am adding any number of Series to dynamically from a file that my program loads. This can be any number of Series, I've managed to load a file that drew more than 100 lines on my chart. This part of it has been working quite well and it must be done dynamically due to loading the data from a file (I cannot think of another way to do it, at least).

In cleaning it up and adding a few nicer features to it, I am looking at adding a Legend for the chart.

I followed the guides from the Legend Control page and I was able to successfully add a Legend for my graph. However the Legend's colour set does not match my Chart's (DefaultDark at the moment for testing).

The XAML code for my chart is as follows:

<telerikChart:RadCartesianChart x:Name="MainChart" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,10,10" PaletteName="DefaultDark" Grid.Column="1">
    <telerikChart:RadCartesianChart.Grid>
        <telerikChart:CartesianChartGrid MajorLinesVisibility="XY"/>
    </telerikChart:RadCartesianChart.Grid>
    <telerikChart:RadCartesianChart.Behaviors>
        <telerikChart:ChartPanAndZoomBehavior ZoomMode="Both" PanMode="Both"/>
        <telerikChart:ChartTrackBallBehavior InfoMode="Multiple">
            <telerikChart:ChartTrackBallBehavior.LineStyle>
                <Style TargetType="Polyline">
                    <Setter Property="Stroke" Value="Tomato"/>
                    <Setter Property="StrokeThickness" Value="2"/>
                    <Setter Property="StrokeDashArray" Value="1,2"/>
                </Style>
            </telerikChart:ChartTrackBallBehavior.LineStyle>
            <telerikChart:ChartTrackBallBehavior.IntersectionTemplate>
                <DataTemplate>
                    <Ellipse Width="10" Height="10" Fill="Tomato"/>
                </DataTemplate>
            </telerikChart:ChartTrackBallBehavior.IntersectionTemplate>
        </telerikChart:ChartTrackBallBehavior>
    </telerikChart:RadCartesianChart.Behaviors>
    <telerikChart:RadCartesianChart.VerticalAxis>
        <telerikChart:LinearAxis x:Name="Vertical" Title="Pressure (kPa)" Minimum="0"/>
    </telerikChart:RadCartesianChart.VerticalAxis>
    <telerikChart:RadCartesianChart.HorizontalAxis>
        <telerikChart:LinearAxis x:Name="Horizontal" Title="Depth (mm)"/>
    </telerikChart:RadCartesianChart.HorizontalAxis>
</telerikChart:RadCartesianChart>

 

And to add in the LegendControl:

<telerikPrimitives:RadLegendControl x:Name="LegendForChart" LegendProvider="{Binding ElementName=MainChart}"/>

 

For some reason the items in the Legend are always blue instead of matching the colours from the Palette/matching the colours from each Series on the Chart.

What am I missing that could make these colours line up appropriately? Any help would be appreciated.

This is the code that adds the series to the chart, if needed.

ScatterLineSeries scatterLineSeries = new ScatterLineSeries
{
    ItemsSource = graphData,
    XValueBinding = new PropertyNameDataPointBinding("Depth"),
    YValueBinding = new PropertyNameDataPointBinding("Pressure"),
    DisplayName = $"G:{groupNumber} I:{insertionNumber}",
    LegendTitle = $"G:{groupNumber} I:{insertionNumber}",
};
 
MainChart.Series.Add(scatterLineSeries);
Chris
Top achievements
Rank 1
 answered on 27 May 2019
2 answers
75 views
Hello,

For more than a decade, an ImageSource accepts an URL to load an image on the fly. Windows has its own caching system.

In our app, we have a way to download all the images needed into disk, so if the system is disconnected from the Internet, we could continue to load images.

Challenge: I haven't found a way to load an image on the fly with the source being an image on disk. One part of the issue is a Converter does not accept async methods.

Thanks
Sébastien
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 14 May 2019
1 answer
46 views

Hi,

I have some rather special display requirements on data in my RadDataGrid.  While I'd love to let RadDataGrid handle the sorting I think I need to populate the grid in the order I'd like.

My question is can I detect via an event or something when a user changes the sort and direction on a particular column?  If so... how?

Yana
Telerik team
 answered on 13 May 2019
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?