Telerik Forums
UI for WPF Forum
2 answers
1.1K+ views
i want to remove the border of each columns headers in the grid view>i tried with borderthickness="0" , but it didnt work.Please help me in removing the border from  telerik grid view.
Flemming
Top achievements
Rank 1
Veteran
 answered on 18 Jun 2020
1 answer
617 views

I'm am trying to create a search with  Watermark Text Box and have a clear button at the end. The problem is that I can't get the background of the button to be transparent.

This is the code that I am using:

<telerikControls:RadWatermarkTextBox Name="SearchBox"
                  Text="{Binding SearchControl.SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                  Width="250">
                    <telerikControls:RadWatermarkTextBox.WatermarkContent>
                        <StackPanel Orientation="Horizontal">
                            <telerikControls:RadGlyph Glyph="" Margin="0 3 0 0"/>
                            <TextBlock Margin="3,3,0,0" Text="Search" />
                        </StackPanel>
                    </telerikControls:RadWatermarkTextBox.WatermarkContent>
                    <telerikControls:RadWatermarkTextBox.AdditionalContent>
                        <telerikControls:RadButton Focusable="False"
                           IsBackgroundVisible="False"
                           Command="telerikControls:RadWatermarkTextBoxCommands.Clear"
                           CommandTarget="{Binding ElementName=SearchBox}"
                           ToolTip="Clear">
                            <telerikControls:RadGlyph Glyph="î„›"/>
                        </telerikControls:RadButton>
                    </telerikControls:RadWatermarkTextBox.AdditionalContent>
                </telerikControls:RadWatermarkTextBox>

 

I have also tried to use Background="Transparent" but that still doesn't work.

I have also noticed that IsBackgroundVisible aslo doesn't work on buttons outside of the Watermark Text Box.

I have attached a photo of how the search box looks.

Sia
Telerik team
 answered on 18 Jun 2020
1 answer
290 views

When I run the Groups demo in the Gauge_WPF solution (no modifications), the linear / vertical gauge group doesn't look anything like what it's supposed to:

  • No indicators
  • Only 1.5 of the 4 ranges visible

(screenshot attached)

Can you pls. clarify how to fix this?

 

Vladimir Stoyanov
Telerik team
 answered on 17 Jun 2020
3 answers
234 views

Hello,

I cannot get a C# enumeration property based on dynamically created DefineEnum call to show up as popup on a PropertyGrid.  I've tried several things but nothing worked.  Also, I am dynamically creating the PropertyDefinition items instead of statically defining anything via XAML.

Here is the basic code to load the property definitions:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    PropertyDefinitionCollection properties = EditorPropertyGrid.PropertyDefinitions;
 
    List<KeyValueBase> testList = new List<KeyValueBase>();
 
    TestEnumKeyValue first = new TestEnumKeyValue() { Key = "Static Enum Prop", Value = TestEnum.test3 };
    testList.Add(first);
    properties.Add(new PropertyDefinition()
    {
        DisplayName = first.Key,
        Binding = new Binding("Value") { Source = first }
    });
 
    DynamicEnumBuilder _enums = new DynamicEnumBuilder();
    _enums.BuildDictionaries();
    Type dynamicEnum = _enums.getEnum("Employee", "Status");
     
    EnumKeyValue second = new EnumKeyValue() { Key = "Dynamic Enum Prop", Value = Enum.Parse(dynamicEnum, "PartTime")};
    testList.Add(second);
    properties.Add(new PropertyDefinition()
    {
        DisplayName = second.Key,
        Binding = new Binding("Value") { Source = second }
    });
 
    // ************************
 
    EditorPropertyGrid.Item = testList;
}

Here are the key value pair definitions:

enum TestEnum
{
    test1,
    test2,
    test3
}
 
class KeyValueBase
{
 
}
 
class TestEnumKeyValue : KeyValueBase
{
    public string Key { get; set; }
    public TestEnum Value { get; set; }
}
 
class EnumKeyValue : KeyValueBase
{
    public string Key { get; set; }
    public object Value { get; set; }
}

 

Here is the XAML:

<Grid x:Name="EditorGrid">
    <telerik:RadPropertyGrid x:Name="EditorPropertyGrid" Margin="10,10,10,10" DescriptionPanelVisibility="Collapsed" SearchBoxVisibility="Collapsed" AutoGeneratePropertyDefinitions="False" NestedPropertiesVisibility="Visible" AutoGenerateBindingPaths="False" SortAndGroupButtonsVisibility="Collapsed" />
</Grid>

 

And here is how I generate the dynamic enum:

