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

Edited Feature: PropertyGrid TimeSpan editor does not support span greater than 24h [18928]

$
0
0
From Issue:
http://wpftoolkit.codeplex.com/workitem/18854
Comments: ** Comment from web user: BoucherS **

The PropertyGrid will contain a TimeSpanEditor that supports timeSpan greater than 24h in v2.2.


New Post: Turning off alternating rows in Data Grid

$
0
0
Thanks. That worked like a charm!

New Post: CheckComboBox - ItemTemplate

$
0
0
Good morning,
i have some troubles with implementation of ItemTemplate to CheckComboBox. I need to customize viewing of enum values, but when i try to implement any DataTemplate, CheckComboBox does not react. May be i do some thing wrong?
<Style x:Key="comboItemContanerStyle" TargetType="{x:Type xctk:SelectorItem}">
  <Setter Property="Background" Value="Transparent" />
  <Setter Property="IsTabStop" Value="False" />
  <Setter Property="BorderThickness" Value="1" />
  <Setter Property="VerticalContentAlignment" Value="Center" />
  <Setter Property="Template" >
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type xctk:SelectorItem}">
        <Border x:Name="_background" 
                     Background="{TemplateBinding Background}" 
                     BorderBrush="{TemplateBinding BorderBrush}" 
                     BorderThickness="{TemplateBinding BorderThickness}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="auto"/>
               <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <CheckBox VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                      IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}" 
                      Grid.Column="0"/>
              <ContentPresenter Content="{TemplateBinding Content}"
                                          Grid.Column="1"
                                          Margin="5,0,0,0"/>
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
          <Trigger Property="IsMouseOver" Value="true">
            <Setter TargetName="_background" Property="Background" Value="#FFB8E0F3" />
            <Setter TargetName="_background" Property="BorderBrush" Value="#FF26A0DA" />
          </Trigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

<DataTemplate x:Key="WrappingComboTemplate">
  <TextBlock Text="{Binding Converter={StaticResource convert}}" />
</DataTemplate>

<xctk:CheckComboBox VerticalAlignment="Bottom"
                                  MaxHeight="50"
                                  Visibility="Collapsed"
                                  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                  ItemContainerStyle="{StaticResource comboItemContanerStyle}"
                                  ItemTemplate="{StaticResource WrappingComboTemplate}"/>

New Post: CheckComboBox - ItemTemplate

$
0
0
Hi,

I used your code to make some tests :
First, make sure the Visibility of the CheckComboBox is Visible :-)
Then, only using the ItemTemplate for the CheckComboBox, the Converter does its job.
Then adding the ItemContainerStyle to the CheckComboBox prevent the Converter from doing its job...like you point out.
In the ControlTemplate of the comboItemContanerStyle, there is a ContentPresenter. Simply add
ContentTemplate="{TemplateBinding ContentTemplate}"
to it. It will do the job.

Here's the complete xaml
<Window x:Class="WpfApplication88.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:local="clr-namespace:WpfApplication88"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style x:Key="comboItemContanerStyle"
               TargetType="{x:Type xctk:SelectorItem}">
            <Setter Property="Background"
                    Value="Transparent" />
            <Setter Property="IsTabStop"
                    Value="False" />
            <Setter Property="BorderThickness"
                    Value="1" />
            <Setter Property="VerticalContentAlignment"
                    Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type xctk:SelectorItem}">
                        <Border x:Name="_background"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <CheckBox VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                          IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}"
                                          Grid.Column="0" />
                                <ContentPresenter Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Grid.Column="1"
                                                  Margin="5,0,0,0" />
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver"
                                     Value="true">
                                <Setter TargetName="_background"
                                        Property="Background"
                                        Value="#FFB8E0F3" />
                                <Setter TargetName="_background"
                                        Property="BorderBrush"
                                        Value="#FF26A0DA" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <local:MyConverter x:Key="convert" />

        <DataTemplate x:Key="WrappingComboTemplate">
            <TextBlock Text="{Binding Converter={StaticResource convert}}" />
        </DataTemplate>
    </Window.Resources>
    
    <Grid>
        <xctk:CheckComboBox x:Name="_checkComboBox"
                            VerticalAlignment="Bottom"
                            MaxHeight="50"
                            Visibility="Visible"
                            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                            ItemContainerStyle="{StaticResource comboItemContanerStyle}"
                            ItemTemplate="{StaticResource WrappingComboTemplate}"/>
    </Grid>
