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

New Post: Text color in a propertygrid

$
0
0
Hi,

You can set the Foreground for the editor of strings : the PropertyGridEditorTextBox :
<xctk:PropertyGrid x:Name="_propertyGrid">
         <xctk:PropertyGrid.Resources>
            <Style TargetType="{x:Type xctk:PropertyGridEditorTextBox}">
               <Setter Property="Foreground" Value="White"/>
            </Style>
         </xctk:PropertyGrid.Resources>
      </xctk:PropertyGrid>

New Post: Propertygrid CheckedTreeView (DropDownButton)

$
0
0
Hi,

In the Plus version of the Toolkit, you can create Custom PropertItems and build them as a tree :
var subDemo111 = new CustomPropertyItem() { DisplayName = "subDemo111", Value = false };
var subDemo11 = new CustomPropertyItem() { DisplayName = "subDemo11", Value = false, IsExpandable = true };
subDemo11.Properties.Add( subDemo111 );

var subDemo12 = new CustomPropertyItem() { DisplayName = "subDemo12", Value = false};

var demo1 = new CustomPropertyItem() { DisplayName = "Demo1", Value = false, IsExpandable = true };
demo1.Properties.Add( subDemo11 );
demo1.Properties.Add( subDemo12 );

var demo2 = new CustomPropertyItem() { DisplayName = "Demo2", Value = false };

_propertyGrid.Properties.Add( demo1 );
 _propertyGrid.Properties.Add( demo2 );
The result looks like this :
Image

New Post: Propertygrid CheckedTreeView (DropDownButton)

Commented Unassigned: PropertyGrid Category Header Style [22206]

$
0
0
How do we style the PropertyGrid Category Header (GroupItem)? I would like to be able to style the Background, Border and glyphs (Up_Arrow and Down_Arrow) in the Category Header. I can style other elements (including editors etc) but I can't see a way to style the Category Header. I have tried to replace the template (starting with the template provided by the VS Edit Template/Edit Copy tool) and even though I change colors etc for what appears to be the relevant elements in the template the Category Header remains unchanged. The one exception is the Foreground color which I can change in the Category Header.

Thank you,

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

Hum...it should work. It will work if you modify the files
-Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml (in Windows 8)
-Xceed,Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml (other Windows)

Can you send a sample with the problem so we could look at it ?
Thanks.

New Post: DateTimePicker popup size

$
0
0
Hi,

From what I can see, you have used DateTimePicker.TimePickerVisibility="Hidden". Any others properties used ?
The Calendar header is not horizontally centered. It should be. Have you changed anything in the Calendar ? Or in the DateTimePicker's popup ?
Can you send a small sample with this issue ?
Thanks.

New Post: DateTimePicker popup size

$
0
0
What version of the Toolkit are you using ?

New Comment on "DateTimePicker"

$
0
0
Hi, This is fixed in v2.9. Only 1 event is raised on ValueChanged.

Created Feature: PropertyGrid : Search in sub-level not working [22226]


New Post: PropertyGrid search improvements

$
0
0
Hi,

-Search including subclasses (ExpandableObject) :
This is a known issue at Xceed. Issue https://wpftoolkit.codeplex.com/workitem/22226 has been created in CodePlex. You can vote for it


-Search including any point of a property name, not just the beginning of it :
This is fixed in v2.7. The search is not a "StartsWith()" anymore, it is a "Contains()".

New Post: Access DatePickerTextBox of DatePicker control

$
0
0
I am trying to get access to the DatePickerTextBox of the DatePicker control. The reason is to highlight the different date parts as a user types in the date.

Desired behavior:
The user clicks into the text box and the month is highlighted. They can then enter 10. At this point the control validates the month and if it is valid the day part is highlighted. They proceed to enter 23. The day is validated and if it is valid the year part is highlighted.

A user could click into the text box enter 10232015 and the result would be 10/23/2015

Any help would be great. Trying to avoid creating my own control.

