Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all 4964 articles
Browse latest View live

New Post: Customising the RichTextBoxFormatBar

$
0
0
Hi,

The current RichTextBoxFormatBar has a default design in a resource Dictionary in the Toolkit. If you want to have a new Design, you have to modify the current control in XAML. Usually, properties lets user modify the behavior of a control, but if special changes needs to be done (like modifying the design), the ControlTemplate of the controls needs to be redone.

Edited Issue: PropertyGrid handling of primitive controls [20762]

$
0
0
Hi,

I've am attempting to use the propertygrid in a new application so I am fairly new on using it. My application allows the user to dynamically add controls (button, label, image, rectangle, ellipse, etc) to a canvas and move and resize them. I wish to use the propertygrid to allow the user to also change properties of the control that were added.

In the process of testing I noticed that when adding a primitive control (rectangle, ellipse) and setting the SelectedObject to the newly created object the property grid gets an exception "at Xceed.Wpf.Toolkit.PropertyGrid.Editors.PrimitiveTypeCollectionEditor.ResolveValueBinding(PropertyItem propertyItem)
at Xceed.Wpf.Toolkit.PropertyGrid.Editors.TypeEditor`1.ResolveEditor(PropertyItem propertyItem)
at Xceed.Wpf.Toolkit.PropertyGrid.ObjectContainerHelperBase.GenerateChildrenEditorElement(PropertyItem propertyItem)
at Xceed.Wpf.Toolkit.PropertyGrid.ObjectContainerHelperBase.PrepareChildrenPropertyItem(PropertyItemBase propertyItem, Object item)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnPreparePropertyItemInternal(Object sender, PropertyItemEventArgs args)"

The inner exception was "System.IndexOutOfRange" exception. After researching the issue further by debugging "PrimitiveTypeCollectionEditor" I believe I've found the root of the problem:

* The problem in ResolveValueBinding is that "Editor.ItemType = type.GetGenericArguments()[0]" is attempting to access index 0 when for this type no generic parameters exist. Inspecting the code with debug I found the type to be {Name = "DoubleCollection" FullName = "System.Windows.Media.DoubleCollection"}

I patched the code to the see if I could get around the issue. The code patch was as follows:

// DEK Check to see if type contains generic parameters before referencing index 0
if (type.ContainsGenericParameters)
{
Editor.ItemType = type.GetGenericArguments()[0];
}

With additional testing I found the same issue occurred again in code "PrimitiveTypeCollectionControl". Again I patched the code as follows:

// DEK
if (newValue.GetType().ContainsGenericParameters)
{
if (ItemType == null)
ItemType = newValue.GetType().GetGenericArguments()[0];
}
SetText(newValue);

I've retested and my application is working as expected now with both the Ellipse and Rectangle controls. Attached are the two modules with the new modifications.
____________________________________________________________________________________________________________________________

The second issue I've encountered was while attempting to use the XamlDesignerSerializationManager(XMLWriter) to save the XAML definition of my modified form so that I could restore it later. I am able to make this work when I save reference to my Canvas that I've added my controls to but when attempting to save the XAML when referencing the Grid containing the AvalonDockManager my application abends with a stack overflow exception. I understand what causes this and have to tried to resolve it by removing any binding with child elements that reference higher parent elements - thinking this is forcing recursive calls. I have not been able to resolve this at all. I am not terribly concerned though since I am able to save my Canvas, containing all of my newly created controls, and restore it later.

While I have a workaround I wanted to let you know as this may indicate an unexpected recursive call scenario in your code. Microsoft documentation indicates that only 1000 stack entries are allowed and I'm not sure why this would be exceeded when propagating through a very simple AvalonDock layout.

____________________________________________________________________________________________________________________________
Now for a question on using PropertyDefinitions. When I add a control to my form I am able to set the SelectedObject to the new control (standard or primitive) and get all of the control properties populated into the propertygrid. My preference would be to only expose specific control properties for the user to change. I've experimented with setting the SelectedObject to the the control I want to reference and then setting the AutoGenerateProperties to False. I am attempting to inform my propertygrid which properties to show by using PropertyDefinitions but haven't had much success. I am unable to set these values in the XAML since these controls don't exist at runtime. Also I've been unable to find any examples that show how to do this properly in code. My assumption, and maybe incorrect, was that if I set propertydefinitions to existing properties that the propertygrid would handle referencing the properties and attach the necessary editordefinitions as well to handle them.

** Is it possible to add propertydefinitions in code and can you provide me with an example?

Again my workaround would be to handle the sets and gets of each property in my own code but would prefer to minimize my coding as much as possible and leverage existing propertygrid functionality.

Please let me know what you find or if you need additional information to properly respond to my findings or request for information.

Regards,

Don

Created Issue: XamlDesignerSerializationManager with AvalonDock [20767]

$
0
0
The issue I've encountered was while attempting to use the XamlDesignerSerializationManager(XMLWriter) to save the XAML definition of my modified form so that I could restore it later. I am able to make this work when I save reference to my Canvas that I've added my controls to but when attempting to save the XAML when referencing the Grid containing the AvalonDockManager my application abends with a stack overflow exception. I understand what causes this and have to tried to resolve it by removing any binding with child elements that reference higher parent elements - thinking this is forcing recursive calls. I have not been able to resolve this at all. I am not terribly concerned though since I am able to save my Canvas, containing all of my newly created controls, and restore it later.

Commented Issue: PropertyGrid handling of primitive controls [20762]

$
0
0
Hi,

I've am attempting to use the propertygrid in a new application so I am fairly new on using it. My application allows the user to dynamically add controls (button, label, image, rectangle, ellipse, etc) to a canvas and move and resize them. I wish to use the propertygrid to allow the user to also change properties of the control that were added.

In the process of testing I noticed that when adding a primitive control (rectangle, ellipse) and setting the SelectedObject to the newly created object the property grid gets an exception "at Xceed.Wpf.Toolkit.PropertyGrid.Editors.PrimitiveTypeCollectionEditor.ResolveValueBinding(PropertyItem propertyItem)
at Xceed.Wpf.Toolkit.PropertyGrid.Editors.TypeEditor`1.ResolveEditor(PropertyItem propertyItem)
at Xceed.Wpf.Toolkit.PropertyGrid.ObjectContainerHelperBase.GenerateChildrenEditorElement(PropertyItem propertyItem)
at Xceed.Wpf.Toolkit.PropertyGrid.ObjectContainerHelperBase.PrepareChildrenPropertyItem(PropertyItemBase propertyItem, Object item)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnPreparePropertyItemInternal(Object sender, PropertyItemEventArgs args)"

