New Comment on "DateTimePicker"
New Post: DateTimePicker popup size
"For long months (i.e., December) the date part at the top of the dropdown calendar is being truncated. For example, it looks like "December, 2" instead of "December, 2016". Is there a way to set the width of the dropdown?"
New Comment on "DateTimePicker"
New Post: DateTimePicker popup size
We cannot reproduce the issue and the December 2016 calendar title is completely visible.
http://postimg.org/image/ya3l74r19/
Please send an image or sample to show the issue.
Thanks.
New Post: BeepOnError not working for ValueRangeTextBox
"For the ValueRangeTextBox I have BeepOnError = True and ValueDataType="{x:Type s:Single}"
When I enter an alphanumeric into there is no beep. What are the conditions that will trigger the beep?"
Created Unassigned: BeepOnError not working for ValueRangeTextBox [22205]
New Post: BeepOnError not working for ValueRangeTextBox
Edited Issue: BeepOnError not working for ValueRangeTextBox [22205]
Comments: ** Comment from web user: BoucherS **
This will be fixed in v3.1.
Bip will be heard when Value is of the wrong type or when the value is out of range.
Created Unassigned: PropertyGrid Category Header Style [22206]
Thank you,
Scott
Commented Unassigned: PropertyGrid Category Header Style [22206]
Thank you,
Scott
Comments: ** Comment from web user: BoucherS **
Hi,
You can modify the Styles in the PropertyGrid. Go in file
-Xceed.Wpf.Toolkit/PropertyGrid/Themes/Aero2.NormalColor.xaml (in Windows 8)
-Xceed,Wpf.Toolkit/PropertyGrid/Themes/Generic.xaml (other Windows)
Look for the style named "ExpanderStyle" (you can modify Background and BorderBrush)
Look for the ControlTemplate named "ExpanderToggleButton" (you can modify Path.Data to have new glyphs)
New Post: CheckComboBox and [Flags] enum
[Flags]
public enum TestEnum
{
Test1 = 1,
Test2 = 2,
Test3 = 4,
Test4 = 8,
Test5 = 16,
Test6 = 32,
Test7 = 64,
}Because I can't know the enum definition at compile time, I would dynamically create an Enum using EnumBuilder. ( I can't rely on a compile-time enum. I would dynamically create an Enum using [EnumBuilder])
I created an editor to display the enum as CheckComboBox:
public class CheckComboBoxEditor : TypeEditor<CheckComboBox>, ITypeEditor
{
protected override void SetValueDependencyProperty()
{
ValueProperty = CheckComboBox.SelectedValueProperty;
}
protected override CheckComboBox CreateEditor()
{
return new CheckComboBox();
}
protected override void ResolveValueBinding(PropertyItem propertyItem)
{
var _binding = new Binding("Value");
_binding.Source = propertyItem;
_binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
_binding.Mode = BindingMode.TwoWay;
_binding.Converter = CreateValueConverter();
BindingOperations.SetBinding(Editor, CheckComboBox.SelectedValueProperty, _binding);
var _binding2 = new Binding("Value");
_binding2.Source = propertyItem;
_binding2.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
_binding2.Mode = BindingMode.TwoWay;
_binding2.Converter = CreateValueConverter();
BindingOperations.SetBinding(Editor, CheckComboBox.SelectedItemProperty, _binding2);
Editor.ItemsSource = Enum.GetValues(propertyItem.Value.GetType());
}
}As you can see, so far I've tried to bind each the SelectedValue and the SelectedItem property. CreateValueConverter() is defined in the base class and returns null.
It works well if I select some Values in the box and hit my save Button - in my model, I receive the correct enum value. But it doesn't work in the other direction - if i set any enum value (with or without flags) to my property, all values are unchecked and the content area is empty.
Do you have any idea to solve this problem?
New Post: CheckComboBox and [Flags] enum
In your ResolveValueBinding method, you bind to Editor.SelectedValue AND Editor.SelectedItem. The 2nd one cause an overflow exception, so I removed it.
To make your sample work, you need to call Editor.EndInit() when the initialization is done to update the CheckComboBox.SelectedValue. This is usually called by default, but here, the CheckComboBox is not used in a DataTemplate. So you can call it. Here's your modified ResolveValueBinding :
protected override void ResolveValueBinding( PropertyItem propertyItem )
{
var _binding = new Binding( "Value" );
_binding.Source = propertyItem;
_binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
_binding.Mode = BindingMode.TwoWay;
_binding.Converter = CreateValueConverter();
BindingOperations.SetBinding( Editor, CheckComboBox.SelectedValueProperty, _binding ); // or BindingOperations.SetBinding( Editor, ValueProperty, _binding );
//var _binding2 = new Binding( "Value" );
//_binding2.Source = propertyItem;
//_binding2.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
//_binding2.Mode = BindingMode.TwoWay;
//_binding2.Converter = CreateValueConverter();
//BindingOperations.SetBinding( Editor, CheckComboBox.SelectedItemProperty, _binding2 );
Editor.ItemsSource = Enum.GetValues( propertyItem.Value.GetType() );
Editor.Initialized += Editor_Initialized;
}
private void Editor_Initialized( object sender, EventArgs e )
{
Editor.EndInit();
}
New Post: How to set the title for LayoutAnchorable from MVVM binding?
<xcad:DockingManager x:Name="DockingManager"
AllowMixedOrientation="True">
<xcad:LayoutRoot x:Name="LayoutRoot">
<xcad:LayoutPanel Orientation="Horizontal">
<xcad:LayoutAnchorablePaneGroup DockWidth="3*" Orientation="Vertical">
<xcad:LayoutAnchorablePaneGroup>
<xcad:LayoutAnchorablePane DockHeight="*">
<xcad:LayoutAnchorable Title="{Binding TitleToBeDisplayed}"
AutoHideHeight="240"
CanClose="False"
CanHide="False">
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
<xcad:LayoutAnchorablePane DockHeight="*">
<xcad:LayoutAnchorable Title="{Binding TitleToBeDisplayed1}"
AutoHideHeight="240"
CanClose="False"
CanHide="False">
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
</xcad:LayoutAnchorablePaneGroup>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
New Post: How to change the border brush for LayoutAnchorable?
New Post: CheckComboBox and [Flags] enum
Thanks for your help.
I try now to check three items Test 1, Test 2 and Test3. After i click my save button and see that all values are saved in my config file i reload PropertyGrid but only the first item is checked and displayed in the Editor.
Debug in ResolveValueBinding
propertyItem.Value = Value = (Core.Plugin.TestEnum.Test1 | Core.Plugin.TestEnum.Test2 | Core.Plugin.TestEnum.Test3) Typ = object{Core.Plugin.TestEnum}
What i have to do to see all saved value as checked and displayed in Editor.
Thank you.
Paul.
New Post: CheckComboBox and [Flags] enum
2 things.
1) Make sure your enum has the [Flags] attribute.
2) CheckComboBox.SelectedValue is a string of all the selectedItems separated by comma. Ex :
"Test2,Test3,Test4"
The EnumConverter.ConvertTo() method will convert "Test2 | Test3 | Test4" to
"Test2, Test3, Test4"
(note the spaces after the comma, which CheckComboBox.SelectedValue don't like).
You can use the ValueConverter in your CheckComboBoxEditor to remove those spaces :
protected override IValueConverter CreateValueConverter()
{
return new MyConverter();
}
where MyConverter is : public class MyConverter : IValueConverter
{
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
{
if( value == null )
return null;
var stringEnumValues = TypeDescriptor.GetConverter( value ).ConvertTo( value, typeof( string ) ) as string;
return stringEnumValues.Replace( " ", string.Empty );
}
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
{
if( value == null )
return null;
return TypeDescriptor.GetConverter( value ).ConvertFrom( value ) as string;
}
}
Commented Unassigned: PropertyGrid Category Header Style [22206]
Thank you,
Scott
Comments: ** Comment from web user: ssugden **
Hi,
Thank you for the help. It has solved nearly all my issues (there area lot of styles to copy!)
I still can't seem to set the MouseOver Background for the PART_Name in PropertyItemBase. I have set it as follows (Red is just a test color):
```
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Name" Property="Background" Value="Red" />
</Trigger>
<....>
</ControlTemplate.Triggers>
```
But it seems to make no difference. I have the same issue with IsSelected.
Any idea what is going on?
Thank you
New Post: CheckComboBox and [Flags] enum
Thanks for great support. It works fine.
Now i have following situation.
I have some data in my Database witch i want to make available in the CheckComboBox.
I create new Dictionary<int, CheckListBoxEntry>(); and add each record from my query.
The CheckListBoxEntry;
[DataContract]
public class CheckListBoxEntry : INotifyPropertyChanged
{
public CheckListBoxEntry(bool isChecked, string displayText)
{
IsChecked = isChecked;
DisplayText = displayText;
}
private bool _isChecked;
[DataMember]
public bool IsChecked
{
get { return _isChecked; }
set
{
_isChecked = value;
RaisePropertyChanged("IsChecked");
}
}
[DataMember]
[ExcludeFromSerialization]
public string DisplayText { get; set; }
protected void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
now CheckComboBoxEditor class:i must change to:
BindingOperations.SetBinding(Editor, CheckComboBox.ItemsSourceProperty, _binding);
instead of:
BindingOperations.SetBinding(Editor, CheckComboBox.SelectedValueProperty, _binding);
because CheckComboBox hast red border and there are no items.
i use Editor.DisplayMemberPath = "Value.DisplayText";. Then i can see den right name of the Record e.g Demo1 , Demo2 ... when i open drop-down-list.
When i Check one Item I see this in the Editor textbox: [1,Core.Editor.CheckListBoxEntry] .....
After reload PropertyGrid all values are unchecked and the content area is empty.
I not sure what i have to change in the class MyConverter.
Can you please help me again.
Thanks a lot.
Paul