Thanks

New Post: [Propertygrid] Show/Hide Properties depending on enum

$
0
0
Hello,

I have the following data structure
 public class DailyBackupOptions
    {
        public int EveryXDays { get; set; }
    }

    public class WeeklyBackupOptions
    {
        public List<DayOfWeek> DaysOfTheWeek { get; set; } = new List<DayOfWeek>();

        public int EveryXWeeks { get; set; }
    }

    public enum BackupOption
    {
        Daily,
        Weekly
    }
My Class that is shown in the propertygrid looks as follows:
 public class DbConnection : DbItem
    {
       
        public BackupOption SelectedBackupOption { get; set; }

        public DailyBackupOptions DailyBackupOptions { get; set; } = new DailyBackupOptions();

        public WeeklyBackupOptions WeeklyBackupOptions { get; set; } = new WeeklyBackupOptions();

    }
What i now want to accomplish is that depending on the value of SelectedBackupOption i want to show the properties of my DailyBackupOptions or WeeklyBackupOptions and hide the other one. Is this possible, and if yes, how?

Thanks for helping

New Post: MessageBox only opens once

$
0
0
I resolved it. It seems to be related to the fact that my main window is winforms and the rest hosted with elementhost. I noticed that it was not just your messagebox that had a problem opening more than once, it was other wpf windows opened from a hosted usercontrol also. The solution HERE solved it.

Basically you need to put the below code for the mainform Load event.
if (System.Windows.Application.Current == null) 
{ 
    new System.Windows.Application { ShutdownMode = ShutdownMode.OnExplicitShutdown }; 
}
And then for the in the ForClosed event
Application.Current.Shutdown()

New Post: Access DatePickerTextBox of DatePicker control

$
0
0
Hi,

You can access the TextBox of the DateTimePicker via its "TextBox" property :
 public class MyDateTimePicker : DateTimePicker
  {
    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();

      var textBox = this.TextBox;
    }
  }
Starting at v2.7, you can type 10/23/2015 and "Enter" to validate the input. (You need the separators).

New Post: [Propertygrid] Show/Hide Properties depending on enum

$
0
0
Hi,
in v2.9, you can register to event "PropertyGrid.IsPropertyBrowsable". On the initialisation of each PropertyItem, this event will be called. Into it, you can tell if a PropertyItem is visible or not depending on your "SelectedBackupOption" property.
You then only need to add the attribute "RefreshProperties" on your SelectedBackupOption property to refresh the propertyGrid when this property is modified :
<xctk:PropertyGrid SelectedObject="{Binding}"
                         IsPropertyBrowsable="PropertyGrid_IsPropertyBrowsable"/>



 public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();

      this.DataContext = new DbConnection()
      {
        DailyBackupOptions = new DailyBackupOptions() { EveryXDays = 5 },
        WeeklyBackupOptions = new WeeklyBackupOptions() { EveryXWeeks = 4, DaysOfTheWeek = new List<DayOfWeek>() { DayOfWeek.Friday, DayOfWeek.Saturday } },
        SelectedBackupOption = BackupOption.Daily
      };
    }

    private void PropertyGrid_IsPropertyBrowsable( object sender, IsPropertyBrowsableArgs e )
    {
      if( e.PropertyDescriptor != null )
      {
        if( e.PropertyDescriptor.Name == "DailyBackupOptions" )
        {
          if( ((DbConnection)this.DataContext).SelectedBackupOption == BackupOption.Weekly )
          {
            e.IsBrowsable = false;
          }
        }
        else if( e.PropertyDescriptor.Name == "WeeklyBackupOptions" )
        {
          if( ((DbConnection)this.DataContext).SelectedBackupOption == BackupOption.Daily )
          {
            e.IsBrowsable = false;
          }
        }
      }
    }
  }

  public class DbConnection
  {
    [RefreshProperties( RefreshProperties.All )]
    public BackupOption SelectedBackupOption
    {
      get; set;
    }

    public DailyBackupOptions DailyBackupOptions
    {
      get; set;
    } = new DailyBackupOptions();

    public WeeklyBackupOptions WeeklyBackupOptions
    {
      get; set;
    } = new WeeklyBackupOptions();
  }

  public class DailyBackupOptions
  {
    public int EveryXDays
    {
      get; set;
    }
  }

  public class WeeklyBackupOptions
  {
    public List<DayOfWeek> DaysOfTheWeek
    {
      get; set;
    } = new List<DayOfWeek>();

    public int EveryXWeeks
    {
      get; set;
    }
  }

  public enum BackupOption
  {
    Daily,
    Weekly
  }

