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

New Post: PropertyGrid: custom editor propertyItem.Instance is null

$
0
0
The customer editor code is as follows:
public class DefaultUomEditor : ITypeEditor
{
    private TextBox _tb;

    public DefaultUomEditor()
    {
        _tb = new TextBox();
    }

    public System.Windows.FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem)
    {
        propertyItem.IsReadOnly = true;
        //create the binding from the bound property item to the editor
        var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem
        _binding.Source = propertyItem;
        _binding.ValidatesOnExceptions = true;
        _binding.ValidatesOnDataErrors = true;
        _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
        BindingOperations.SetBinding(_tb, TextBox.TextProperty, _binding);

        if (propertyItem.Instance != null)
        {
            // do something...
        }

        return _tb;
    }

}
And the PropertyGrid.SelectedObject is bound to an object instance which has the following property defined as:
    [DisplayName("Default UOM")]
    [Editor(typeof(DefaultUomEditor), typeof(DefaultUomEditor))]        
    public string Uom
    {
        get { return this._uom; }
        internal set
        {
            this._uom = value;
            RaisePropertyChanged(() => this.Uom);
        }
    }

New Comment on "DoubleUpDown"

$
0
0
Hi, I found a strange problem while using DoubleUpDown. While 5.9 next step value should be 6 or 6.0, but it trun to 5.9999...8, but I had setting the "Increment" to 0.1. specials: 1). 9.99999.. to 10.1 2). manual input 5.6 click to up , or click down to 0.0 It's maybe cause in the precision while convert double to decimal. Regards, Marksion

New Post: PropertyGrid: custom editor propertyItem.Instance is null

$
0
0
Hi, using your code in a small stand-alone application, I place a breakpoint in DefaultUomEditor.ResolveEditor() and propertyItem.Instance is not null. Could it be related to something else ?

Also, I suggest using public setter instead of internal setter for property "Uom" if you want to use a specific editor. An editor should be used when a property can be edited.

New Comment on "DoubleUpDown"

$
0
0
Hi Markison, Yes, it's a precision problem while converting. I suggest you add a FormatString to prevent this. Something like : FormatString="N3".

New Post: Bind CollectionControl isEnabled property and style

$
0
0
I have managed to bind the IsEnabled property of a variable displayed in a CollectionEditor by editing Xceed.Wpf.Toolkit\CollectionControl\Themes\Generic.xaml using EditorTemplateDefinition as follows:
<pg:PropertyGrid.EditorDefinitions>
  <pg:EditorTemplateDefinition TargetProperties="UConstruction">
    <pg:EditorTemplateDefinition.EditingTemplate>
      <DataTemplate>                                              
        <TextBox Text="{Binding Value}" IsEnabled="{Binding Instance.IsUYConstruction}" />
       </DataTemplate>
     </pg:EditorTemplateDefinition.EditingTemplate>
   </pg:EditorTemplateDefinition>
 </pg:PropertyGrid.EditorDefinitions>
                                    
This, however, overwrites the default style for that row of the CollectionControl with a Textbox.

Is there a way to achieve the IsEnabled binding but keep the default CollectionControl style?

Created Unassigned: Extended WPF Toolkit PropertyGrid crashes when SelectedObject set to System.Windows.Shapes type. [21384]

$
0
0
I was having problems getting the PropertyGrid to work properly with nested classes and the ExpandableObject attribute so I started with a clean project and found that when the SelectedObject property is set to Ellipse(), or any other object deriving from System.Windows.Shapes, an exception is thrown: "An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll". This occurs with Ellipse, Rectangle, and all the other Shapes. Other types deriving from UIElement and onward seem to work fine.

