Quantcast
Channel: Editors for WPF - Recent Posts
Viewing all 942 articles
Browse latest View live

Re: Use DoubleEditBox, type simple Mathematical Expression

$
0
0

Hi Tom,

You should take a look at the "CustomPartEditBoxSSN" QuickStart.  That shows a good example of creating a custom part edit box.  In your case you might want the edit box to inherit TypeSpecificEditBoxBase<double> and then generate a custom part group and part that can handle your expression parsing.  You can implement ISpinnable on the part to allow spinners too, similar to the DoubleEditBox.  I hope that helps!


How to change the width of the DateTimeEditBox

$
0
0

Now the width of the editor part in the DateTimeEditBox is equal to the width of the selection part in the DateTimeEditBox.If the width of the DateTimeEditBox is very large,and I don't want the width of the selection part is very large.How can I realize it?

Re: How to change the width of the DateTimeEditBox

$
0
0

Hello, I'm sorry but I don't think there's a way you can control that sort of thing other than maybe making an implicit style for DoublePart that has a MaxWidth set.

Int32EditBox Background Brush for MouseOver and IsFocused

$
0
0

Hi,

I'm trying to set the background color of the Int32EditBox via triggers, but something in the control template is overriding the MouseOver and IsFocused properties. I'm assuming you are using the default Windows chrome. I'm not sure what part of the control template I need to edit to make this happen, is it PartEditBox or...? And how do I apply this to only the Int32EditBox and not all editor controls?

This is what I've tried so far:

<Style.Triggers><MultiTrigger
        x:Uid="MultiTrigger_3"><MultiTrigger.Conditions><Condition
            x:Uid="Condition_12"
            Property="IsEnabled"
            Value="True" /><Condition
            x:Uid="Condition_13"
            Property="Validation.HasError"
            Value="True" /></MultiTrigger.Conditions><Setter
          x:Uid="Setter_116"
          Property="Background"
          Value="{StaticResource ErrorBackgroundBrush}" /><Setter
          x:Uid="Setter_117"
          Property="BorderBrush"
          Value="{StaticResource ErrorBorderBrush}" /></MultiTrigger></Style.Triggers>

 Thank you!

Re: Int32EditBox Background Brush for MouseOver and IsFocused

$
0
0

Hello, I believe your company has WPF Studio so you can have whoever is listed on the account download the default styles and templates from the organization account page.  Then you can see exactly what style and template is used for Int32EditBox. 

The default PartEditBox template makes use of an ElementChrome object that we change the state on via triggers in template.  You'd need to update that as needed for your scenario.

You could make an implicit Style with the updated Template and have it only target Int32EditBox controls.  Then put that in your app's Resources to have it apply to those controls.

How to Change the Language of the DateTimeEditBox?

$
0
0

Now the language of the month and the week showing in the DateTimeEditBox is English abbreviations.I want to change them.How to realize it?

Re: How to Change the Language of the DateTimeEditBox?

$
0
0

Hello, it will use whatever CultureInfo is returned by CultureInfo.CurrentCulture to format the abbreviations.  I believe this MSDN topic tells you how to change it.

Populating combobox with dynamic values

$
0
0

Hi,

I have a propertyGrid where I add properties dynamically. This propertyGrid I implement this way:

<propgrid:PropertyGrid IsSummaryVisible="True" AreDefaultSortDescriptionsEnabled="False"  
                            AreCategoriesAutoExpanded="False" SelectedObject="{Binding SelectedObject}"
                            IsAsynchronous="True"><propgrid:PropertyGrid.PropertyEditors><propgrid:DialogTextBoxPropertyEditor PropertyName="ImagePath"/><propgrid:ComboBoxPropertyEditor PropertyName="MyCollection" /></propgrid:PropertyGrid.PropertyEditors></propgrid:PropertyGrid>

 And properties for this propertyGrid defined :