The inner exception was "System.IndexOutOfRange" exception. After researching the issue further by debugging "PrimitiveTypeCollectionEditor" I believe I've found the root of the problem:

* The problem in ResolveValueBinding is that "Editor.ItemType = type.GetGenericArguments()[0]" is attempting to access index 0 when for this type no generic parameters exist. Inspecting the code with debug I found the type to be {Name = "DoubleCollection" FullName = "System.Windows.Media.DoubleCollection"}

I patched the code to the see if I could get around the issue. The code patch was as follows:

// DEK Check to see if type contains generic parameters before referencing index 0
if (type.ContainsGenericParameters)
{
Editor.ItemType = type.GetGenericArguments()[0];
}

With additional testing I found the same issue occurred again in code "PrimitiveTypeCollectionControl". Again I patched the code as follows:

// DEK
if (newValue.GetType().ContainsGenericParameters)
{
if (ItemType == null)
ItemType = newValue.GetType().GetGenericArguments()[0];
}
SetText(newValue);

I've retested and my application is working as expected now with both the Ellipse and Rectangle controls. Attached are the two modules with the new modifications.
____________________________________________________________________________________________________________________________

The second issue I've encountered was while attempting to use the XamlDesignerSerializationManager(XMLWriter) to save the XAML definition of my modified form so that I could restore it later. I am able to make this work when I save reference to my Canvas that I've added my controls to but when attempting to save the XAML when referencing the Grid containing the AvalonDockManager my application abends with a stack overflow exception. I understand what causes this and have to tried to resolve it by removing any binding with child elements that reference higher parent elements - thinking this is forcing recursive calls. I have not been able to resolve this at all. I am not terribly concerned though since I am able to save my Canvas, containing all of my newly created controls, and restore it later.

While I have a workaround I wanted to let you know as this may indicate an unexpected recursive call scenario in your code. Microsoft documentation indicates that only 1000 stack entries are allowed and I'm not sure why this would be exceeded when propagating through a very simple AvalonDock layout.