In order to eliminate other sources of error, I created a new WPF solution, with just the top-level `MainWindow' class. In code, I wrote:

Window w = new Window(); // The PropertyGrid container.
w.Owner = MainWindow;
Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid propertyGrid = new Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid();
w.Content = propertyGrid;
propertyGrid.SelectedObject = new System.Windows.Shapes.Ellipse();
w.ShowDialog(); // Here is where the exception occurs.

Setting the SelectedObject property to anything else other than a Shape, while the other code remains the same, does not cause the exception. Any direction would be greatly appreciated.

Platform Info:

Windows 7, SP1
.NET 4.5
Visual Studio Express 2012
Extended WPF Toolkit: v2.2.1

Commented Unassigned: Extended WPF Toolkit PropertyGrid crashes when SelectedObject set to System.Windows.Shapes type. [21384]

$
0
0
I was having problems getting the PropertyGrid to work properly with nested classes and the ExpandableObject attribute so I started with a clean project and found that when the SelectedObject property is set to Ellipse(), or any other object deriving from System.Windows.Shapes, an exception is thrown: "An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll". This occurs with Ellipse, Rectangle, and all the other Shapes. Other types deriving from UIElement and onward seem to work fine.

In order to eliminate other sources of error, I created a new WPF solution, with just the top-level `MainWindow' class. In code, I wrote:

Window w = new Window(); // The PropertyGrid container.
w.Owner = MainWindow;
Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid propertyGrid = new Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid();
w.Content = propertyGrid;
propertyGrid.SelectedObject = new System.Windows.Shapes.Ellipse();
w.ShowDialog(); // Here is where the exception occurs.

Setting the SelectedObject property to anything else other than a Shape, while the other code remains the same, does not cause the exception. Any direction would be greatly appreciated.

Platform Info:

Windows 7, SP1
.NET 4.5
Visual Studio Express 2012
Extended WPF Toolkit: v2.2.1
Comments: ** Comment from web user: BoucherS **

Hi,[0A][0A]This issue should be fixed in v2.3.

Closed Unassigned: Extended WPF Toolkit PropertyGrid crashes when SelectedObject set to System.Windows.Shapes type. [21384]

$
0
0
I was having problems getting the PropertyGrid to work properly with nested classes and the ExpandableObject attribute so I started with a clean project and found that when the SelectedObject property is set to Ellipse(), or any other object deriving from System.Windows.Shapes, an exception is thrown: "An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll". This occurs with Ellipse, Rectangle, and all the other Shapes. Other types deriving from UIElement and onward seem to work fine.