</Window>

Commented Unassigned: DateTimePicker select date bug [20441]

$
0
0
When I try to use DateTimePicker from Extended Wpf Toolkit I found this strange behaviour.
If I set up time any value differs from 0:00 and then try to select day in the next month
![Image](http://i017.radikal.ru/1311/b5/f776a9771e39.jpg)
calendar skip this month and go to the next.
For example, if I try select date November 8, 2015 selected date will be December 6, 2015.
We have two changes (current month is October): one in November and one in Decmber.
It happend becouse date changing twice: one time when mouse down occurs and one when occurs mouse up. The result view is:
![Image](http://s57.radikal.ru/i156/1311/81/df70da71f784.jpg)
In the text field we see the correct month,
![Image](http://s005.radikal.ru/i212/1311/76/42bc2297dcec.jpg)
but in the calendar view there is December.
![Image](http://i021.radikal.ru/1311/0e/70962c098bfc.jpg)
What can I do?
Comments: ** Comment from web user: wizzard2012 **

I found how to overcome this bug!

private bool _isMouseDown; //mouse button is pressed

public override void OnApplyTemplate()
{
base.OnApplyTemplate();

if( _popup != null )
_popup.Opened -= Popup_Opened;

_popup = GetTemplateChild( PART_Popup ) as Popup;

if( _popup != null )
_popup.Opened += Popup_Opened;

if (_calendar != null)
{
_calendar.SelectedDatesChanged -= Calendar_SelectedDatesChanged;
_calendar.PreviewMouseDown -= Calendar_PreviewMouseDown;
_calendar.PreviewMouseUp -= Calendar_PreviewMouseUp;
}

_calendar = GetTemplateChild( PART_Calendar ) as Calendar;

if( _calendar != null )
{
_calendar.SelectedDatesChanged += Calendar_SelectedDatesChanged;
_calendar.PreviewMouseDown += new MouseButtonEventHandler(Calendar_PreviewMouseDown);
_calendar.PreviewMouseUp += new MouseButtonEventHandler(Calendar_PreviewMouseUp);
_calendar.SelectedDate = Value ?? null;
_calendar.DisplayDate = Value ?? DateTime.Now;
}

_timePicker = GetTemplateChild( PART_TimeUpDown ) as TimePicker;
}

void Calendar_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
_isMouseDown = true;
}

void Calendar_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
_isMouseDown = false;
}

protected override void OnValueChanged( DateTime? oldValue, DateTime? newValue )
{
if( _calendar != null && _calendar.SelectedDate != newValue )
{
_calendar.SelectedDate = newValue;
if (!_isMouseDown) // we do not need to update dispay if mouse is pressed
_calendar.DisplayDate = newValue ?? DateTime.Now;
}

base.OnValueChanged( oldValue, newValue );
}

New Post: Problem with Propertygrid and fonts

$
0
0
Is there a requirement to create a custom typeconverter or typeEditor for fonts? I can't seem to get fonts to display properly.

Thanks.

Created Unassigned: AvalonDock Now Loses Alt Key Adornments [20471]

$
0
0
I've been using AvalonDock (2.0) for some time now, being key for managing documents in an IDE. In the last month or so, I've noticed that Alt key adornments are no longer showing up for controls within AvalonDock, though the Alt key commands are executing as expected. See the image below where the Alt key adornments are showing up in the menu, but not for the buttons inside AvalonDock:

![No Alt Keys](http://i.stack.imgur.com/KnomF.png)

What is particularly interesting about this issue, that it appears to be triggered by an environmental setting or condition.

As demonstrated in this [video](http://www.youtube.com/watch?v=D-S_PGJoTkc) (at 2:07), the alt key adornments are working for a control within AvalonDock. But, if I now use the very same executable I used in that video, the alt key adornments do not work.

I'm currently using build 2.0.1746, but I also tried build 2.0.2000 (with the Xceed namespace) and found the same issue. I also tried this Xceed Extended WPF Toolkit, and found that the issue persists.

I also built a very simple test application which loads a couple of documents of type Item, where Item is a simple class with a Name property:

```
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
xmlns:avalonDock="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
xmlns:avalonDockLayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
xmlns:avalonDockControls="clr-namespace:Xceed.Wpf.AvalonDock.Controls;assembly=Xceed.Wpf.AvalonDock"
Title="MainWindow" Height="500" Width="500">
<Window.Resources>
<ResourceDictionary>
<DataTemplate DataType="{x:Type local:Item}">
<StackPanel Orientation="Vertical">
<Label Content="Item:" />
<TextBox Text="{Binding Name}"/>
<Button Content="_ClickMe" />
</StackPanel>
</DataTemplate>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<avalonDock:DockingManager Grid.Row="0" DocumentsSource="{Binding}">
<avalonDockLayout:LayoutRoot>
<avalonDockLayout:LayoutPanel Orientation="Horizontal">
<avalonDockLayout:LayoutDocumentPane/>
</avalonDockLayout:LayoutPanel>
</avalonDockLayout:LayoutRoot>
</avalonDock:DockingManager>
<Button Grid.Row="1" Content="_Test" />
</Grid>
</Window>
```

Even with this simple application, the Alt key adornments show up for the Test button outside of AvalonDock, but not for the ClickMe buttons for the controls within AvalonDock.

Any ideas on how to correct or workaround this issue?

Edited Issue: DateTimePicker select date bug [20441]

$
0
0
When I try to use DateTimePicker from Extended Wpf Toolkit I found this strange behaviour.
If I set up time any value differs from 0:00 and then try to select day in the next month
![Image](http://i017.radikal.ru/1311/b5/f776a9771e39.jpg)
calendar skip this month and go to the next.
For example, if I try select date November 8, 2015 selected date will be December 6, 2015.
We have two changes (current month is October): one in November and one in Decmber.
It happend becouse date changing twice: one time when mouse down occurs and one when occurs mouse up. The result view is:
![Image](http://s57.radikal.ru/i156/1311/81/df70da71f784.jpg)
In the text field we see the correct month,
![Image](http://s005.radikal.ru/i212/1311/76/42bc2297dcec.jpg)
but in the calendar view there is December.
![Image](http://i021.radikal.ru/1311/0e/70962c098bfc.jpg)
What can I do?
Comments: ** Comment from web user: BoucherS **

This issue will be fixed in v2.2.


Updated Wiki: Home

$
0
0
December 2013 update: v2.1.0 of the Plus Edition with another record-breaking Plus Edition
80 bug fixes and improvements (see list) sent to subscribers, with Community Edition to be updated in a few weeks with 70+ bug fixes and improvements.

Extended WPF Toolkit™ is the number one collection of WPF controls, components and utilities for creating next generation Windows applications. Use it to build professional looking, modern, and easy to use line of business applications. The Extended WPF Toolkit project has been downloaded more than 200,000 times here and on Nuget.

The free, open source Community Edition is provided under the Microsoft Public License and includes the following controls:

AvalonDocknew in 2.0AutoSelectTextBoxBusyIndicatorButtonSpinner
CalculatorCalculatorUpDownCheckComboBoxCheckListBox
ChildWindownew featuresCollectionEditorDataGridCollectionControlDialog
ColorCanvasColorPickerDateTimePickerDateTimeUpDown
DecimalUpDownDoubleUpDownDropDownButtonIntegerUpDown
MagnifierMaskedTextBoxMessageBoxnew featuresMultiLineTextEditor
PiePrimitiveTypeCollEditorPropertyGridnew featuresRichTextBox
RichTextBoxFormatBarSplitButtonPanels/Layoutsnew in 1.9TimelinePanel
TimePickerWatermarkTextBoxWindowContainernew in 2.0 WindowControl new in 2.0
Windows 8 Theme new in 2.0WizardZoombox

Upgrade to Extended WPF Toolkit Plus to get even more controls, features, and professional support.

Latest News

New Live Explorer app available online as a Click Once app. Try it now!.

 
Bitcoin You can purchase with bitcoins and get a 1-year, 1-developer subscription for the Plus Edition for only 0.3 BTC! Just scroll down to the bottom of any page on http://wpftoolkit.com and select 'Pay with Bitcoin'.

- released Community Edition v2.0.0 containing 67 new improvements (see list).

 
Extended WPF Toolkit Plus- released Plus Edition v2.0.0 containing a variety of new controls and enhancements, including a styleable and feature-rich Chart control.

- released v1.9.0 of the Community Edition, our biggest update in 2013. It contains a record-breaking 70 improvements (see the complete list) and a new control.

Action items

  • Enjoy WPF!
  • Please rate this release and write something positive. It's at the bottom of the downloads page
  • Follow this project (click "follow" at the top right of this page)
  • Follow @datagrid on Twitter for WPF and Toolkit news
  • Like Xceed's WPF page on Facebook
  • Check out a video or two on XceedVideos YouTube Channel
  • Add bugs or feature requests to the Issue Tracker

community-full.png

Updated Wiki: Home

$
0
0
December 2013 update: v2.1.0 of the Plus Edition with another record-breaking Plus Edition
80 bug fixes and improvements (see list) sent to subscribers, with Community Edition to be updated in a few weeks with 70+ bug fixes and improvements.

WPF_toolkit_big_banner.png

Extended WPF Toolkit™ is the number one collection of WPF controls, components and utilities for creating next generation Windows applications. Use it to build professional looking, modern, and easy to use line of business applications. The Extended WPF Toolkit project has been downloaded more than 200,000 times here and on Nuget.

The free, open source Community Edition is provided under the Microsoft Public License and includes the following controls:

AvalonDocknew in 2.0AutoSelectTextBoxBusyIndicatorButtonSpinner
CalculatorCalculatorUpDownCheckComboBoxCheckListBox
ChildWindownew featuresCollectionEditorDataGridCollectionControlDialog
ColorCanvasColorPickerDateTimePickerDateTimeUpDown
DecimalUpDownDoubleUpDownDropDownButtonIntegerUpDown
MagnifierMaskedTextBoxMessageBoxnew featuresMultiLineTextEditor
PiePrimitiveTypeCollEditorPropertyGridnew featuresRichTextBox
RichTextBoxFormatBarSplitButtonPanels/Layoutsnew in 1.9TimelinePanel
TimePickerWatermarkTextBoxWindowContainernew in 2.0 WindowControl new in 2.0
Windows 8 Theme new in 2.0WizardZoombox

Upgrade to Extended WPF Toolkit Plus to get even more controls, features, and professional support.

Latest News

New Live Explorer app available online as a Click Once app. Try it now!.

 
Bitcoin You can purchase with bitcoins and get a 1-year, 1-developer subscription for the Plus Edition for only 0.3 BTC! Just scroll down to the bottom of any page on http://wpftoolkit.com and select 'Pay with Bitcoin'.

- released Community Edition v2.0.0 containing 67 new improvements (see list).

 
Extended WPF Toolkit Plus- released Plus Edition v2.0.0 containing a variety of new controls and enhancements, including a styleable and feature-rich Chart control.

- released v1.9.0 of the Community Edition, our biggest update in 2013. It contains a record-breaking 70 improvements (see the complete list) and a new control.

Action items

  • Enjoy WPF!
  • Please rate this release and write something positive. It's at the bottom of the downloads page
  • Follow this project (click "follow" at the top right of this page)
  • Follow @datagrid on Twitter for WPF and Toolkit news
  • Like Xceed's WPF page on Facebook
  • Check out a video or two on XceedVideos YouTube Channel
  • Add bugs or feature requests to the Issue Tracker

community-full.png

Updated Wiki: Home

$
0
0
December 2013 update: v2.1.0 of the Plus Edition with another record-breaking Plus Edition
80 bug fixes and improvements (see list) sent to subscribers, with Community Edition to be updated in a few weeks with 70+ bug fixes and improvements.

Extended WPF Toolkit Plus

Extended WPF Toolkit™ is the number one collection of WPF controls, components and utilities for creating next generation Windows applications. Use it to build professional looking, modern, and easy to use line of business applications. The Extended WPF Toolkit project has been downloaded more than 200,000 times here and on Nuget.

The free, open source Community Edition is provided under the Microsoft Public License and includes the following controls:

AvalonDocknew in 2.0AutoSelectTextBoxBusyIndicatorButtonSpinner
CalculatorCalculatorUpDownCheckComboBoxCheckListBox
ChildWindownew featuresCollectionEditorDataGridCollectionControlDialog
ColorCanvasColorPickerDateTimePickerDateTimeUpDown
DecimalUpDownDoubleUpDownDropDownButtonIntegerUpDown
MagnifierMaskedTextBoxMessageBoxnew featuresMultiLineTextEditor
PiePrimitiveTypeCollEditorPropertyGridnew featuresRichTextBox
RichTextBoxFormatBarSplitButtonPanels/Layoutsnew in 1.9TimelinePanel
TimePickerWatermarkTextBoxWindowContainernew in 2.0 WindowControl new in 2.0
Windows 8 Theme new in 2.0WizardZoombox

Upgrade to Extended WPF Toolkit Plus to get even more controls, features, and professional support.

Latest News

New Live Explorer app available online as a Click Once app. Try it now!.

 
Bitcoin You can purchase with bitcoins and get a 1-year, 1-developer subscription for the Plus Edition for only 0.3 BTC! Just scroll down to the bottom of any page on http://wpftoolkit.com and select 'Pay with Bitcoin'.

- released Community Edition v2.0.0 containing 67 new improvements (see list).

 
Extended WPF Toolkit Plus- released Plus Edition v2.0.0 containing a variety of new controls and enhancements, including a styleable and feature-rich Chart control.

- released v1.9.0 of the Community Edition, our biggest update in 2013. It contains a record-breaking 70 improvements (see the complete list) and a new control.

Action items

  • Enjoy WPF!
  • Please rate this release and write something positive. It's at the bottom of the downloads page
  • Follow this project (click "follow" at the top right of this page)
  • Follow @datagrid on Twitter for WPF and Toolkit news
  • Like Xceed's WPF page on Facebook
  • Check out a video or two on XceedVideos YouTube Channel
  • Add bugs or feature requests to the Issue Tracker

community-full.png

Updated Wiki: Home

$
0
0
December 2013 update: v2.1.0 of the Plus Edition with another record-breaking 80 bug fixes and improvements (see list) sent to subscribers, with Community Edition to be updated in a few weeks with 70+ bug fixes and improvements.

Extended WPF Toolkit Plus

Extended WPF Toolkit™ is the number one collection of WPF controls, components and utilities for creating next generation Windows applications. Use it to build professional looking, modern, and easy to use line of business applications. The Extended WPF Toolkit project has been downloaded more than 200,000 times here and on Nuget.

The free, open source Community Edition is provided under the Microsoft Public License and includes the following controls:

AvalonDocknew in 2.0AutoSelectTextBoxBusyIndicatorButtonSpinner
CalculatorCalculatorUpDownCheckComboBoxCheckListBox
ChildWindownew featuresCollectionEditorDataGridCollectionControlDialog
ColorCanvasColorPickerDateTimePickerDateTimeUpDown
DecimalUpDownDoubleUpDownDropDownButtonIntegerUpDown
MagnifierMaskedTextBoxMessageBoxnew featuresMultiLineTextEditor
PiePrimitiveTypeCollEditorPropertyGridnew featuresRichTextBox
RichTextBoxFormatBarSplitButtonPanels/Layoutsnew in 1.9TimelinePanel
TimePickerWatermarkTextBoxWindowContainernew in 2.0 WindowControl new in 2.0
Windows 8 Theme new in 2.0WizardZoombox

Upgrade to Extended WPF Toolkit Plus to get even more controls, features, and professional support.

Latest News

New Live Explorer app available online as a Click Once app. Try it now!.

 
Bitcoin You can purchase with bitcoins and get a 1-year, 1-developer subscription for the Plus Edition for only 0.3 BTC! Just scroll down to the bottom of any page on http://wpftoolkit.com and select 'Pay with Bitcoin'.

- released Community Edition v2.0.0 containing 67 new improvements (see list).

 
Extended WPF Toolkit Plus- released Plus Edition v2.0.0 containing a variety of new controls and enhancements, including a styleable and feature-rich Chart control.

- released v1.9.0 of the Community Edition, our biggest update in 2013. It contains a record-breaking 70 improvements (see the complete list) and a new control.

Action items

  • Enjoy WPF!
  • Please rate this release and write something positive. It's at the bottom of the downloads page
  • Follow this project (click "follow" at the top right of this page)
  • Follow @datagrid on Twitter for WPF and Toolkit news
  • Like Xceed's WPF page on Facebook
  • Check out a video or two on XceedVideos YouTube Channel
  • Add bugs or feature requests to the Issue Tracker

community-full.png

New Post: Problem with Propertygrid and fonts

$
0
0
Hi,

What exactly are you trying to do ? Can you provide a snippet ?

Here's a test :
In XAML :
<Grid>
        <xctk:PropertyGrid x:Name="_propertyGrid" />
</Grid>

In Code-Behind :
 public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();

      _propertyGrid.SelectedObject = new MyTest()
      {
        EditorFont = new Font()
        {
          MyFontFamily = new FontFamily("Stencil"),
          Size = 13
        }
      }; 
    }
  }

  public class MyTest
  {
    // Property in class
    private Font _editorFont;

    [Category( "Workspace" ),
    Description( "The font used for editing documents." ),
    DisplayName( "Editor Font" ),
    ExpandableObject()]
    public Font EditorFont
    {
      get
      {
        return _editorFont;
      }
      set
      {
        _editorFont = value;
      }
    }
  }

  [TypeConverter(typeof(FontConverter))]
  public class Font
  {
    public FontFamily MyFontFamily
    {
      get;
      set;
    }

    public int Size
    {
      get;
      set;
    }
  }

  public class FontConverter : TypeConverter
  {
    public FontConverter()
    {
    }

    public override bool CanConvertTo( ITypeDescriptorContext context, Type destinationType )
    {
      return ( destinationType == typeof( string ) )
        || base.CanConvertTo( context, destinationType );
    }

    public override bool CanConvertFrom( ITypeDescriptorContext context, Type sourceType )
    {
      return ( sourceType == typeof( string ) )
        || base.CanConvertFrom( context, sourceType );
    }

    public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType )
    {
      if( ( destinationType == typeof( string ) ) )
      {
        return "My Font";
      }
      return base.ConvertTo( context, culture, value, destinationType );
    }

    public override object ConvertFrom( ITypeDescriptorContext context, CultureInfo currentCulture, object value )
    {
      if( value != null && ( value is string ) )
      {
        return new Font();
      }
      return base.ConvertFrom( context, currentCulture, value );
    }
  }

Created Unassigned: Allow PropertyGrid to use attributes from MetadataType [20482]

$
0
0
I propose a change to the PropertyGrid to allow the use of an associated MetadataType class to define attributes such as DisplayName. This is useful when dealing with auto generated partial classes.

The change is minor, but it does add a dependency on System.ComponentModel.DataAnnotations. The full file is attached, but the change is to use AssociatedMetadataTypeTypeDescriptionProvider to retrieve the PropertyDescriptors.

```
protected static List<PropertyDescriptor> GetPropertyDescriptors( object instance )
{
PropertyDescriptorCollection descriptors;

TypeConverter tc = TypeDescriptor.GetConverter( instance );
if( tc == null || !tc.GetPropertiesSupported() )
{
if (instance is ICustomTypeDescriptor)
descriptors = ((ICustomTypeDescriptor)instance).GetProperties();
else
// descriptors = TypeDescriptor.GetProperties( instance.GetType() );
{
AssociatedMetadataTypeTypeDescriptionProvider provider = new AssociatedMetadataTypeTypeDescriptionProvider(instance.GetType());
descriptors = provider.GetTypeDescriptor(instance).GetProperties();
}
}
else
{
descriptors = tc.GetProperties( instance );
}

return ( descriptors != null )
? descriptors.Cast<PropertyDescriptor>().ToList()
: null;
}
```

New Post: Problem with Propertygrid and fonts

$
0
0
I was playing around the the PropertyGrid and I created a simple project to test the WPF PropertyGrid. Using a standard Windows.Forms PropertyGrid and the System.Drawing.Font object you can simply create a property the the Font type and the PropertyGrid displays it using the default TypeEditor. With the WPF PropertyGrid in the Toolkit, this was not the case.

My original question was whether or not I needed to create my own TypeEditor(s) for such objects. It is also the only way I could use a font with the control. Sorry for the lengthy code.

The preferences class:
    [Serializable]
    public class Preferences
    {
        private WpFFont _editorFont =  new WpFFont( 
            new FontFamily("Segoe UI"), 
            9.75F, FontWeights.Normal, 
            FontStyles.Normal, FontStretches.Normal );

        [Category("Editor"),
        DisplayName("Font"),
        Description("The font used for the editor.")]
        public WpFFont EditorFont
        {
            get { return _editorFont; }
            set { _editorFont = value; }
        }
    }
The custom font class:
    [Serializable, ExpandableObject]
    public class WpFFont
    {
        private FontFamily _family;
        private FontStyle _style;
        private FontStretch _stretch;
        private FontWeight _weight;
        private double _size;

        public FontFamily Family
        {
            get { return _family; }
            set { _family = value; }
        }
        public FontWeight Weight
        {
            get { return _weight; }
            set { _weight = value; }
        }
        public FontStretch Stretch
        {
            get { return _stretch; }
            set { _stretch = value; }
        }
        public double FontSize
        {
            get { return _size; }
            set { _size = value; }
        }
        public FontStyle Style
        {
            get { return _style; }
            set { _style = value; }
        }

        public WpFFont() { }

        public WpFFont( FontFamily family, double fontSize, FontWeight weight, FontStyle style, FontStretch stretch )
        {
            this.Family = family;
            this.FontSize = fontSize;
            this.Weight = weight;
            this.Style = style;
            this.Stretch = stretch;
        }

        public override string ToString()
        {
            return string.Format( "{0},{1},{2},{3},{4}", Family, FontSize, Weight, Style, Stretch );
        }
    }
I have written help documentation myself and it can be a arduous task. Too bad there is not better documentation for the Toolkit.

Regards,
Mark

New Post: Problem with Propertygrid and fonts

$
0
0
Hi Mark,

From what I understand, you want to see the new Font modified in the propertyGrid. I added a button and when clicked, the Font of the PropertyGrid.SelectedObject is modified :
Preferences pref = null;
pref = new Preferences();
_propertyGrid.SelectedObject = pref;

private void Button_Click_1( object sender, RoutedEventArgs e )
 {
      pref.EditorFont = new WpFFont( new FontFamily( "Arial" ), 17F, FontWeights.Bold,
                                               FontStyles.Italic, FontStretches.Normal );
 }
You have 2 options to reflect the changes in the propertyGrid:
Option 1)
You can call "_propertyGrid.Update()" right after the assignment of pref.EditorFont in the Button_Click_1 method. This will force an update of all properties in the propertyGrid.

Option 2)
The "Preferences" class can implement the interface "INotifyPropertyChanged" and look like this :
 public class Preferences : INotifyPropertyChanged
  {
    private WpFFont _editorFont = new WpFFont( new FontFamily( "Segoe UI" ), 9.75F, FontWeights.Normal,
                                               FontStyles.Normal, FontStretches.Normal );

    [Category( "Editor" ),
    DisplayName( "Font" ),
    Description( "The font used for the editor." )]
    public WpFFont EditorFont
    {
      get
      {
        return _editorFont;
      }
      set
      {
        _editorFont = value;
        this.OnPropertyChanged( "EditorFont" );
      }
    }

    #region INotifyPropertyChanged
    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged( string name )
    {
      if( PropertyChanged != null )
      {
        PropertyChanged( this, new PropertyChangedEventArgs( name ) );
      }
    }
    #endregion
  }
This way, the PropertyGrid will be notified of a propertyChange on its selectedObject and will update.

New Post: Problem with Propertygrid and fonts

$
0
0
There is already a built-in PropertyValueChanged event. I got it to work; however, some fonts don't update the stretch and style.

Thanks for the help!
        private void testPropertyGrid_PropertyValueChanged( object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e )
        {
            if ( e.OldValue != e.NewValue )
            {
                try
                {
                    // A lot of code just to update a font in a control.
                    testStringTextBox.FontFamily = preferences.EditorFont.Family;
                    testStringTextBox.FontSize = preferences.EditorFont.FontSize;
                    testStringTextBox.FontStretch = preferences.EditorFont.Stretch;
                    testStringTextBox.FontStyle = preferences.EditorFont.Style;
                    testStringTextBox.FontWeight = preferences.EditorFont.Weight;
                }
                catch(Exception ex)
                {
                    MessageBox.Show( ex.Message, "Exception Error", MessageBoxButton.OK, MessageBoxImage.Error );
                }
            }
        }

Edited Feature: ColorPicker: Allow to sort color / Sort color differently [18700]

$
0
0
Based on Discussion:
 
http://wpftoolkit.codeplex.com/discussions/257235
 
There seems to be a need to sort the "standard colors" differently.
Comments: ** Comment from web user: BoucherS **

A new property will be added in v2.2 : ColorPicker.AvailableColorsSortingMode which will be
-Alphabetical
-HueSaturationBrightness

2 different modes of Color sort.

Closed Unassigned: PropertyGrid validation issue [19930]

$
0
0
When PropertyGrid.SelectedObject assigned to object having not valid values (with use IDataErrorInfo) then no red border appears, but tooltip with error message works. Property items gets highlighted when user clicks on the invalid field and then clicks another field.

I was not able to highlight such invalid fields programmatically, is there a workaround?
I'm using v.2.0

p.s. Also I was not able to control the same object other properties appearance. Calling OnPropertyChanged("PropName")
or prop.GetBindingExpression(PropertyItem.ValueProperty).UpdateSource();
did not lead to turn red border of PropertyItem on or off based on the validation result.

-Vitaly L
Comments: No feedback from client

New Post: Avalondock - Two Clicks on Button required

$
0
0
AFAIR, I have fixed this issue. I tested a scenario in the live explorer, and it seems to work.
Viewing all 4964 articles
Browse latest View live


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