[LocalizedCategory("Properties"), LocalizedDisplayName("DisplayMyProperty"), LocalizedDescription("DescMyProperty")]
public ObservableCollection<int> MyCollection
{
    get
    {
        _myCollection.Add(2);
        _myCollection.Add(3);
        return _myCollection;
    }
    set
    {
        _myCollection = value;
        RaisePropertyChanged("MyCollection");
    }
}
private ObservableCollection<int> _myCollection = new ObservableCollection<int>();

 So the problem is that property MyCollection is shown like combobox, but values are not populated. I mean in my property value field I see System.Collections.ObjectModel.ObservableCollection`1[System.Int32], and when I expand this combobox, there are no values.

Where I am wrong or may be there is an example of populating combobox with dynamic properties?

 


Re: Populating combobox with dynamic values

$
0
0

Hi Sasha,

The ComboBox control in general is only meant to return a single value but here you are wiring it up to a collection instead.  So in plain WPF you are effectively trying to do something like ComboBox.SelectedItem = MyCollection, which is an ObservableCollection<int>.

The ComboBoxPropertyEditor's dropdown items are populated by the related IPropertyDataAccessor.StandardValues collection.  StandardValues is generally just populated by property descriptors for enum values when the related target property is an enum, etc.

The only way to edit a collection property would be to use the collection editing features as described in the documenation and collection-related QuickStarts.

If you mean that you want to keep a ComboBox UI but have its drop-down values change on the fly, sorry but we don't have a sample for that.  You might need some sort of custom property editor to do that.  In the custom property editor template, perhaps bind the ComboBox.ItemsSource to some static property somewhere that can change and provides INotifyPropertyChanged notifications so the ComboBox knows to update its items list.

DateTimeEditBox disable MouseOver effect

$
0
0

Is there a way to disable the MouseOver effect in the DateTimeEditbox?

 

I noticed that when you hover over the DateTimeEditbox, its background color changes to white (or transparent).

 

Is there a way to disable this behavior?

Re: DateTimeEditBox disable MouseOver effect

$
0
0

I tried doing the following:

First:

<Window x:Class="WpfApplication00005.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors"><Window.Resources><Style x:Key="myStyle" TargetType="editors:DateTimeEditBox"><Setter Property="SnapsToDevicePixels" Value="True"/><Setter Property="OverridesDefaultStyle" Value="True"/><Setter Property="FocusVisualStyle" Value="{x:Null}"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type editors:DateTimeEditBox}"><Border Name="Border" 
                                CornerRadius="2" 
                                Padding="2"
                                Background="#FFFFFF"
                                BorderBrush="#888888"
                                BorderThickness="2" ><ContentPresenter Margin="2" 
                                 HorizontalAlignment="Center"
                                 VerticalAlignment="Center" 
                                 RecognizesAccessKey="True"/></Border></ControlTemplate></Setter.Value></Setter><Style.Triggers><Trigger Property='IsMouseOver' Value='True'><Setter Property='Background' Value='Beige' /></Trigger></Style.Triggers></Style></Window.Resources><Grid><editors:DateTimeEditBox Style="{StaticResource myStyle}" Name="DT" Margin="154,158,229,103"></editors:DateTimeEditBox></Grid></Window>

 But it didn't work. The entire DateTimeEditBox became just a box.

I also tried the following:

<Window x:Class="WpfApplication00005.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:editors="http://schemas.actiprosoftware.com/winfx/xaml/editors"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:themes="http://schemas.actiprosoftware.com/winfx/xaml/themes"><Window.Resources><system:Boolean x:Key="{x:Static themes:AssetResourceKeys.EditIsAnimationEnabledBooleanKey}">False</system:Boolean></Window.Resources><Grid><editors:DateTimeEditBox Background="Red"  Name="DT" Margin="154,158,229,103"></editors:DateTimeEditBox></Grid></Window>

 ..but it still didn't work. When I hover over the DateTimeEditBox, it still has an animation. That is the background becomes transparent/white.

 

I also tried moving the 

<system:Boolean x:Key="{x:Static themes:AssetResourceKeys.EditIsAnimationEnabledBooleanKey}">False</syste

 in the App.xaml's <Application.Resources> but it still didn't work.

I was wondering if I am missing something?

Re: DateTimeEditBox disable MouseOver effect

$
0
0

Hello,

You could either use another Actipro theme that might not have hover state changes, or if you like the one you are using in general, you could redefine the related theme asset brushes in your app's Resources.  For instance like this:

<SolidColorBrush PresentationOptions:Freeze="True" x:Key="{x:Static themes:AssetResourceKeys.EditBackgroundFocusedBrushKey}" themes:TintGroup.Name="Edit" 
		Color="#FFFFFFFF" /> 

There are asset brushes for each state (normal, hover, focused, etc.) and for things like backgrounds, borders, etc.  The AssetResourceKeys class defines them all. Check the documentation's class library topic for AssetResourceKeys to see all the Edit* brush assets that are available to you to customize.

I believe the IsAnimationEnabled key you tried using just defines if the transitions between the various states is animated or if it happens instantly.  It won't stop the state changes from happening.

Re: DateTimeEditBox disable MouseOver effect

$
0
0

Thanks. Will this work if I don't use a theme for my DateTimeEditBox control? Or if I dont use a theme for my DateTimeEditBox, is there a default theme assigned to it? Thanks again.

Re: DateTimeEditBox disable MouseOver effect

$
0
0

All our controls are themed and will make use of our theme system.  Our theme system will use a theme that matches the current operating system theme by default.  If you want to always ensure that your app gets a specific theme, you can set ThemeManager.CurrentTheme.  You can read more about the above in the Themes documentation.

Re: DateTimeEditBox disable MouseOver effect

$
0
0

When I try to debug it, when I put ThemeManager.CurrentTheme in the watch window, it says that its value is Null.

 

So I was thinking, am I suppose to set a theme for it first before the above can work?

Something like this (as I've read on the documentation):

 

ThemeManager.CurrentTheme = Themes.LunaLight.ToString()


Re: DateTimeEditBox disable MouseOver effect

$
0
0

A null value there means it effectively will use the system theme.  It should be the same as if you set it to "Generic".

Re: DateTimeEditBox disable MouseOver effect

$
0
0

And even if it is using the system theme, disabling the mouseover effects using the assetresourcekeys is still possible right?

Re: DateTimeEditBox disable MouseOver effect

$
0
0

Well our controls are always using our themes.  By default if you don't set ThemeManager.CurrentTheme, then an Actipro theme the mimics the look of the current system theme is used.  Thus yes, modifying the resource brushes will always work for Actipro controls.

Re: Populating combobox with dynamic values

$
0
0

No, I am trying to load some values from database, add them to property(something like MyCollection) and then bind this property to propertyGrid to see loaded values in combobox.

So what is the best way to do this?

Re: Populating combobox with dynamic values

$
0
0

Hi Sasha,

Did you try the suggestion at the end of our last post?

Viewing all 942 articles
Browse latest View live