In order to eliminate other sources of error, I created a new WPF solution, with just the top-level `MainWindow' class. In code, I wrote:

Window w = new Window(); // The PropertyGrid container.
w.Owner = MainWindow;
Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid propertyGrid = new Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid();
w.Content = propertyGrid;
propertyGrid.SelectedObject = new System.Windows.Shapes.Ellipse();
w.ShowDialog(); // Here is where the exception occurs.

Setting the SelectedObject property to anything else other than a Shape, while the other code remains the same, does not cause the exception. Any direction would be greatly appreciated.

Platform Info:

Windows 7, SP1
.NET 4.5
Visual Studio Express 2012
Extended WPF Toolkit: v2.2.1

New Post: Bind CollectionControl isEnabled property and style

$
0
0
Hi,

You can try with a PropertyGridEditorTextBox :
<xctk:PropertyGrid.EditorDefinitions>
            <xctk:EditorTemplateDefinition TargetProperties="UConstruction">
               <xctk:EditorTemplateDefinition.EditingTemplate>
                  <DataTemplate>
                     <xctk:PropertyGridEditorTextBox Text="{Binding Value}"
                                                     IsEnabled="{Binding Instance.IsUYConstruction}" />
                  </DataTemplate>
               </xctk:EditorTemplateDefinition.EditingTemplate>
            </xctk:EditorTemplateDefinition>
</xctk:PropertyGrid.EditorDefinitions>

New Post: Bind CollectionControl isEnabled property and style

$
0
0
Thanks for the help.

It turns out, I actually needed PropertyGridEditorDoubleUpDown, i.e. I edited Xceed.Wpf.Toolkit\CollectionControl\Themes\Generic.xaml as follows:
<pg:PropertyGrid.EditorDefinitions>
  <pg:EditorTemplateDefinition TargetProperties="UConstruction">
    <pg:EditorTemplateDefinition.EditingTemplate>
      <DataTemplate>
        <editor:PropertyGridEditorDoubleUpDown Value="{Binding Value}"
                        IsReadOnly="{Binding Instance.IsLayerConstruction}"
                        TextAlignment="Left"                                                                                    
                        />
      </DataTemplate>
    </pg:EditorTemplateDefinition.EditingTemplate>
  </pg:EditorTemplateDefinition>
</pg:PropertyGrid.EditorDefinitions>
where
xmlns:pg="clr-namespace:Xceed.Wpf.Toolkit.PropertyGrid"
xmlns:editor="clr-namespace:Xceed.Wpf.Toolkit.PropertyGrid.Editors"
What is the easiest/best way to change the text (foreground) colours depending on whether the IsReadOnly property is True or False?

Items without an EditorDefinition defined have different colours for properties that are ReadOnly and those that aren't.
(I am using the ExpressionDark style)

Thanks again.

New Post: Bind CollectionControl isEnabled property and style

$
0
0
Hi,

You can set a style on the PropertyGridEditorDoubleUpDown and use a trigger to change the color when IsReadOnly is true.
<Window.Resources>      
      <Style x:Key="DoubleUpDownStyle"
             TargetType="{x:Type xctk:PropertyGridEditorDoubleUpDown}">
         <Setter Property="TextAlignment"
                 Value="Left" />
         <Setter Property="Foreground"
                 Value="Green" />
         <Style.Triggers>
            <DataTrigger Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Self}}"
                         Value="True">
               <Setter Property="Foreground"
                       Value="Red" />
            </DataTrigger>
         </Style.Triggers>
      </Style>
</Window.Resources>

....

<xctk:PropertyGrid x:Name="_propertyGrid">
         <xctk:PropertyGrid.EditorDefinitions>
            <xctk:EditorTemplateDefinition TargetProperties="UConstruction">
               <xctk:EditorTemplateDefinition.EditingTemplate>
                  <DataTemplate>
                     <xctk:PropertyGridEditorDoubleUpDown Value="{Binding Value}"
                                                          IsReadOnly="{Binding Instance.IsUYConstruction}"
                                                          Style="{StaticResource DoubleUpDownStyle}"/>
                  </DataTemplate>
               </xctk:EditorTemplateDefinition.EditingTemplate>
            </xctk:EditorTemplateDefinition>
         </xctk:PropertyGrid.EditorDefinitions>
</xctk:PropertyGrid>

New Post: Conditional Wizard Pages

$
0
0
Hi there,
I'm new to wpf and the extended wpf toolkit.
I need to write a wizard where the next page depends on some conditions, evaluated in the code backend.
Is there an easy way to accomplish this. I've tried something like:
NextPage="{Binding SomeString}"
but it doesn't seem to work.
Thank You in advance for any help.
Mateusz

Created Unassigned: Color canvas blue channel error? [21405]

$
0
0
Hi,

I have noticed an error when I'm programmatically setting color canvas values in some rare occasions.

Short description of my setup:

- Window with color canvas
- exposed property for setting selected color from another window

I call the color canvas window as dialog and then using exposed property i am setting selected color value (i have tried both setting current color using HexaDecimal value and SelectedColor property).

Problem is occurring when I programmatically set color to #FFFF0000,
_colorPicker.HexadecimalString = value where value is string #FFFF0000

When window with color canvas is loaded, sliders are set on #FFFF0004 or
Alpha 255
Red 255
Green 0
Blue 4

If i lower red value towards zero from #FFFF0000 to #FF000000 then value of blue also goes towards zero (eg if i set color to FFAA0000 i get value of 3 for blue etc)

I hope that i am clear enough

Regards,

Ivan

New Post: Conditional Wizard Pages

$
0
0
Hi,

You can use the WizardPage.CanNextPage property and set it when your conditions are filled :
<xctk:WizardPage x:Name="_page"
                          PageType="Interior"
                          Title="Page 2"
                          Description="This is the second page in the process"
                          CanSelectNextPage="False">
            <Button Content="Test"
                    Click="Button_Click" />
</xctk:WizardPage>

 private void Button_Click( object sender, RoutedEventArgs e )
    {
      if( _page != null )
      {
        _page.CanSelectNextPage = true;
      }
    }

Edited Issue: Color canvas blue channel error? [21405]

$
0
0
Hi,

I have noticed an error when I'm programmatically setting color canvas values in some rare occasions.

Short description of my setup:

- Window with color canvas
- exposed property for setting selected color from another window

I call the color canvas window as dialog and then using exposed property i am setting selected color value (i have tried both setting current color using HexaDecimal value and SelectedColor property).

Problem is occurring when I programmatically set color to #FFFF0000,
_colorPicker.HexadecimalString = value where value is string #FFFF0000

When window with color canvas is loaded, sliders are set on #FFFF0004 or
Alpha 255
Red 255
Green 0
Blue 4

If i lower red value towards zero from #FFFF0000 to #FF000000 then value of blue also goes towards zero (eg if i set color to FFAA0000 i get value of 3 for blue etc)

I hope that i am clear enough

Regards,

Ivan

EDIT: Forgot to mention, i am using WPF toolkit 2.2.1 downloaded using NuGet
Comments: ** Comment from web user: BoucherS **

Hi,

Thanks for reporting this. It will be fixed in v2.5.
In the meantime, You can modify th Minimum of ColorSpectrumSlider from 1 to 0 in file
-Xceed.Wpf.Toolkit/ColorCanvas/Themes/Aero2.Normalcolor.xaml (for Windows8)
-Xceed.Wpf.Toolkit/ColorCanvas/Themes/generic.xaml (for other windows)


New Post: Conditional Wizard Pages

$
0
0
Hi,
That's not what I was exactly looking for.
I need different pages to be displayed depending on some conditions.
Thanks for the effort though.
Mateusz

New Post: Close All option for AvalonDock

New Post: Conditional Wizard Pages

$
0
0
Hi,

How about modifying the currentPage when the button Next is pressed :
<xctk:Wizard x:Name="_wizard"
                   FinishButtonClosesWindow="True"
                   Help="OnWizardHelp"
                   Next="Wizard_Next">
         <xctk:WizardPage x:Name="_page1"
                          Title="Welcome to my Wizard"
                          Description="This Wizard will walk you though how to do something." />
         <xctk:WizardPage x:Name="_page2"
                          PageType="Interior"
                          Title="Page 1"
                          Description="This is the first page in the process." />
         <xctk:WizardPage x:Name="_page3"
                          PageType="Interior"
                          Title="Page 2"
                          Description="This is the second page in the process" />
         <xctk:WizardPage x:Name="_page4"
                          PageType="Interior"
                          Title="Last Page"
                          Description="This is the last page in the process"
                          CanFinish="True" />
</xctk:Wizard>

private void Wizard_Next( object sender, Toolkit.Core.CancelRoutedEventArgs e )
    {
      var wizard = sender as Xceed.Wpf.Toolkit.Wizard;
      if( wizard != null )
      {
        if( wizard.CurrentPage == _page1 )
        {
          //wizard.CurrentPage = _page3;
          //or
          wizard.CurrentPage = wizard.Items[ 2 ] as WizardPage;
        }
      }
    }

Created Feature: Close All option for AvalonDock [21406]

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

New Post: Close All option for AvalonDock

Viewing all 4964 articles
Browse latest View live