Telerik Forums
UI for Universal Windows Platform Forum
2 answers
128 views

the foreground property does not apply to the icon .. He has followed these steps:

https://docs.telerik.com/windows-universal/controls/raddatepicker-and-radtimepicker/styling/raddatetimepickers-explicitstyling

and it only takes the color indicated by the text and not the icon ..

This is my XAML code:

<Custom:RadDatePicker x:Name="FromDatePicker" HorizontalAlignment="Left" ValueChanged="DatePickerValueChange">
                    <Custom:RadDatePicker.Resources>
                        <Style TargetType="Custom:RadDatePicker">
                            <Setter Property="Foreground" Value="Orange"/>
                            <Setter Property="FontSize" Value="15"/>
                            <Setter Property="FontStyle" Value="Italic"/>
                            <Setter Property="Background" Value="Beige"/>
                            <Setter Property="BorderBrush" Value="Orange"/>
                        </Style>
                    </Custom:RadDatePicker.Resources>
</Custom:RadDatePicker>

the result is in the attached image ..

 

Milenny
Top achievements
Rank 1
 answered on 12 Mar 2019
2 answers
39 views

Hello,

If I place a RadDataGrid inside one grid, then move the RadDataGrid to another grid, the RadDataGrid quits responding to touch. Similarly (and this is what I'd like to do), if I have RadDataGrid inside a page inside a frame, then move the frame from inside one grid to another grid, the RadDataGrid locks up. The RadDataGrid still updates for changes to the item source, so the binding still works. I just lose the rollover highlighting effect, and I can't select anything. Is there a way to reactivate the RadDataGrid at this point or prevent it from going into this state while moving it?

Thanks!

Tyler

Tyler
Top achievements
Rank 1
 answered on 08 Mar 2019
2 answers
71 views

Hi there,

I'd like to know if you can use an ivalueconverter in a textcolumn, or if not, how you can use the filter menu of a textcolumn in a templatecolumn?
On a related note; can you also use a converter on the grouping header?

Bit of background, for further clarity:
I'm trying to create a program that displays a list of files, their names and things like their last edited dates.
As such my datasource is a list(fileinfo).
To display the filenames in a user friendly manner I'd like to trim the directorynames a bit.
I know how to do this using a templatecolumn, but then I lose the nice filtering menu that's built into the textcolumn. 

Lance | Manager Technical Support
Telerik team
 answered on 05 Mar 2019
3 answers
81 views

I want to add further command to the context menu that appears when right-clicking on the RadAutoCompleteBox.

When I add a context menu flyout it appears in addition to the default context menu ("Copy, Paste, …"). This is confusing for the end-user.

I found many articles handling this question. In many cases it was suggested to influence the visual structure. But this seems not to be possible with Telerik UI for UWP.

Is there any way to influence, or to abandon the default menu? It would also be an option for me just to show my context menu.

Thomas
Top achievements
Rank 1
 answered on 03 Mar 2019
3 answers
53 views

<telerikGrid:RadDataGrid x:Name="DataGrid" SelectionUnit="Row">
            <telerikGrid:RadDataGrid.Resources>
                <Style TargetType="gridPrimitives:SelectionRegionBackgroundControl">
                    <Setter Property="Background" Value="Red"/>
                    <Setter Property="BorderBrush" Value="Green"/>
                    <Setter Property="BorderThickness" Value="2"/>
                </Style>
            </telerikGrid:RadDataGrid.Resources>
        </telerikGrid:RadDataGrid>

 

this.DataGrid.ItemsSource = new List<Data>
 {
     new Data { Country = "India", Capital = "New Delhi"},
     new Data { Country = "South Africa", Capital = "Cape Town"},
     new Data { Country = "Nigeria", Capital = "Abuja" },
     new Data { Country = "Singapore", Capital = "Singapore" }
 };

 

public class Data
    {
        public string Country { get; set; }

        public string Capital { get; set; }
    }

 

When I select one row, the SelectionRegionBorder Control  doesn't work.

Yana
Telerik team
 answered on 26 Feb 2019
2 answers
95 views

Hi.

I'm trying to plot a function with numeric domain and image in an UWP app. For that I'm using RadCartesianChart and a LineSeries. I downloaded the TelerikUWP library from Nuget.

Both axes are LinearAxis, ItemsSource is an ObseravableCollection<SampleData>, where SampleData is a Class with two properties 1) double Value 2) int Category

the chart shows empty on screen

When I change the horizontal axis from linear to CategoricalAxis, the data shows, the LineSeries appears.

but I do not want that, because when the data is irregular spaced, the domain axis will be equally spaced. And that would not be correct.

for example if I want to show {0, 10},{1,5},{10,2}, the three points will be equally spaced in horizontal axis.

