Hi,
I am trying to change the theme through telerik StyleManager.Theme.
Not apply :
<mynumeric:MyNumeric x:Name="TEST" Margin="-2,0,0,0"
Value="{Binding ViewModel.SerialNumber,Mode=TwoWay}"
ValueFormat="Numeric"
NumberDecimalDigits="0"
Minimum="1" Maximum="9999"
telerik:StyleManager.Theme="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.CurrentTheme),Converter={StaticResource ThemeToTelerikThemeConverter}}"
IsReadOnly="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.IsManagerAccess),Converter={StaticResource InverseBooleanConverter}}"
>
Apply :
<telerik:RadNumericUpDown x:Name="TEST" Margin="-2,0,0,0"
Value="{Binding ViewModel.SerialNumber,Mode=TwoWay}"
ValueFormat="Numeric"
NumberDecimalDigits="0"
Minimum="1" Maximum="9999"
telerik:StyleManager.Theme="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.CurrentTheme),Converter={StaticResource ThemeToTelerikThemeConverter}}"
IsReadOnly="{Binding Path=(mainwindowviewmodel:MainWindowViewModel.IsManagerAccess),Converter={StaticResource InverseBooleanConverter}}"
>
public class MyNumeric : RadNumericUpDown
{
public override string FormatDisplay()
{
if (this.Value.HasValue)
{
return this.Value.Value.ToString("0000");
}
return base.FormatDisplay();
}
public override string FormatEdit()
{
if (this.Value.HasValue)
{
return this.Value.Value.ToString("0000");
}
return base.FormatEdit();
}
}
internal class ThemeToTelerikThemeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!Enum.IsDefined(typeof(Wpf.Ui.Appearance.ThemeType), value))
throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum");
switch (value)
{
case Wpf.Ui.Appearance.ThemeType.Light:
return "Office2019";
case Wpf.Ui.Appearance.ThemeType.Dark:
return "Expression_Dark";
default:
return "Office2019";
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
I'll appreciate any help.
Hello everyone,
on my WPF application I have to use a WizardPages component to make a configuration. These configuration (and the relative pages) may changes based on a combobox item selectable on the first WizardPage (a page in common for all configurations).
My question is.... It's possible to add WizardPages dynamically based on the selection on the combobox of first page?
Thank you
Hi,
I have this code and i do not know how to bind to a view model command when i check a checkbox or when i write in a column.
<UserControl x:Class="WISN.Windows.Survey.FacilityStaffControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:WISN.Windows.Survey.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<telerik:RadTreeListView x:Name="stufftreeListView" AutoGenerateColumns="False"
AutoExpandItems="True" GroupRenderMode="Flat" CanUserDeleteRows="False"
ItemsSource="{Binding AllStaffByType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged }">
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding StaffCategories,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></telerik:TreeListViewTableDefinition>
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsSelected}" AutoSelectOnEdit="True" EditTriggers="CellClick">
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding Command="{Binding CustomCommandCommand}" EventName="MouseLeftButtonDown" />
</telerik:EventToCommandBehavior.EventBindings>
</telerik:GridViewCheckBoxColumn>
<telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding Name}" Header="Stuff"></telerik:GridViewDataColumn>
<telerik:GridViewDataColumn DataMemberBinding="{Binding AnnualSalary}" Header="Annual Salary"></telerik:GridViewDataColumn>
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>
</UserControl>
Thanks
To simplify things, consider the following MainWindow class inheriting fromSystem.Windows.Window:
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
namespace WpfApp1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
StateChanged += MainWindow_StateChanged;
MouseUp += MainWindow_MouseUp;
}
private void MainWindow_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Maximized)
{
Debug.WriteLine("Window Maximized");
}
}
private void MainWindow_MouseUp(object sender, MouseButtonEventArgs e)
{
Debug.WriteLine("Window MouseUp");
}
}
}
When this window is in normal state if I double click its title bar then it is maximized and a Window.MouseUp event is raised, which results in the following output in VS Output pane:
Window Maximized Window MouseUp
Hi, i'm having a rough fight with WPF and its Binding system. I just wanna bind a property of an instance called HPP, this property is pressure and this object exist in MainViewModel, so in MainWindow.xaml a have this:
<componentes:SetComponent x:Name="HPP_Trip_Route" Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Title="TRIP" VariableValue="{Binding HPPRoute.Pressure}" Unity="PSI" Loaded="SetComponent_Loaded" FSizeTitle="24" FSizeVariable="36" FSizeUnity="14"/>
I tried with RelativeSource without success. If i create a variable in MainViewModel it works. Any help?
When I use the WindowsFormsHost in Radbusyindicator,
then I change the window size, and the UI shows very slowly and seems wrong.
The content of the WindowsFormsHost is just a Label.
I am not sure if there are some details in this case.
<telerik:RadBusyIndicator IsBusy="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<WindowsFormsHost>
<cc:UserControl1/>
</WindowsFormsHost>
</Grid>
</telerik:RadBusyIndicator>
Hi,
i try to save and load minimized ToolWindows. This works, but the original size gets lost.
Reproduce: Minimize ToolWindow, Save, Load, Restore -> wrong size
I atteched a simple sample where you can push the buttons from 1 to 4 to reproduce it. Pressing button 1 and 4 back and forth works as expected.
In the produced XML i see, that FloatingWidth and FloatingHeight is reset to some "strange" values (160 and 28) after minimize.
When i restore the Window after Load it gets a size of 1440x879
I also dont know how i can sneak in this process to "correct" the values or save some custom/attached ones ...
regards marco
I was reading this article here and it skips the process of how to add a Telerik RadWindow?
There doesn't actually seem to be an option to add a Telerik WPF RadWindow, only the default Microsoft WPF window.
Documentation just says "Declare" ... so I'm assuming we're supposed to modify a Microsoft template for the XAML?
This is VS 2022 17.5 using Telerik UI WPF 2023.1.117.
Rob.