New Post: How to set the title for LayoutAnchorable from MVVM binding?

$
0
0
Hi,

Unfortunately, the LayoutAnchorable is not part of the VisualTree, since a LayoutAnchorableControl will be created from it. But you can add a proxy which uses binding :
<StackPanel>
      <StackPanel.Resources>
            <FrameworkElement x:Key="ProxyElement"
                              DataContext="{Binding}" />
      </StackPanel.Resources>

      <ContentControl Visibility="Collapsed"
                      Content="{StaticResource ProxyElement}" />
      
      <xcad:DockingManager x:Name="DockingManager"
                           AllowMixedOrientation="True">
         <xcad:LayoutRoot x:Name="LayoutRoot">
            <xcad:LayoutPanel Orientation="Horizontal">
               <xcad:LayoutAnchorablePaneGroup DockWidth="3*"
                                               Orientation="Vertical">
                  <xcad:LayoutAnchorablePane DockHeight="*">
                     <xcad:LayoutAnchorable Title="{Binding DataContext.TitleToBeDisplayed, Source={StaticResource ProxyElement}}"
                                            AutoHideHeight="240"
                                            CanClose="False"
                                            CanHide="False">
                        <Button Content="TEST"/>
                     </xcad:LayoutAnchorable>
                  </xcad:LayoutAnchorablePane>
                  <xcad:LayoutAnchorablePane DockHeight="*">
                     <xcad:LayoutAnchorable Title="{Binding DataContext.TitleToBeDisplayed1, Source={StaticResource ProxyElement}}"
                                            AutoHideHeight="240"
                                            CanClose="False"
                                            CanHide="False">
                        <Button Content="TEST2" />
                     </xcad:LayoutAnchorable>
                  </xcad:LayoutAnchorablePane>
               </xcad:LayoutAnchorablePaneGroup>
            </xcad:LayoutPanel>
         </xcad:LayoutRoot>
      </xcad:DockingManager>
   </StackPanel>
And make sure to set the DataContext of the MainWindow to the control containing the the bounded properties :
this.DataContext = this;

New Post: How to change the border brush for LayoutAnchorable?

$
0
0
Hi,

You can define a style for LayoutAnchorableControl and set the BorderBrush and BorderThickness :
<Style TargetType="{x:Type xcad:LayoutAnchorableControl}">
            <Setter Property="BorderBrush" Value="Red"/>
            <Setter Property="BorderThickness" Value="3"/>
</Style>

New Post: DateTimePicker popup size

$
0
0
I'm using 2.6.0

Here is my relevant XAML:
<Style
    TargetType="xctk:DateTimePicker">
    <Setter Property="Width" Value="100" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Margin" Value="0,10,0,0" />
    <Setter Property="IsTabStop" Value="True" />
    <Setter Property="AllowSpin" Value="False" />
    <Setter Property="AutoCloseCalendar" Value="True" />
    <Setter Property="Focusable" Value="True" />
    <Setter Property="Format" Value="Custom" />
    <Setter Property="FormatString" Value="MMMM d, yyyy" />
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="IsUndoEnabled" Value="False" />
    <Setter Property="Kind" Value="Local" />
    <Setter Property="ShowButtonSpinner" Value="False" />
    <Setter Property="TimePickerAllowSpin" Value="False" />
    <Setter Property="TimePickerShowButtonSpinner" Value="False" />
    <Setter Property="TimePickerVisibility" Value="Hidden" />
    <Setter Property="UpdateValueOnEnterKey" Value="True" />
    <Setter Property="Height" Value="22" />
    <Setter Property="Width" Value="120" />