____________________________________________________________________________________________________________________________
Now for a question on using PropertyDefinitions. When I add a control to my form I am able to set the SelectedObject to the new control (standard or primitive) and get all of the control properties populated into the propertygrid. My preference would be to only expose specific control properties for the user to change. I've experimented with setting the SelectedObject to the the control I want to reference and then setting the AutoGenerateProperties to False. I am attempting to inform my propertygrid which properties to show by using PropertyDefinitions but haven't had much success. I am unable to set these values in the XAML since these controls don't exist at runtime. Also I've been unable to find any examples that show how to do this properly in code. My assumption, and maybe incorrect, was that if I set propertydefinitions to existing properties that the propertygrid would handle referencing the properties and attach the necessary editordefinitions as well to handle them.

** Is it possible to add propertydefinitions in code and can you provide me with an example?

Again my workaround would be to handle the sets and gets of each property in my own code but would prefer to minimize my coding as much as possible and leverage existing propertygrid functionality.

Please let me know what you find or if you need additional information to properly respond to my findings or request for information.

Regards,

Don
Comments: ** Comment from web user: BoucherS **

Hi,
1) System.IndexOutOfRange exception.
Thanks, the fix will be included in v2.3

2) XamlDesignerSerializationManager with AvalonDock
Issue https://wpftoolkit.codeplex.com/workitem/20767 has been created.

3) add propertydefinitions in code-behind
There is a bug preventing the propertyGrid from refreshing after the PropertyGrid.PropertyDefinitions have changed. It will be fix in v2.3. In the meantime, go in file :
-Xceed.Wpf.Toolkit/PropertyGrid/PropertyGrid.cs
In method :
OnPropertyDefinitionsCollectionChanged
At the end, add :
```
this.UpdateContainerHelper();
```

Here's a sample for modifying the PropertyDefinitions in code-behind:
```
<StackPanel>
<xctk:PropertyGrid x:Name="_propertyGrid"
AutoGenerateProperties="False">
</xctk:PropertyGrid>

<Button Content="Change Properties"
Click="Button_Click_1" />
</StackPanel>

public partial class MainWindow : Window
{
public MainWindow()
{
Xceed.Wpf.Toolkit.Licenser.LicenseKey = "XXXXX-XXXXX-XXXXX-XXXX";
InitializeComponent();

_propertyGrid.SelectedObject = new MyData() { ID = 12, FirstName = "Tom", LastName = "Sawyer" };
}

private void Button_Click_1( object sender, RoutedEventArgs e )
{
List<string> propertyList = new List<string>() { "FirstName" };
_propertyGrid.PropertyDefinitions.Add( new PropertyDefinition()
{
TargetProperties = propertyList
} );
}
}

public class MyData
{
public int ID
{
get;
set;
}

public string FirstName
{
get;
set;
}

public string LastName
{
get;
set;
}
}
```

New Post: Customising the RichTextBoxFormatBar

$
0
0
Thanks. I have created a Custom Control, used the xaml source code in Themes/Generic.xaml and created the necessary .cs files from the source code. IsesFormatBar.cs is the control file which inherits from Control.

Here is my Generic.xaml:
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
    xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters;assembly=Xceed.Wpf.Toolkit" 
    xmlns:MyNamespace="clr-namespace:IsesTextEditor">

    <conv:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />

    <ControlTemplate TargetType="{x:Type MyNamespace:IsesFormatBar}" x:Key="IsesFormatTemplate">
        <Border Background="Transparent"
              Cursor="Hand"
              ToolTip="Click to Drag">
            <StackPanel VerticalAlignment="Center"
                     Width="75">
                <Line SnapsToDevicePixels="True"
etc etc
</StackPanel>

                </StackPanel>
            </Grid>
        </Border>
    </ControlTemplate>

    <!-- =================================================================== -->
    <!-- Style                                                               -->
    <!-- =================================================================== -->
    <Style TargetType="{x:Type MyNamespace:IsesFormatBar}">
        <Setter Property="Template"
              Value="{StaticResource richTextBoxFormatBarTemplate}" />
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect BlurRadius="5"
                              Opacity=".25" />
            </Setter.Value>
        </Setter>
        <Setter Property="Background"
              Value="Transparent" />
        <Setter Property="IsTabStop"
              Value="false" />
    </Style>
</ResourceDictionary>
I cannot view the tool design in the designer of Generic.xaml, I am getting the message 'Intentionally Left Blank. The document root element is not supported by the visual designer'.

