unable to set min or max property value of radslider in code behind

2 posts, 0 answers
  1. Lars
    Lars avatar
    2 posts
    Member since:
    Jan 2014

    Posted 23 Jan 2014 Link to this post

    Hi.
    I have a problem setting minimum or maximum values for a RadSlider I need to generate by c# code inside a propertygrid with the help of FrameworkElementFactory.

    Value binding and setting the grid column work perfectly but I am not able to set min or max slider value (and tickfrequency, too - are they readonly?).

    What do I do wrong here? Or is there a better way to add properties like a radslider control inside a radpropertygrid on the fly?

    Lars

    Here is a code snipet:
    FrameworkElementFactory slider = new FrameworkElementFactory(typeof(RadSlider));
    slider.SetBinding(RadSlider.ValueProperty, new Binding(path) { Mode = BindingMode.TwoWay });
    slider.SetValue(RadSlider.MinimumProperty, 0);
    slider.SetValue(RadSlider.MaximumProperty, 100);
    slider.SetValue(Grid.ColumnProperty, 1);
  2. Lars
    Lars avatar
    2 posts
    Member since:
    Jan 2014

    Posted 24 Jan 2014 Link to this post

    I was able to to the same thing by using xamlreader.

    I don't know what I did wrong creating the datatemplate directly with frameworkelementfactory.

    But it works now.

    Lars
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top