Telerik Forums
UI for WPF Forum
2 answers
187 views

Hi there, I am using a radgridview and want to allow users to select a format for data within columns, testing this for dates I noticed that it wasn't working for expression columns that contain a string representation of the data rather than a type such as DateTime, if I make one using Now() or Today() the format string does appear to work, is there a way to parse data in an expression column into a datatype?

Jack
Top achievements
Rank 1
 answered on 12 Jan 2021
9 answers
291 views

Hello. I used the sample provided by the SDK. (GridView - Group Selecction)

There was a problem with group sorting.

 

Please check the image for details.

 

 

In sdk Source (MyBehavior.cs) ======================================

private IEnumerable<object> GetSubGroupItems(IGroup gr)
{
if (!gr.HasSubgroups)   ★ <<<< This alert  (System.NullReferenceException: Object reference not set to an instance of an object.)
{
return gr.Items.OfType<object>();
}
else
{
List<object> items = new List<object>();
foreach (var subGr in gr.Subgroups)
{
items.AddRange(GetSubGroupItems(subGr));
}
return items;
}
}

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

 

I want to sort by header group. Could you solve it?

Thanks.

 

Martin Ivanov
Telerik team
 answered on 11 Jan 2021
3 answers
248 views

Hi,

i have a RadComboBox where the ItemsSource is bound to a list of strings, the Text to a String and where IsEditable is true.

When setting the Text (in viewmodel) to a value, which is not included in the list of strings, it shows the "suggested" text (like when i enter it manually in the box), not the text which was set.This occurs when the viewmodel value is set delayed (not in ctor).

Here is a small sample code.

MainWindow.xaml

<Window x:Class="TelerikCombobox.MainWindow"
        xmlns:local="clr-namespace:TelerikCombobox"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <StackPanel Margin="3">
            <telerik:RadComboBox Text="{Binding SelectedValue, Mode=TwoWay}" ItemsSource="{Binding SuggestedValues}" IsEditable="True"/>
            <TextBlock Text="{Binding SelectedValue, Mode=OneWay}"/>
        </StackPanel>
    </Grid>
</Window>

 

MainWindow.cs

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
 
        this.DataContext = new ViewModel()
        {
            SuggestedValues = new String[] { "100", "200", "300" },
        };
 
        SetValueDelayed();
    }
 
    private async void SetValueDelayed()
    {
        await Task.Delay(2000);
        if (this.DataContext is ViewModel viewModel)
            viewModel.SelectedValue = "3";
    }
}

 

ViewModel.cs

public class ViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
 
        private String m_SelectedValue;
        public String SelectedValue
        {
            get
            {
                return m_SelectedValue;
            }
            set
            {
                m_SelectedValue = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedValue)));
            }
        }
 
        private IEnumerable<String> m_SuggestedValues;
        public IEnumerable<String> SuggestedValues
        {
            get
            {
                return m_SuggestedValues;
            }
            set
            {
                m_SuggestedValues = value;
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SuggestedValues)));
            }
        }
    }

 

After the value "3" is set, the combobox shows 300.

 

Thanks

 

Dilyan Traykov
Telerik team
 answered on 11 Jan 2021
6 answers
2.5K+ views

Hi,

I have this very simple style for my RadMaskedNumericInput control

<Style TargetType="telerik:RadMaskedNumericInput">
    <Setter Property="SelectionOnFocus" Value="SelectAll"/>
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="True">
            <Setter Property="Background" Value="Green"/>
        </Trigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Background" Value="Red"/>
        </Trigger>
        <Trigger Property="IsFocused" Value="True">
            <Setter Property="Background" Value="Yellow"/>
        </Trigger>
        <Trigger Property="IsReadOnly" Value="True">
            <Setter Property="Background" Value="Gray"/>
        </Trigger>
    </Style.Triggers>
</Style>

 

Everything works fine except when the control receives focus, the background color does not change (remains green).  How come ?