Any ideas?

Created Issue: validation with minus sign in MaskedTextBox [20769]

$
0
0
Based on discussion https://wpftoolkit.codeplex.com/discussions/535190.

New Post: validation with minus sign

$
0
0
Hi,

In Code-behind, the exception is raised because you are setting a Double and the MaskedTextBox is expecting a Decimal. Make sure you provide the right type to the MaskedTextBox value. :
maskTextBox.Value = (decimal)-0001.20;
For the input with negative sign, issue https://wpftoolkit.codeplex.com/workitem/20769 has been created.

New Post: validation with minus sign

$
0
0
casting it to a decimal doesn't yield any different result. I was already assigning it using the 'm' suffix to make it a decimal (like: maskedTextBox.Value = -1.2m;) also assigning it a non-negative number works fine.

New Post: PropertyGrid: Custom Editor does not update underlying property

$
0
0
I am trying to setup a custom editor with a combobox where in the itemssource is generated dynamically based on the value of another property. I got most of the code from other posts on this site. All appears to work visually, but the property itself is never updated.

Any thoughts on why the Database property never gets set when the combobox selection is changed?

Here is my code
    [DefaultProperty("Server")]
    publicclass Connection : INotifyPropertyChanged
    {
        privatestring _server;
        privatestring _database;

        
        [Xceed.Wpf.Toolkit.PropertyGrid.Attributes.PropertyOrder(1)]
        [ItemsSource(typeof (ServersItemsSource))]
        public String Server
        {
            get { return _server; }
            set
            {
                if (value == _server) return;
                _server = value;
                OnPropertyChanged();
                OnPropertyChanged("Databases");
                OnPropertyChanged("IsValid");
            }
        }

        [Xceed.Wpf.Toolkit.PropertyGrid.Attributes.PropertyOrder(2)]
        [Editor(typeof (DatabaseNameEditor), typeof (DatabaseNameEditor))]
        public String Database
        {
            get { return _database; }
            set
            {
// this is never called.if (value == _database) return;
                _database = value;
                OnPropertyChanged();
                OnPropertyChanged("IsValid");
            }
        }

        [Browsable(false)]
        public ObservableCollection<String> Databases
        {
            get
            {
                if (Server == null) returnnew ObservableCollection<string>();

                returnnew ObservableCollection<string>(SpeedpayMaster.Databases(Server));
            }
        }

        [Browsable(false)]
        publicbool IsValid { get { return !Server.IsNullOrWhiteSpace() && !Database.IsNullOrWhiteSpace(); } }

        publicevent PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protectedvirtualvoid OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    publicclass ServersItemsSource : IItemsSource
    {
        public ItemCollection GetValues()
        {
            
            ItemCollection sizes = new ItemCollection();
            (new List<String>() { "devdb02a", "devdb05a", "devdb07a", "qadb05a", "qadb07a", "testdb03a", "uatdb05a", "uatdb07a", "uatdb08a" }).
                ForEach(sizes.Add);
            return sizes;
        }
    }

    publicclass DatabaseNameEditor : ITypeEditor
    {
        public FrameworkElement ResolveEditor(PropertyItem propertyItem)
        {
            ComboBox box = new ComboBox();

            Connection source = propertyItem.Instance as Connection;
            Debug.Assert(source != null);

            var itemSourcebinding = new Binding("Databases")
            {
                Source = propertyItem.Instance,
                ValidatesOnExceptions = true,
                ValidatesOnDataErrors = true,
                Mode = BindingMode.OneWay
            };

            var selBinding = new Binding("Value")
            {
                Source = propertyItem,
                ValidatesOnExceptions = true,
                ValidatesOnDataErrors = true,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay
            };

            BindingOperations.SetBinding(box, ItemsControl.ItemsSourceProperty, itemSourcebinding);
            BindingOperations.SetBinding(box, Selector.SelectedValueProperty, selBinding);

            return box;
        }

        
    }

    
}

Commented Issue: validation with minus sign in MaskedTextBox [20769]

$
0
0
Based on discussion https://wpftoolkit.codeplex.com/discussions/535190.
Comments: ** Comment from web user: BoucherS **

Maybe something to do with MaskedTextBox.GetFormatSpecifierFromMask() which adds a '0' when receiving a '#'.

New Post: validation with minus sign