I also want to use Logarithmic axis in the horizontal axis, since I also need to show logarithmic curves (with 300 or more points)

Thanks in advance.

Leandro
Top achievements
Rank 1
 answered on 26 Feb 2019
2 answers
806 views

There are no components in "... .dll" that can be placed on the toolbox

The error happens after installing the package "Telerik.UI.for.UniversalWindowsPlataforms", from the Nuget package manager, which does not present the controls in the toolbox after restarting Visual Studio after the successful installation of the package and neither does it allow me to add them manually. I attach images of the installation and the corresponding error ..

Lance | Manager Technical Support
Telerik team
 answered on 11 Feb 2019
2 answers
67 views

Hi there,

I have a control in one of my UWP pages that is like a tree view for document viewing (some documents are tagged and are in folders and others are not).

This uses RadDataGrid with DataTemplates for when either a folder is selected or an actual document is selected.

It all works fine but when a row is selected I get an ugly grey background and blue border but I actually want no selection style whatsoever - no highlight, no border, no background so can you please let me know how to do this?  I have not included the code behind because it's not a selection or code issue  - it's just a styling issue.

Thanks,

Mike

    <Page.Resources>

....other code...

        <!-- Header item (folder) - this will show an appropriate open/closed folder icon and the folder name (the Tag property) -->

        <DataTemplate x:Key="HeaderItemTemplate"  x:DataType="models:BoardMiscItem">

            <Grid HorizontalAlignment="Stretch">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <Image Grid.Column="0" Source="{Binding FolderImage}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="1" Text="{Binding Tag}" Margin="10" TextWrapping="WrapWholeWords" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            </Grid>

        </DataTemplate>

<!-- Document item - this will show an status circle, the document name and last updated date -->
        <DataTemplate x:Key="HeaderItemTemplate"  x:DataType="models:BoardMiscItem">
        <DataTemplate x:Key="DocumentItemTemplate"
                      x:DataType="models:BoardMiscItem">

            <Grid HorizontalAlignment="Stretch">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="120"/>
                </Grid.ColumnDefinitions>

                <Border Grid.Column="0" CornerRadius="45" Height="15" Width="15" Margin="{Binding IndentAmount}"
                    HorizontalAlignment="Left" VerticalAlignment="Center">
                    <Border.Background>
                        <SolidColorBrush Color="{Binding StateColour}"/>
                    </Border.Background>
                </Border>
                
                <TextBlock Grid.Column="1" Text="{Binding DisplayName}" Margin="10" TextWrapping="WrapWholeWords"
                           HorizontalAlignment="Left" VerticalAlignment="Center"/>
                
                <TextBlock Grid.Column="2" Text="{Binding LastUpdatedDisplay}" Margin="0,10,0,10"
                           HorizontalAlignment="Left" VerticalAlignment="Center" />
            </Grid>
        </DataTemplate>

        <components:BoardMiscItemTemplateSelector x:Key="ItemTemplateSelector"
                                                  HeaderItemTemplate="{StaticResource HeaderItemTemplate}"
                                                  DocumentItemTemplate="{StaticResource DocumentItemTemplate}" />

        <Style x:Key="RadGridHiddenColumnHeader" TargetType="primitives:DataGridColumnHeader">
            <Setter Property="Visibility" Value="Collapsed"/>
        </Style>

    </Page.Resources>

<Grid>

<!--    other XAML content,  not included -->

                        <!-- Hand rolled Folder and document tree view control -->
                        <Grid Grid.Column="1">

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <!-- other XAML content here for Rows 0 and 1 -->
   
                            <grid:RadDataGrid x:Name="grdFilesList"
                                              Grid.Row="2"
                                              Grid.ColumnSpan="2"                                                                                       
                                              ItemsSource="{Binding DisplayData}"
                                              SelectionMode="Single"
                                              AutoGenerateColumns="False"
                                              UserGroupMode="Disabled"
                                              UserFilterMode="Disabled"
                                              UserColumnReorderMode="None"                          
                                              GridLinesVisibility="None"
                                              BorderThickness="1"
                                              Visibility="Visible"                          
                                              SelectionChanged="grdFilesList_OnSelectionChanged">

                                <grid:RadDataGrid.Columns>

                                    <grid:DataGridTemplateColumn HeaderStyle="{StaticResource RadGridHiddenColumnHeader}"
                                                                 CellContentTemplateSelector="{StaticResource ItemTemplateSelector}"/>

                                </grid:RadDataGrid.Columns>
                </grid:RadDataGrid>

  </Grid>

 

Mike
Top achievements
Rank 1
 answered on 01 Feb 2019
0 answers
69 views

Hello,

