Telerik Forums
UI for WPF Forum
1 answer
153 views

Hi,

I want to change the color of the hours,

I tried to change the Foreground in TimeRulerItem but it does not change my color.

I would love to help,

Thanks.

 

 

 

   <Style TargetType="telerik:TimeRulerItem">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="0 1 0 0"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Panel.ZIndex" Value="50"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:TimeRulerItem">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                        <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
Stenly
Telerik team
 answered on 27 Dec 2021
4 answers
521 views

Dear Team,

Im kinda new in WPF, i switched from winform ~a year ago. I have to move one of my old projects from winform to WPF (VB.NET), and as i see the basic gridview is not too good, so im about to buy the radgridview from Telerik.

Im trying, and i cant solve one thing:

I have a 'datatable', which is passed to the radgridview as itemsource. The columns are partnumbers the rows are dates, and both are dynamic - i mean the number of both them are dynamic - so i cannot pre-define them, in the xaml, but i need to change the backgorund color for some cell, and the triggers can be several kind:

 - If cell was edited

 - If cell value < 0  

 - triggers which doenst depend on the data in the grid, comes from other datadatable, but i know which column and row has to be changed.  

 

Since virtualization is ON for rows and columns as well, if i just set the background color of the cell, and scroll away, the color disappears.

My approach (probably wrong):

--------------------------------------------------------------------

      Dim myDataGridRow As Telerik.Windows.Controls.GridView.GridViewRow = CType(dgw_FG.ItemContainerGenerator.ContainerFromItem(dgw_FG.Items(1)), Telerik.Windows.Controls.GridView.GridViewRow)
         Dim G As Telerik.Windows.Controls.GridView.GridViewCell = myDataGridRow.Cells(4)
        G.Background = New SolidColorBrush(Colors.Blue)

--------------------------------------------------------------------

Is there a way to recolor a cell background/foreground knowing only the X/Y coordinate of the filed on vb-code-side?

I suffered 3 days with this question, reading a lot of threads here... but i stuck. An example code would make me happy ;)

Thank you for your answer !!!

 

Peter B (Hungary)

 

Peter
Top achievements
Rank 1
Iron
Iron
 updated answer on 27 Dec 2021
1 answer
320 views

How can I use different colors for positive and negative values?

This is my XAML Code:

                    <telerik:RadCartesianChart x:Name="DashboardChart" FontSize="{telerik:FluentResource ResourceKey=FontSizeS}">
                        <telerik:RadCartesianChart.HorizontalAxis>
                            <telerik:CategoricalAxis />
                        </telerik:RadCartesianChart.HorizontalAxis>
                        <telerik:RadCartesianChart.VerticalAxis>
                            <telerik:LinearAxis LabelInterval="5"/>
                        </telerik:RadCartesianChart.VerticalAxis>
                        <telerik:RadCartesianChart.Series>
                            <telerik:BarSeries x:Name="DashboardChartBarSeries" ValueBinding="Difference" >
                            </telerik:BarSeries>
                        </telerik:RadCartesianChart.Series>
                    </telerik:RadCartesianChart>

The data binding is done in the C# code:

this.DashboardChartBarSeries.DataContext = _localViewModel.Document;
 The values are displayed correctly. I would like to display negative values in red and positive values in green. How can I implement this?
Stenly
Telerik team
 answered on 27 Dec 2021
1 answer
332 views

Hello!

I'm working with the RadMaskedNumericInput for the first time (first time using masked inputs at all) and am in need of advice. I want to have the control's value be set to a default value if the user were to clear the control's input, then remove the focus.

I have the control set up like so:

<telerik:RadMaskedNumericInput x:Name="txtDaysValid" Width="30" Value="30"
                               Mask="d2" TextMode="PlainText" InputBehavior="Insert"
                               maskedInput:MaskedInputExtensions.Minimum="1"
                               UpdateValueEvent="LostFocus"
                               LostFocus="txtDaysValid_LostFocus"/>

And the event handler is:

var numericInput = sender as RadMaskedNumericInput;

if (string.IsNullOrWhiteSpace(numericInput.Text))
{
    numericInput.Value = 30;
    numericInput.Text = numericInput.Value.ToString();
}

This is the behaviour I'm currently experiencing:

  • Control Reads 30 -> User sets blank -> Control Reads blank (incorrect)
  • Control Reads 30 -> User sets to 12 -> Control Reads 12 -> User sets blank -> Control reads 30 (correct)
  • Control Reads 30 -> User sets to 12 -> Control Reads 12 -> User sets blank -> Control reads 30 -> User sets blank -> Control reads blank (incorrect)
  • Control Reads Blank -> User sets to 1 -> Control Reads 1 -> User sets blank -> Control Reads blank (incorrect)
  • Control Reads Blank -> User sets to 21 -> Control Reads 21 -> User sets blank -> Control Reads 30 (correct)

What am I missing here? It appears that updating the value and text directly only works in some cases. Is there a better approach to ensuring that when the user clears the input's field, that it defaults to a specific value upon losing focus?

Thanks!

Stenly
Telerik team
 answered on 27 Dec 2021
0 answers
126 views

Dear Support,

I noticed one strange thing with radgridview, under WPF (see the screenshot below)

This is a complex production planner screen, and as far as i just click the cells with mouse it works perfectly. But when i use the arrow keys to navigate between cells two thing can happen:

1. If i push less frequently the actual cell switches without problem.

