Telerik Forums
UI for WPF Forum
3 answers
270 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.7K+ 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.4K+ 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
909 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
103 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
166 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
117 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
326 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
7 answers
780 views

Hi,

Below is my code snippet for RadComboBox that I am using:

<telerik:RadComboBox ItemsSource="{Binding xyz}"
                                                     IsEnabled="False"
                                                     IsEditable="False"
                                                     HorizontalAlignment="Stretch"
                                                     SelectedIndex="1" 
                                                     Width="Auto">

When I apply the below style to change foreground color when disabled, it is not working:

<telerik:RadComboBox.TextBoxStyle>
                                                        <Style TargetType="TextBox">
                                                            <Style.Triggers>
                                                                <Trigger Property="IsEnabled" Value="False">
                                                                    <Setter Property="Foreground" Value="Gray" />
                                                                </Trigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </telerik:RadComboBox.TextBoxStyle>

 

This trigger only works when I set IsEditable-"True" and IsFilteringEnabled="True"

 

Is there any way that I can change the font color even when IsEditable-"False"?

 

Thanks,

Aanchal

Martin Ivanov
Telerik team
 answered on 05 Jan 2021
8 answers
348 views

In order to make the Slider handles "active" I have to click on a selection Thumb (start or end) then the handles become active and I can user them to increase/decrease incrementally.

Is this "by design"?  If so, is there a way to prevent this default behavior and always have the Handles "active" (clickable)?

Cheers, Rob.

Martin Ivanov
Telerik team
 answered on 05 Jan 2021
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?