In my datagrid, I use a custom DataTemplate for one of my (autogenerated) columns:

 

01.Public Class CustomGenerateColumnCommand
02.    Implements ICommand
03. 
04.    Public Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
05. 
06.    Public Sub Execute(parameter As Object) Implements ICommand.Execute
07.        Dim context As GenerateColumnContext = CType(parameter, GenerateColumnContext)
08.        If context.PropertyName = "myColumnName" Then
09.            Dim c As New DataGridTemplateColumn
10.            c.CellContentTemplate = CType(XamlReader.Load("" &
11.                "<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""  xmlns:common=""using:MyNS.Converters"">" &
12.                    "<Grid Background=""{Binding StatusColor}"">" &
13.                        "<Grid.ColumnDefinitions>" &
14.                            "<ColumnDefinition Width=""70""/>" &
15.                            "<ColumnDefinition Width=""220"" /> " &
16.                        "</Grid.ColumnDefinitions>" &
17.                            "<TextBlock Text=""{Binding Title}"" Style=""{StaticResource SubtitleTextBlockStyle}"" TextTrimming=""CharacterEllipsis"" Height=""20""  FontSize=""16""/>" &
18.                    "</Grid>" &
19.                "</DataTemplate>"), DataTemplate)
20.            c.Name = "myColumnName"
21.            context.Result = c
22.        End If
23.    End Sub
24. 
25.    Public Function CanExecute(parameter As Object) As Boolean Implements ICommand.CanExecute
26.        'exclude those properties
27.        Dim context As GenerateColumnContext = CType(parameter, GenerateColumnContext)
28.        Return context.PropertyName <> "StatusColor" And context.PropertyName <> "Title"
29.    End Function

The above works perfectly. Both properties StatusColor and Title are used in one custom formatted cell.

My questions:

  • I have been unable to use a binding converter to modify the appearance of the data to be displayed

For example like this:

<Grid Background="{Binding StatusColor, Converter={StaticResource myColorConverter}}">

Having myColorConverter well defined and accessible in myNS.Converters. I have tried to add the static resource in the DataTemplate, or in the grid resources or even in the top page xaml resources, but each time I get "resource could not be found". 

How can I use a Binding Converter in this situation ?

 

  • I have been unable to attach an event to any of the template's Element. The goal is to navigate to a new frame of the application when the user taps the generated cell above.

For example like this:

<TextBlock Text="{Binding Title}"  Tapped="myTxt_Tapped" x:Name="myTxt" />

My code behind would of course contain an event handler like this:

Private Sub myTxt_Tapped(sender As Object, e As TappedRoutedEventArgs)
'navigate to nextPage
End Sub

But that never gets fired. And I would expect it to fail anyway because my grid has multiple rows and thus I get multiple times the same TextBlock name ; meaning I need to attach an event handler, but how, and at which moment in the page lifecycle ?

I have also tried to use the CellTap DataGridCommand, but when I use 

Public Overrides Sub Execute(parameter As Object)
    Dim context = CType(parameter, DataGridCellInfo)
    If context.Column.Name = "myColumnName" Then
        Dim dob As myObject= CType(context.Item.myColumnName, myObject)
        CType(Window.Current.Content, Frame).Navigate(GetType(nextPage), dob)
    End If
End Sub

the last line throws a Memory Violation Exception.

How can I register an event ? How can I navigate to a new frame ?

 

Thanks for any help

Julien

 

Julien
Top achievements
Rank 1
 asked on 31 Jan 2019
0 answers
43 views