class DynamicEnumBuilder
    {
        public Dictionary<string, Dictionary<string, Type>> _enumDictionary = new Dictionary<string, Dictionary<string, Type>>();
 
        public void BuildDictionaries()
        {
            Dictionary<string, Dictionary<string, List<ValuePair>>> _rawDictionary = new Dictionary<string, Dictionary<string, List<ValuePair>>>();
            _rawDictionary["Employee"] = new Dictionary<string, List<ValuePair>>();
            _rawDictionary["Employee"]["Status"] = new List<ValuePair>();
            _rawDictionary["Employee"]["Status"].Add(new ValuePair() { Name = "FullTime", StoredValue = "1" });
            _rawDictionary["Employee"]["Status"].Add(new ValuePair() { Name = "PartTime", StoredValue = "2" });
            _rawDictionary["Employee"]["Status"].Add(new ValuePair() { Name = "Retired", StoredValue = "3" });
            BuildValueDictionary(_rawDictionary);
        }
 
        private void BuildValueDictionary(Dictionary<string, Dictionary<string, List<ValuePair>>> _rawDictionary)
        {
            // Get the current application domain for the current thread.
            AppDomain currentDomain = AppDomain.CurrentDomain;
 
            //// Create a dynamic assembly in the current application domain,
            //// and allow it to be executed ONLY, NOT to be saved on disk!
            AssemblyName aName = new AssemblyName("TempAssembly");
            AssemblyBuilder ab = currentDomain.DefineDynamicAssembly(
                aName, AssemblyBuilderAccess.Run);
 
            // Define a dynamic module in "TempAssembly" assembly. For a single-
            // module assembly, the module has the same name as the assembly.
            ModuleBuilder mb = ab.DefineDynamicModule(aName.Name);
 
            foreach(var fieldEntry in _rawDictionary)
            {
                Dictionary<string, Type> valueTableDic = null;
                if (!_enumDictionary.ContainsKey(fieldEntry.Key))
                {
                    valueTableDic = new Dictionary<string, Type>();
                    _enumDictionary.Add(fieldEntry.Key, valueTableDic);
                }
                else
                {
                    valueTableDic = _enumDictionary[fieldEntry.Key];
                }
 
                Dictionary<string, List<ValuePair>> rawEnumDict = fieldEntry.Value;
                foreach (var fieldEnum in rawEnumDict)
                {
                    // Define a public enumeration with the name "Elevation" and an
                    // underlying type of Integer.
                    EnumBuilder eb = mb.DefineEnum(fieldEnum.Key+"Enum", TypeAttributes.Public, typeof(int));
 
                    // build the enumerations
                    List<ValuePair> values = fieldEnum.Value;
                    foreach (var valuePair in values)
                    {
                        eb.DefineLiteral(valuePair.Name, int.Parse(valuePair.StoredValue));
                    }
                    // Create the type and save the assembly.
                    Type dynamicEnum = eb.CreateType();
 
                    // now put it in the value dictionary
                    valueTableDic[fieldEnum.Key] = dynamicEnum;
                }
            }
        }
 
        public Type getEnum(String tablename, String fieldname)
        {
            Type result = null;
            if (_enumDictionary.ContainsKey(tablename))
            {
                Dictionary<string, Type> fieldDict = _enumDictionary[tablename];
                if (fieldDict.ContainsKey(fieldname))
                {
                    result = fieldDict[fieldname];
                }
            }
            return result;
 
        }
    }

 

Basically, I want the dynamic Enum to have a popup like the static Enum, instead of PropertyGrid rendering it as a string.

Any help will be deeply appreciated!

Thanks in advance!

Martin Ivanov
Telerik team
 answered on 17 Jun 2020
1 answer
149 views

I've been testing the chart using bitmap rendering and am pleased with the performance so far. I have some questions regarding optimization. I am creating a simple line chart and am using a ScatterLineSeries, which seems to be the best match. The number of series may change, but the data itself will not change.

1. Is it possible to directly bind to or use arrays instead of arrays of objects? For example, I have 1 million data points that are stored in two arrays: one for X and one for Y. Is there any way to use the data as-is without creating intermediate classes?

2. The chart appears to create a ScatterDataPoint for each of my points. I directly added ScatterDataPoint objects to avoid creating an intermediate class, which worked. However, is there no way to specify an initial capacity? With one million points, isn't the collection going to be constantly resizing?

 

Martin Ivanov
Telerik team
 answered on 17 Jun 2020
3 answers
421 views

Hello guys,

I'd like to make a customizable editor with a button like modal style, but what I want is to reset the value when clicked.

For example, Property1 = "A".

In the editor, I change the Property1 value to "B" and when I click on the reset button, it resets to "A".

I can do it with a simple textbox and button, but it's not easy to implement it with a property grid.

Can you help me please?

Dinko | Tech Support Engineer
Telerik team
 answered on 17 Jun 2020
3 answers
748 views

I have modified the control template of TabbedWindow. But I cant find the actual tab ("handle"). How/where can I set Corenrradius="x"?

 

Robert
Top achievements
Rank 1
Veteran
 answered on 17 Jun 2020