Kind Regards,
Hans

Hans
Top achievements
Rank 1
Veteran
 answered on 11 Jan 2021
5 answers
1.3K+ views
Hi,

When I have dynamically added a new column to RadGridView which type is GridViewCheckBoxColumn

radGridView1.Columns.Add(new GridViewCheckBoxColumn() { DataMemberBinding = new Binding("HasOrders"), UniqueName = "HasOrders3", Header = "Has Orders3"
    , AutoSelectOnEdit = true
    , EditTriggers = GridViewEditTriggers.Default | GridViewEditTriggers.CellClick
});

I will get the cheched status from CellEditEnded - event

private void radGridView1_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
    if (e.Cell.Column.UniqueName == "HasOrders3")
    {
        textBox3.Text = ((CheckBox)e.EditingElement).IsChecked.ToString();
    }
}

But this CellEditEnded - event triggers only when I leave the cell or press enter/tab key.

If I stay on that cell and click the checkbox I cannot catch the cheched change event? How can I do that in?

Regards,
Auvo

Martin Ivanov
Telerik team
 answered on 11 Jan 2021
3 answers
822 views

How do I have to configure the RadMaskedNumericInput Control so that:

1. the user can enter any decimal number with any precision, with or without a decimal separator, positive or negative 

2. no mask placeholders or literals are visible (no _ and a the decimal separator only visible when the user actually entered one)

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 08 Jan 2021
2 answers
89 views

The style for my RadWindows is not being overriden from the default theme. I don't have the same issue with other telerik controls like RadButton, the style gets set fine for them. Why is this happening? How can I set a RadWindow style?

MyWindow.xaml

<telerik:RadWindow
    x:Class="MyWindow"
    Header="My Window"
    <Grid>
     // window content
            <telerik:RadButton
                Content="OK" />
            <telerik:RadButton
                Content="Cancel" />
        </StackPanel>   
    </Grid>
</telerik:RadWindow>

 

 

My App.Xaml file contains MergedDictionaries

<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Telerik/RadButton.xaml" />
        <ResourceDictionary Source="pack://application:,,,/Telerik/RadWindow.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

 

Here are the individual xaml files

RadWindow.xaml

<ResourceDictionary
 
    <Style TargetType="{x:Type telerik:RadWindow}">
        <Setter Property="Background"
                Value="Green" />
    </Style>
</ResourceDictionary>


RadButton.xaml

<ResourceDictionary
     
    <Style TargetType="{x:Type telerik:RadButton}">
        <Setter Property="Background"
                Value="Blue" />
 
    </Style>
</ResourceDictionary>

 

 

YBOT
Top achievements
Rank 1
Veteran
 answered on 07 Jan 2021
4 answers
152 views

 Hello,

In my application I need to update the ItemsSource every few seconds, I would like to know what would be the best way to perform this.

I might have up to 600 items divides

I have an ObervableCollection object, every time I receive new data I clear the ObervableCollection object and then I add the new data, something like this:
 

ObservableCollection<myData> myCollection = new ObservableCollection<myData>();
  
// Format the data the way I need it
  
myCollection.Clear();
  
foreach (myObject item in DataObject)
{
  myCollection.Add(new myData()
    {
        property1 = item.property1,
        property2 = item.property2,
        property3 = item.property3
        // Operations for other properties
 
    });
}

I wonder if it would be better to update my ObervableCollection object (update existing items, add the new ones, and delete those that no longer exist) than clear and add all again.

What I want to achieve is to reduce the rendering time.

I hope you can give me some advice.

Thanks in advance,

Alberto

 

 

 

Martin Ivanov
Telerik team
 answered on 07 Jan 2021
1 answer
100 views

Hi,

I have populated the MultiColumnComboBox DropDown Items using a DataTable

I would like to preselect the SelectedItems onload, so that they are hilited in the DropDown Box, and the corresponding Display-values are shown in the select textbox.