I have the following RadDataGRid which is bound to a collection ('DisplayItems') of an abstract class 'AgendaItem' which can show different types of inherited objects and one of these is called a VoteAgendaItem which needs to pop up a flyout on selection (see bottom of XAML).  The problem is that I also need to have a SelectionChanged event handler to control various aspects of the grid but as soon as I added the handler it stopped the Vote flyout from happening (as the handler has now obviously handled the event) so how can I both handle the selection event but allow a VoteAgendaItem instance to be shown in the flyout?

 

        <Grid:RadDataGrid x:Name="agendaDataGrid"                            
                            Margin="48,0,48,24"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            ItemsSource="{x:Bind ViewModel.DisplayItems, Mode=OneWay}"
                            UserGroupMode="Disabled"
                            UserFilterMode="Disabled"
                            UserColumnReorderMode="None"
                            UserSortMode="None"
                            AutoGenerateColumns="False"
                            GridLinesVisibility="Horizontal"
                            BorderBrush="Transparent"
                            BorderThickness="0"
                            SelectionChanged="AgendaDataGrid_SelectionChanged"
                            SelectedItem="{x:Bind ViewModel.SelectedAgendaItem, Mode=TwoWay}"                             
                            LayoutUpdated="OnLayoutUpdated">

            <Grid:RadDataGrid.Columns>

                <!-- Read state of item -->
                <Grid:DataGridTemplateColumn SizeMode="Auto"     
                                             CellDecorationStyleSelector="{StaticResource BackgroundSelector}"
                                             CellContentTemplateSelector="{StaticResource ReadStateItemTemplateSelector}">

                    <Grid:DataGridTemplateColumn.Header>
                        <Border CornerRadius="45"
                                Background="{ThemeResource SystemControlDisabledChromeDisabledLowBrush}"
                                Height="10"
                                Width="10"
                                HorizontalAlignment="Center" />
                    </Grid:DataGridTemplateColumn.Header>
                </Grid:DataGridTemplateColumn>

                <!-- Item position -->
                <Grid:DataGridNumericalColumn Header="#"
                                              PropertyName="PositionString"                                                  
                                              SizeMode="Auto"
                                              CellDecorationStyleSelector="{StaticResource BackgroundSelector}"/>

                <!-- Download status -->
                <Grid:DataGridTemplateColumn SizeMode="Auto"
                                             CellContentTemplateSelector="{StaticResource DownloadAgendaItemTemplateSelector}"
                                             CellDecorationStyleSelector="{StaticResource BackgroundSelector}">
                    <Grid:DataGridTemplateColumn.Header>
                        <TextBlock FontFamily="{ThemeResource SymbolThemeFontFamily}"
                                    Text="&#xE896;" />
                    </Grid:DataGridTemplateColumn.Header>
                </Grid:DataGridTemplateColumn>

                <!-- Item name -->
                <Grid:DataGridTextColumn x:Name="ItemNameColumn"
                                         Header="Item name"
                                         PropertyName="Name"
                                         SizeMode="Stretch"            
                                         CellDecorationStyleSelector="{StaticResource BackgroundSelector}"
                                            />
         <!-- other grid columns not shown -->

            </Grid:RadDataGrid.Columns>

            <!-- Flyout for VoteAgendaItem which should show when item is selected -->
            <FlyoutBase.AttachedFlyout>
                <Flyout Placement="Full"
                        FlyoutPresenterStyle="{StaticResource VoteFlyoutPresenterStyle}">
                    <Grid Width="430">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <TextBlock TextWrapping="Wrap"
                                    Text="{x:Bind ViewModel.SelectedVoteItem.VoteTitle, Mode=OneWay}" />
                        <TextBlock TextWrapping="Wrap"
                                    Text="{x:Bind ViewModel.SelectedVoteItem.VoteDescription, Mode=OneWay}"
                                    Grid.Row="1" />
                        <ListView Grid.Row="3"
                                    ItemsSource="{x:Bind ViewModel.SelectedVoteItem.VoteOptions, Mode=OneWay}"
                                    ScrollViewer.VerticalScrollBarVisibility="Disabled" />
                    </Grid>
                </Flyout>
            </FlyoutBase.AttachedFlyout>          
            
            <Interactivity:Interaction.Behaviors>
                <Core:DataTriggerBehavior ComparisonCondition="NotEqual"
                                            Binding="{x:Bind ViewModel.SelectedVoteItem, Mode=OneWay}">
                    <components:OpenFlyoutAction TargetObject="{x:Bind agendaDataGrid, Mode=OneWay}" />
                </Core:DataTriggerBehavior>
            </Interactivity:Interaction.Behaviors>
            
        </Grid:RadDataGrid>

 

      //We need this here to prevent a disabled or downloading item (row) from being selectable.
        //Also if the selected row is a header then call the ViewModel method to add or remove sub items.
        private async void AgendaDataGrid_SelectionChanged(object sender, DataGridSelectionChangedEventArgs e)
        {
            //NOTE: DataGrid is in single selection mode. If using multiple selection, you need to iterate over e.AddedItems.
            if (e?.AddedItems?.FirstOrDefault() is AgendaItem selectedItem)
            {
                if (selectedItem.IsDownloading)
                {
                    //The item is still downloading so do not let it be selected.
                    agendaDataGrid.SelectedItems.Remove(selectedItem);
                }
                else if (!selectedItem.Enabled)       
                {
                    //User does not have permission to view item
                    //TODO: If we don't need this message then add check to the IsDownloading check above
                    await Dialogs.ShowMessage("You do not have permission to view the selected agenda item");
                    
                }
                else if (selectedItem is HeaderAgendaItem)
                {
                    //The item is a header so call VM method to add or remove sub items as necessary.
                    ViewModel.UpdateSubItemsForHeader(selectedItem as HeaderAgendaItem);
                }                
            }
        }

Mike
Top achievements
Rank 1
 asked on 30 Jan 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
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?