</Style>
and here is how I instantiate the control:
xctk:DateTimePicker
    x:Name="dprChargeDate"
    Value="{Binding Path=ChargeDate, Mode=TwoWay}" />
I hope that helps.

Commented Unassigned: PropertyGrid not thread safe for multiple ui threads [22187]

$
0
0
Hi,

I'll just reopend this issue - I just tested it with v2.6 but the reported issue still exists!

* I am starting a window in its own UI thread.
* The window contains a propertygrid. At some time I close the window and stop the dispatcher.
* At a later stage I decide to start a new instance of the same window class in new UI Thread (with it's own dispatcher).
* When this window is created, I get the exception reported below
```
exception Details (key=value): (System.Object=) System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Threading.DispatcherObject.VerifyAccess()
at System.Windows.SystemResources.FindCachedResource(Object key, Object& resource, Boolean mustReturnDeferredResourceReference)
at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
at System.Windows.FrameworkElement.FindResourceInternal(FrameworkElement fe, FrameworkContentElement fce, DependencyProperty dp, Object resourceKey, Object unlinkedParent, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, DependencyObject boundaryElement, Boolean isImplicitStyleLookup, Object& source)
at System.Windows.FrameworkElement.FindResource(Object resourceKey)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.UpdateContainerHelper() in z:\Test\PropertyGridTest\ToolkitSrc\Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.Toolkit\PropertyGrid\Implementation\PropertyGrid.cs:line 888
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnSelectedObjectChanged(Object oldValue, Object newValue) in z:\Test\PropertyGridTest\ToolkitSrc\Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.Toolkit\PropertyGrid\Implementation\PropertyGrid.cs:line 452
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnSelectedObjectChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) in z:\Test\PropertyGridTest\ToolkitSrc\Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.Toolkit\PropertyGrid\Implementation\PropertyGrid.cs:line 440
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e) in z:\Test\PropertyGridTest\ToolkitSrc\Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.Toolkit\PropertyGrid\Implementation\PropertyGrid.cs:line 807
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
```

For me it seems like the new property grid in the window is caching some data created by the previous UI thread. I just cannot find out what it is.

Do you have any idea?
Comments: ** Comment from web user: cls71 **


Hello,

This issue persists in the current version 2.6.0 Community Edition.


2016-04-03 12:54:39:710 Starting server message polling timer with interval 3600 seconds...
2016-04-03 12:56:44:117 *************** unhandled exception trapped ***************
2016-04-03 12:56:44:117 The calling thread cannot access this object because a different thread owns it.
2016-04-03 12:56:44:117 System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.SystemResources.FindCachedResource(Object key, Object& resource, Boolean mustReturnDeferredResourceReference)
at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
at System.Windows.FrameworkElement.FindResourceInternal(FrameworkElement fe, FrameworkContentElement fce, DependencyProperty dp, Object resourceKey, Object unlinkedParent, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, DependencyObject boundaryElement, Boolean isImplicitStyleLookup, Object& source)
at System.Windows.FrameworkElement.FindResource(Object resourceKey)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.UpdateContainerHelper()
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnSelectedObjectChanged(Object oldValue, Object newValue)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnSelectedObjectChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at Xceed.Wpf.Toolkit.PropertyGrid.PropertyGrid.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)

etc

New Post: PropertyGrid Expand/Collapse All

$
0
0
Hello,

Are there methods which will expand or collapse certain or all ExpandableObject properties?
I also think these actions would be a great fit as buttons in the top toolbar.

Thanks.

New Post: propertyGrid show items for expanded collection

Viewing all 4964 articles
Browse latest View live


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