New Post: how to use CheckComboBox with mvvm?

$
0
0
hi
I am using the CheckComboBox ver 2.0.0 in my wpf mvvm project
but I seem unable to bind the selecteditems. when Bind selecteditems to a property in wpf exception errror
SelectedItems="{Binding SelectedItemAccountUnitGroup }

error:
'SelectedItems' property is read-only and cannot be set from markup. Line

That is why im using SelectedItemsOverride

how to save All checked items CheckComboBox to database?

i am using EF code First And Mvvm


but only one checked item CheckComboBox save to database

this is my code
binding in wpf window:
<xceedtoolkit:CheckComboBox Grid.Row="2" Grid.Column="3"  Name="xccedcheck"
                            ItemsSource="{Binding AccountUnitGroupList }"
                           DisplayMemberPath="AccUnitGroupName"
                         ValueMemberPath="AccUnitGroupID"
                         SelectedValue="{Binding AccountUnitData.AccUnitGroupID}"
                         SelectedMemberPath="{Binding SelectedItemAccountUnitGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                         
                         IsDropDownOpen="false"
                         MaxDropDownHeight="100">
i am using
  SelectedValue="{Binding AccountUnitData.AccUnitGroupID}" 
to save to database but this metod only one checked item save


viewmodel:
public AccountUnit AccountUnitData { get; set; } //this field for new Instance of my model in view model

 public ObservableCollection<AccountUnitGroup> AccountUnitGroupList { get; set; }//this list load mylist to CheckComboBox 

   private AccountUnitGroup _selectedItemAccountUnitGroup;

        public AccountUnitGroup SelectedItemAccountUnitGroup // this field for binding to SelectedItem or SelectedItems
        {
            get { return _selectedItemAccountUnitGroup; }
            set
            {
                if (_selectedItemAccountUnitGroup != value)
                {
                    _selectedItemAccountUnitGroup = value;

                    NotifyPropertyChanged("SelectedItemAccountUnitGroup");
                }
            }
        }
please help me by sample with mvvm

thanks

Commented Unassigned: how to use CheckComboBox with mvvm [20766]

$
0
0
hi
I am using the CheckComboBox ver 2.0.0 in my wpf mvvm project
but I seem unable to bind the selecteditems. when Bind selecteditems to a property in wpf exception errror
SelectedItems="{Binding SelectedItemAccountUnitGroup }
error:
'SelectedItems' property is read-only and cannot be set from markup. Line

how to save All checked items CheckComboBox to database?

i am using EF code First And Mvvm


but only one checked item CheckComboBox save to database

__this is my code__
__binding in wpf window:__
```
<xceedtoolkit:CheckComboBox Grid.Row="2" Grid.Column="3" Name="xccedcheck"
ItemsSource="{Binding AccountUnitGroupList }"
DisplayMemberPath="AccUnitGroupName"
ValueMemberPath="AccUnitGroupID"
SelectedValue="{Binding AccountUnitData.AccUnitGroupID}"
SelectedMemberPath="{Binding SelectedItemAccountUnitGroup, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

IsDropDownOpen="false"
MaxDropDownHeight="100">
```

i am using
```
SelectedValue="{Binding AccountUnitData.AccUnitGroupID}"

```
to save to database but this metod only one checked item save


viewmodel:

```
public AccountUnit AccountUnitData { get; set; } //this field for new Instance of my model in view model

public ObservableCollection<AccountUnitGroup> AccountUnitGroupList { get; set; }//this list load mylist to CheckComboBox

private AccountUnitGroup _selectedItemAccountUnitGroup;

public AccountUnitGroup SelectedItemAccountUnitGroup // this field for binding to SelectedItem or SelectedItems
{
get { return _selectedItemAccountUnitGroup; }
set
{
if (_selectedItemAccountUnitGroup != value)
{
_selectedItemAccountUnitGroup = value;

NotifyPropertyChanged("SelectedItemAccountUnitGroup");
}
}
}

```

please help me by sample with mvvm

thanks
Comments: ** Comment from web user: BoucherS **

Hi,

Can you submit a more complete sample ? I'm having errors trying to build something from the code you pasted.
Have you tried with PropertyGrid.SelectedItemsOverride property ?

New Post: Customising the RichTextBoxFormatBar