4 answers
325 views
I turned on filtering and the default size it too large.  How can I change this size?
Tom
Top achievements
Rank 1
 answered on 16 Jun 2020
1 answer
245 views

Hello,

Using a WPF PropertyGrid. and having a problem with using Editor Attributes in combination with a nested property.  Basically, all property definitions with Editor Attributes defined at the root will work fine, however nested property definitions with Editor Attributes renders with nothing in it.  The attached file shows the problem.

Here is the code which generates the property definitions:

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    PropertyDefinitionCollection properties = EditorPropertyGrid.PropertyDefinitions;
 
    ObservableCollection<object> testList = new ObservableCollection<object>();
 
    UserDefinedEnumKeyValue first = new UserDefinedEnumKeyValue() { Key = "Custom Enum Control Prop", Value = new UserDefinedEnum() { Item = "UD3", Items = { "UD1", "UD2", "UD3", "UD4" } } };
    testList.Add(first);
    properties.Add(new PropertyDefinition()
    {
        DisplayName = first.Key,
        Binding = new Binding("Value") { Source = first }
    });
 
    ParentKeyValue item = new ParentKeyValue() { ChildList = new List<KeyValueBase>() };
    testList.Add(item);
    PropertyDefinition parentPropertyDefinition = new PropertyDefinition()
    {
        DisplayName = item.Key,
        Binding = new Binding("Value") { Source = item }
    };
    properties.Add(parentPropertyDefinition);
    PropertyDefinitionCollection nestedProperties = parentPropertyDefinition.NestedProperties;
 
    UserDefinedEnumKeyValue second = new UserDefinedEnumKeyValue() { Key = "Custom Enum Control Prop nested", Value = new UserDefinedEnum() { Item = "UD3", Items = { "UD1", "UD2", "UD3", "UD4" } } };
    testList.Add(second);
    nestedProperties.Add(new PropertyDefinition()
    {
        DisplayName = second.Key,
        Binding = new Binding("Value") { Source = second }
    });
 
    EditorPropertyGrid.Item = testList;
}

 

Here are the model classes:

abstract class KeyValueBase
{
    public string Key { get; set; }
    public abstract void SetValue(string value);
 
}
 
class UserDefinedEnum : INotifyPropertyChanged
{
    private List<string> _items = new List<string>();
    public List<string> Items
    {
        get
        {
            return this._items;
        }
        //set NOTE not used for one way binding
        //{
        //    if (this._items != value)
        //    {
        //        this._items = value;
        //        this.OnPropertyChanged("Items");
        //    }
        //}
    }
 
    private string _item;
    public string Item
    {
        get
        {
            return this._item;
        }
        set
        {
            if (this._item != value)
            {
                this._item = value;
                this.OnPropertyChanged("Item");
            }
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    private void OnPropertyChanged(string propertyName)
    {
        if (this.PropertyChanged != null)
            this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}
 
class UserDefinedEnumKeyValue : KeyValueBase
{
    [Telerik.Windows.Controls.Data.PropertyGrid.Editor(typeof(EnumControl), Telerik.Windows.Controls.Data.PropertyGrid.EditorStyle.None)]
    public UserDefinedEnum Value { get; set; }
    public override void SetValue(string value)
    {
 
    }
}
 
class ParentKeyValue : KeyValueBase
{
    public string Value { get; set; }
    public List<KeyValueBase> ChildList { get; set; }
    public override void SetValue(string value)
    {
 
    }
}

 

And here is the XAML for the EnumControl:

<UserControl x:Class="TelerikWpfApp002.EnumControl"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <telerik:RadComboBox SelectedValue="{Binding Item, Mode=TwoWay}" ItemsSource="{Binding Items, Mode=OneWay}" />
    </Grid>
</UserControl>

 

Thank you in advance for any help offered...

Vladimir Stoyanov
Telerik team
 answered on 16 Jun 2020
5 answers
827 views

Hello,

 

We have a desktop based WPF application that is published via RDS. Randomly throughout the day the application crashes with below exception. The error is random and the user of the application or the development\support team of the application is unable to recreate this at will. Any insights regarding this would be helpful. Thank you in advance!

 

Exception

******************************************

Application: ntierHealth.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
   at Telerik.Windows.Controls.WindowHost.GetGlobalMousePosition(System.Windows.UIElement, System.Windows.Input.MouseEventArgs)
   at Telerik.Windows.Controls.InternalWindow.DragBehavior.OnElementMouseLeftButtonUp(System.Object, System.Windows.Input.MouseButtonEventArgs)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
   at System.Windows.UIElement.OnMouseUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
   at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
   at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   at System.Windows.Application.RunDispatcher(System.Object)
   at System.Windows.Application.RunInternal(System.Windows.Window)
   at System.Windows.Application.Run(System.Windows.Window)
   at Mdrx.PM.Client.Shell.App.Main()

******************************************

Kalin
Telerik team
 answered on 16 Jun 2020
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?