2. If i push quicker, or if i hold the button the grid leaves random selected cells behind.

There are a few things in the SelectedCellsChanged event, which runs in ~200ms. This 200ms is mostly an SQL query, i run it each time to fill some other fields based on the selected cell. As i guess: if i switch faster than this, the bug appears, if i select slower than this, then it switches the cell without any problem. 

Do you have any advice how can i solve this? I tried to put .unselectall after each, but it just made it worse.

Thanks

Peter

 

 

Peter
Top achievements
Rank 1
Iron
Iron
 asked on 25 Dec 2021
1 answer
962 views

Dear Support

I use radgridview in WPF (vb.net), and i spent deays already to figure out how to get the index of the current row.

If the SelectionUnit = Fullrow then its easy, because:

     Dim CurrentRow As Integer = rgv_STATIONS.Items.IndexOf(rgv_STATIONS.SelectedItem)

will give it back . But unfortunately i have to use SelectionUnit = Cell. With this setting the above CurrentRow variable always gets -1.

I need to know it in case of CellEditEnded and at SelectedCellsChanged events. Getting the column index in the same places is easy, but please help me to find the rowindex as well, i lost half of my hair already due to this :)

 

Thank you

Peter

Petar Mladenov
Telerik team
 answered on 24 Dec 2021
0 answers
178 views

Hi 

I Found Gridview bug.

A phenomenon in which a blank row appears in the gridview when the database of the same index is called.
The itemsource of gridview uses observablecollection and is loaded from database. If data of the same index is loaded, it is broken. Attach pictures
Kyuha
Top achievements
Rank 1
 asked on 24 Dec 2021
1 answer
193 views

Hi,

I am using the RadRadialMenu to navigate a dynamically built structure (arbitrary depth, arbitrary width) - I know the width can become an issue as item sectors can become very small, but this is contained.

It works really great and the users love it, but each time the menu refreshes it eats up memory that does not get released again.

If I strip out the actual building of the RadialMenuItems (custom class RadialMenuItemVM that implements IRadialMenuItem) then there is no build-up of memory.

I have created a small demo app that resembles the full app but with a very limited structure and content. On refreshing the menuitems the memory usage in VisualStudio diagnostic session starts to grow. With the limited size of the structure, the memory growth is slow, but it is definitely noticeable after a number of refreshes.

The one thing that I did notice is that the destructor of the RadialMenuItemVM instances only gets called upon closing the window. There seems to be a sticky reference that keeps them alive until the actual radial menu is destroyed.

Sample Project attached. Note that I have removed Telerik lib contents to reduce size so references might require updating

Dilyan Traykov
Telerik team
 answered on 23 Dec 2021
1 answer
518 views
I am working on Conversational UI and made a chat application , where we can chat with multiple users by maintaining a dictionary .&nbsp; Key is the user and value is the ChatViewModel having a ObservableCollection&lt;MessageBase&gt; and Author. Its is working properly but I want to store the messages in the database and When we select another to chat with , the previous messages stored in database will be display in the chatwindow and we can continue chatting. &nbsp; <br />
Martin Ivanov
Telerik team
 answered on 23 Dec 2021
1 answer
638 views

Hello,

In my application I try to change the colors from Fluent theme globaly. Unfortunately it seems my changes are ignored. I'm wondering what I'm doing wrong.

To exclude any side effect related to my application I created a new WPF program (.Net Core 5) that just contains a Splash screen and a NavigationView to check if the theme settings are applied. Source code of this test program is attached.

Steps I did to change the theme:

1: I set Fluent theme as the theme of the application (according to Setting a theme using stylemanager). This works fine. Splashscreen and NavigationView appear in Fluent theme.

2: I used color theme generator (Color theme generator) to adapt the colors and copied generated code to clipboard. Pasted the code next to theme setting from 1 (tried both, before and after setting theme)

The settings are done in App.xaml.cs. My test change to Fluent theme is that I change every color to red. When I execute the program, Fluent theme looks normal (blue color, See screenshots). My expectation was that I see a lot of red.

This is the code how I try to adapt the theme:

namespace TelerikStyle
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Set the theme
            SetTheme();

            // Show dummy splash screen
            var dataContext = (SplashScreenDataContext)RadSplashScreenManager.SplashScreenDataContext;
            dataContext.Content = "Loading Application";
            dataContext.Footer = "";
            RadSplashScreenManager.Show();
            Thread.Sleep(5000);
            RadSplashScreenManager.Close();
        }

        private void SetTheme()
        {
            StyleManager.ApplicationTheme = new FluentTheme();

            FluentPalette.Palette.AccentColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AccentFocusedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AccentMouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AccentPressedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.AlternativeColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.BasicColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.BasicSolidColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ComplementaryColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.IconColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MainColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MarkerColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MarkerInvertedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MarkerMouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.MouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PressedColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PrimaryBackgroundColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PrimaryColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.PrimaryMouseOverColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ReadOnlyBackgroundColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ReadOnlyBorderColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.ValidationColor = (Color)ColorConverter.ConvertFromString("#FFFF0000");
            FluentPalette.Palette.DisabledOpacity = 0.3;
            FluentPalette.Palette.InputOpacity = 0.6;
            FluentPalette.Palette.ReadOnlyOpacity = 0.5;
        }
    }
}

 

Any ideas what I miss?

Thanks and Regards

Philipp

Martin Ivanov
Telerik team
 answered on 22 Dec 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?