$
0
0
Hi,
from what I see, you create a style for objects of type MyNamespace:IsesFormatBar which uses the ControlTemplate "richTextBoxFormatBarTemplate". On the other hand, there is a ControlTemplate (for MyNamespace:IsesFormatBar objects type ), named "IsesFormatTemplate", which is not used.

Commented Feature: Expandable Property not expanded by default [20054]

$
0
0
Based on discussion https://wpftoolkit.codeplex.com/discussions/452722, user wants to have an expand property expanded by default.

Maybe having a new ExpandableObjectAttribute which take a true/false parameter would do the job.
Comments: ** Comment from web user: jaredthirsk **

One quick way to let the user decide when to expand (patch)


Commented Issue: validation with minus sign in MaskedTextBox [20769]

$
0
0
Based on discussion https://wpftoolkit.codeplex.com/discussions/535190.
Comments: ** Comment from web user: scrappydoo **

I already tried adding the '#' instead of '0' in the MaskedTextBox.GetFormatSpecifierFromMask(). This leads to other strange behavior, like not being able to assign positive values to the MaskedTextBox, but it certainly has to do something with it.

Edited Feature: Expandable Property not expanded by default [20054]

$
0
0
Based on discussion https://wpftoolkit.codeplex.com/discussions/452722, user wants to have an expand property expanded by default.

Maybe having a new ExpandableObjectAttribute which take a true/false parameter would do the job.
Comments: ** Comment from web user: BoucherS **

The ExpandableObjectAttribute with a True/False parameter will be included in the v2.3 of the toolkit.

New Post: Limit PropertyGrid Control Standard Properties and Use Toolkit ColorPickerEditor

$
0
0
Hi,

I believe I am attempting to use the propertygrid in a non-standard way, but wanted to reach out to everyone for some advice and guidance. My requirements are as follows:

1) I don't want to show all of the properties of the control (e.g. Ellipse/Rectangle). To do this I've set the SelectedObject to the control I want to modify the properties for. Also I've set AutoGenerateProperties to False to prevent all properties from being shown.
2) For the Fill property (Ellipse/Rectangle) I want to leverage the Toolkit standard ColorPickerEditor to select the color to use.

What I've done so far:

1.) I've added EditorDefinitions to my Xaml for the propertygrid:
<xctk:PropertyGrid.EditorDefinitions>
                                    <xctk:EditorDefinition>
                                        <xctk:EditorDefinition.PropertiesDefinitions>
                                            <xctk:PropertyDefinition Name="Fill" />
                                     </xctk:EditorDefinition.PropertiesDefinitions>
                                      <xctk:EditorDefinition.EditorTemplate>
                                            <DataTemplate>
                                                <xctk:PropertyGridEditorColorPicker SelectedColor="{Binding Value}" DisplayColorAndName="True" DataContext="{Binding BindsDirectlyToSource=True, ValidatesOnExceptions=True, ValidatesOnDataErrors=True}" />
                                            </DataTemplate>
                                      </xctk:EditorDefinition.EditorTemplate>
                                    </xctk:EditorDefinition>
                                </xctk:PropertyGrid.EditorDefinitions>
All of the above works fine and I am able to see and use the Colorpickereditor for the Fill property, but the Colorpickereditor is not properly binding to the initial Fill value when I select the object. Also when I change the color it is not changing the Fill property in the control selected.

I do receive a PropertyValueChanged when the color is changed and I can set the Fill color that was selected manually in my code behind. I realize that the SelectedColor property is a Color and not a Brush as expected by the Fill Property so I do the conversion in my code before setting the control's fill property. Using the standard ColorPicker I am able to bind the SelectedColor to the Fill property by performing a conversion from color to brush using the StaticResource ColorToSolidbrushConverter as follows in the Xaml:

Fill="{Binding Converter={StaticResource ColorToSolidColorBrushConverter1}, ElementName=ColorPicker1, Path=SelectedColor}"

I have the following questions:

1.) Is what I am attempting to do possible?
2.) If using the ColorPickerEditor is possible do I need to do anything else to bind it properly and/or perform the conversion from Color to Brush without needing to handle the property in my code. Is it possible to bind the control's fill property to the PropertyGridEditorColorPicker selected color in the same way?

Thanks in advance to anyone that can provide any input, guidance or example on how to handle these requirements.

Created Unassigned: CheckComboBox mvvm sample [20774]

New Post: No Dynamic binding available for tab pages of LayoutDocumentPane

Viewing all 4964 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>