Adding DataRows to the SelectedItems property seams to do the trick for the DropDown List, but the values are not shown in the select textbox.

How do I trigger the select textbox to be filled (with multible values)? 

/Brian

 

 

 

 

Vladimir Stoyanov
Telerik team
 answered on 07 Jan 2021
5 answers
303 views

Hello.

 

I found something unknown while using the hierarchical menu.

Click the hierarchical menu and click the ESC or menu to hide the hierarchical menu.

I made it short as a gif, but I hope it helps you understand.

Attach the source. What is the problem.

Xaml

<Grid>
        <Grid.Resources>
            <telerik:StringToGlyphConverter x:Key="StringToGlyphConverter" />
            <Style x:Key="BaseNavigationViewItemStyle" TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource RadNavigationViewItemStyle}">
                <Setter Property="DisplayMemberPath" Value="Title" />
                <Setter Property="Icon" Value="{Binding Glyph}" />
                <Setter Property="IconTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <telerik:RadGlyph Glyph="{Binding Converter={StaticResource StringToGlyphConverter}}" />
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
 
            <Style x:Key="NavigationSubItemStyle" TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource BaseNavigationViewItemStyle}">
                <Setter Property="IconVisibility" Value="Collapsed" />
            </Style>
        </Grid.Resources>
 
        <telerik:RadNavigationView Grid.Row="1"
                                   CanKeyboardNavigationSelectItems ="True"
                                   CompactPaneWidth="60" 
                                   AutoChangeDisplayMode="False"
                                   DisplayMode="Expanded"
                                   DisplayMemberPath="Title"
                                   PaneHeader    ="{Binding Header, Mode=OneTime}"
                                   ItemsSource   ="{Binding Menu1}"
                                   SelectedItem  ="{Binding MenuItem1,  Mode=TwoWay}"
                                   >
            <telerik:RadNavigationView.ItemContainerStyle>
                <Style TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource BaseNavigationViewItemStyle}">
                    <Setter Property="ItemsSource" Value="{Binding SubItems}" />
                    <Setter Property="ItemContainerStyle" Value="{StaticResource NavigationSubItemStyle}" />
                </Style>
            </telerik:RadNavigationView.ItemContainerStyle>
 
 
            <telerik:RadNavigationView.Content>
                <ContentControl Content="{Binding ViewContent, Mode=TwoWay}"/>
            </telerik:RadNavigationView.Content>
 
        </telerik:RadNavigationView>
 
    </Grid>

 

ViewModel

private void Data()
        {
            var multiBatchView = new MultiBatchView();
            Menu1.Add(new navi
            {
                Glyph = "",
                Title = "Multi File Check",
                TypeUserControl = multiBatchView,
            });
 
            Menu1.Add(new navi
            {
                Title = "Settings",
                Glyph = "",
                TypeUserControl = null,
                SubItems = new ObservableCollection<navi>
                {
                    new navi
                    {
                        Title           = "Test",
                        TypeUserControl = null,
                    },
                    new navi
                    {
                        Title           = "Overlap",
                        TypeUserControl = optionOverlapView,
                    },
                    new navi
                    {
                        Title           = "Connection",
                        TypeUserControl = optionConnectionView
                    },
                    new navi
                    {
                        Title           = "Quality",
                        TypeUserControl = optionQualityView
                    },
                    new navi
                    {
                        Title           =  "Export/Import",
                        TypeUserControl = optionExportImportView
                    },
                }
            });
 
 
            MenuItem1 = Menu1.FirstOrDefault();
        }

 

Model

public class navi
{
    public string Glyph { get; set; }
 
    public string Title { get; set; }
 
    public UserControl TypeUserControl { get; set; }
 
    public ObservableCollection<navi> SubItems { get; set; }
}

 

 

Thanks.

 

Martin Ivanov
Telerik team
 answered on 06 Jan 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?