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

Commented Unassigned: DoubleUpDown (probably any UpDown) - problem with IsFocused [20785]

$
0
0
I can't find a way of getting IsFocused to trigger for a DoubleUpDown control. (In fact it looks like this problem applies to all the xxxUpDown controls).

e.g., the following code does not trigger a background change:
```
<Style x:Key="expNumUpDownStyle" TargetType="xctk:DoubleUpDown" >
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Purple" />
</Trigger>
</Style.Triggers>
</Style>

```

```
<xctk:DoubleUpDown Style="{StaticResource expNumUpDownStyle}" />

```

A [stackoverflow answer](http://stackoverflow.com/questions/17160298/wpftoolkit-autocompletebox-style-trigger-isfocused-not-firing) for the same problem with a different toolkit control suggested attaching handlers to GotFocus and LostFocus on a derived control. I tried this but couldn't get this to work.

I also tried tracing the IsFocused value in these handlers, and it appeared to remain false, regardless of focus status.

Do you know if this is a known problem, and is there any workaround?
Comments: ** Comment from web user: BoucherS **

Hi,

As soon as the NumericUpDown gets the Focus, the Focus is transferred to its WatermarkTemplate (to be able to edit right away).

Try testing IsKeyboardFocusWithin property. It will gets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements
```
<Style x:Key="expNumUpDownStyle"
TargetType="xctk:DoubleUpDown">
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin"
Value="True">
<Setter Property="Background"
Value="Green" />
</Trigger>
</Style.Triggers>
</Style>
```


New Post: SplitButton with dropdown menu

$
0
0
Hi,

1) Try adding a click event to your menuItems and tell the splitButton to close :
<xctk:SplitButton x:Name="_splitButton"
                           Content="Click Me"
         <xctk:SplitButton.DropDownContent>
            <Menu>
               <MenuItem Header="First" 
                         Click="MenuItem_Click"/>
               <MenuItem Header="Second"
                         Click="MenuItem_Click" />
               <MenuItem Header="Third option for this menu"
                         Click="MenuItem_Click" />
           </Menu>
         </xctk:SplitButton.DropDownContent>
</xctk:SplitButton>

private void MenuItem_Click( object sender, RoutedEventArgs e )
    {
      _splitButton.IsOpen = false;
    }
2) I don't know with what object you want to bind the menuItems, but, here's an example if you have a CheckBox:
<StackPanel 
         <CheckBox x:Name="_checkBox" IsChecked="True"/>
         <xctk:SplitButton x:Name="_splitButton"
                           Content="Click Me"
            <xctk:SplitButton.DropDownContent>
               <Menu>
                  <MenuItem Header="First"
                            Click="MenuItem_Click" />
                  <MenuItem Header="Second"
                            Click="MenuItem_Click"
                            IsChecked="{Binding Source={x:Reference _checkBox}, Path=IsChecked}" />
                 </Menu>
            </xctk:SplitButton.DropDownContent>
         </xctk:SplitButton>
      </StackPanel>
Or you can set the DataContext, of the splitButton with the Checkbox, as mentioned on this site : http://stackoverflow.com/questions/20522228/ischecked-binding-not-working-in-menuitem-in-a-contextmenu

Commented Unassigned: DoubleUpDown (probably any UpDown) - problem with IsFocused [20785]

$
0
0
I can't find a way of getting IsFocused to trigger for a DoubleUpDown control. (In fact it looks like this problem applies to all the xxxUpDown controls).

e.g., the following code does not trigger a background change:
```
<Style x:Key="expNumUpDownStyle" TargetType="xctk:DoubleUpDown" >
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="Purple" />
</Trigger>
</Style.Triggers>
</Style>

```

```
<xctk:DoubleUpDown Style="{StaticResource expNumUpDownStyle}" />

```

A [stackoverflow answer](http://stackoverflow.com/questions/17160298/wpftoolkit-autocompletebox-style-trigger-isfocused-not-firing) for the same problem with a different toolkit control suggested attaching handlers to GotFocus and LostFocus on a derived control. I tried this but couldn't get this to work.

I also tried tracing the IsFocused value in these handlers, and it appeared to remain false, regardless of focus status.

Do you know if this is a known problem, and is there any workaround?
Comments: ** Comment from web user: PeteBeech **

Thanks very much, that works great.

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

thanks
Comments: ** Comment from web user: md110 **

Hi,

Thank you for your
```
I Replaced public virtual Person Person { get; set; }

```
with

```
public virtual ObservableCollection<Person> Persons { get; set; }
```

but not work And Exception:

```
The expression 't => t.Personss.get_Item(0)' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'.
```

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

thanks
Comments: ** Comment from web user: md110 **

The expression 't => t.Persons.get_Item(0)' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty'.

New Post: Center of ChildWindow With Margins set

$
0
0
Thanx, I was hoping not to modify your code... but if there is no other way :)

Cheerz
Hein

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

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

It is working for me in C#. You can find the sample in attachment.

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

thanks
Comments: ** Comment from web user: md110 **

hi
Not working for me
please edit last that sample and submit for me
[TEXT](https://www.codeplex.com/Download/AttachmentDownload.ashx?ProjectName=wpftoolkit&WorkItemId=20774&FileAttachmentId=7404)

thanks


New Post: Sorting Font Family list in the PropertyGrid

$
0
0
I am using the PropertyGrid in my application. I am not getting any way about how to sort the font family alphabetically.
Does anyone has any idea about how to do it?
Thanks in advance

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

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

Hi,

What exactly is not working ? I can compile the sample from the link you provided and I can click on buttons and select items from the CheckComboBox without any exceptions or crashes.

New Post: Sorting Font Family list in the PropertyGrid

$
0
0
Hi,

One way is to use the ItemsSource attribute to create your own content for the ComboBox. When using System.Linq :
public class MyUserObject
{
 [ItemsSource( typeof( MyFontItemsSource ) )]
public FontFamily FontFamily { get; set; }
}

 public class MyFontItemsSource : IItemsSource
    {
      public Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection GetValues()
      {
        var fonts = Fonts.SystemFontFamilies.OrderBy(x => x.ToString());
        var fontCollection = new Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection();
        foreach( FontFamily fontFamily in fonts )
        {
          fontCollection.Add( fontFamily );
        }
        return fontCollection;
      }
    }

var selectedObject = new MyUserObject();
_propertyGrid.SelectedObject = selectedObject;

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

thanks
Comments: ** Comment from web user: md110 **

hi

because i am using Entity Framework and database in this project

example :

```
public ObservableCollection<Person> PersonListCollection
{
get
{
context.Persons.Load();
return context.Persons.Local;

}
}
```
when call "context.Persons.Load();" exception Error in DocumentMap class

// Relationships
this.HasOptional(t => t.Persons[0])
.WithMany(t => t.Documents)
.HasForeignKey(d => d.PersonID);

Error is:

```
The expression 't => t.Persons.get_Item(0)' is not a valid property expression. The expression should represent a property: C#: 't => t.MyProperty' VB.Net: 'Function(t) t.MyProperty
```

Do you use DataBase? or use context.Persons.Load(); in PersonListCollection?

you've use
```
public ObservableCollection<Person> PersonListCollection
{
get
{
// context.Persons.Load();
//return context.Persons.Local;
return m_personList;
}
}

```
you are comment this line: // context.Persons.Load(); and Disabled ef
For this reason, work for you

if use context.Persons.Load();

To give you an error

Commented Unassigned: CheckComboBox mvvm problem [20774]

$
0
0
hi

this is my sample

when checked multiple item in CheckComboBox

but only one checked item CheckComboBox save to database

how to save All checked items CheckComboBox to database?

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

Hi,

You are right, I commented the lines of code to access the database since I don't have access to it. From what I see, it is a relationship error in the constructor of DocumentMap(). You should try to rework the relationship you want, considering the PropertyType change (Person to ObservableCollection<Person> in Document).

Maybe something like
this.HasMany( t => t.Persons )
.WithMany( p => p.Documents )
.Map( m => m.MapLeftKey("ABC").MapRightKey("DEF") );

Bu this is out of our scope. We focus on the toolkit, not a database or the way it is constructed.

New Post: Avalondock 2.1 - Designer issue

$
0
0
Hi,

after upgrading from 2.0 to 2.1, the designer displays an empty plane instead of the real layout.

Please use following XAML to reproduce the issue:
<Window x:Class="DemoWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="clr-namespace:System;assembly=mscorlib"
        xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel Margin="0,0,0,10" Orientation="Horizontal">
            <TextBlock Margin="0,0,10,0"
                       VerticalAlignment="Center"
                       Text="Theme:" />
            <ComboBox x:Name="_themeCombo"
                      Width="200"
                      SelectedIndex="0">
                <ComboBoxItem Content="Generic" />
                <ComboBoxItem Content="Aero">
                    <ComboBoxItem.Tag>
                        <xcad:AeroTheme />
                    </ComboBoxItem.Tag>
                </ComboBoxItem>
                <ComboBoxItem Content="VS2010">
                    <ComboBoxItem.Tag>
                        <xcad:VS2010Theme />
                    </ComboBoxItem.Tag>
                </ComboBoxItem>
                <ComboBoxItem Content="Metro">
                    <ComboBoxItem.Tag>
                        <xcad:MetroTheme />
                    </ComboBoxItem.Tag>
                </ComboBoxItem>
            </ComboBox>
        </StackPanel>

        <xcad:DockingManager Grid.Row="1"
                             MaxHeight="425"
                             AllowMixedOrientation="True"
                             BorderBrush="Black"
                             BorderThickness="1"
                             Theme="{Binding ElementName=_themeCombo,
                                             Path=SelectedItem.Tag}">
            <xcad:DockingManager.DocumentHeaderTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Margin="0,0,4,0" Source="{Binding IconSource}" />
                        <TextBlock Text="{Binding Title}" />
                    </StackPanel>
                </DataTemplate>
            </xcad:DockingManager.DocumentHeaderTemplate>
            <xcad:LayoutRoot x:Name="_layoutRoot">
                <xcad:LayoutPanel Orientation="Horizontal">
                    <xcad:LayoutAnchorablePane DockWidth="200">
                        <xcad:LayoutAnchorable Title="Properties"
                                               AutoHideWidth="240"
                                               CanClose="False"
                                               CanHide="False"
                                               ContentId="properties" />
                    </xcad:LayoutAnchorablePane>
                    <xcad:LayoutDocumentPaneGroup>
                        <xcad:LayoutDocumentPane>
                            <xcad:LayoutDocument Title="Document 1" ContentId="document1">
                                <Button HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        Content="Document 1 Content" />
                            </xcad:LayoutDocument>
                            <xcad:LayoutDocument Title="Document 2" ContentId="document2">
                                <TextBox AcceptsReturn="True" Text="Document 2 Content" />
                            </xcad:LayoutDocument>
                        </xcad:LayoutDocumentPane>
                    </xcad:LayoutDocumentPaneGroup>
                    <xcad:LayoutAnchorablePaneGroup DockWidth="125">
                        <xcad:LayoutAnchorablePane>
                            <xcad:LayoutAnchorable Title="Alarms" ContentId="alarms">
                                <ListBox>
                                    <s:String>Alarm 1</s:String>
                                    <s:String>Alarm 2</s:String>
                                    <s:String>Alarm 3</s:String>
                                </ListBox>
                            </xcad:LayoutAnchorable>
                            <xcad:LayoutAnchorable Title="Journal" ContentId="journal">
                                <RichTextBox>
                                    <FlowDocument>
                                        <Paragraph FontFamily="Segoe" FontSize="14">
                                            This is the content of the Journal Pane.
                                            <LineBreak />
                                            A
                                            <Bold>RichTextBox</Bold>
                                            has been added here
                                        </Paragraph>
                                    </FlowDocument>
                                </RichTextBox>
                            </xcad:LayoutAnchorable>
                        </xcad:LayoutAnchorablePane>
                    </xcad:LayoutAnchorablePaneGroup>
                </xcad:LayoutPanel>

                <xcad:LayoutRoot.LeftSide>
                    <xcad:LayoutAnchorSide>
                        <xcad:LayoutAnchorGroup>
                            <xcad:LayoutAnchorable Title="Agenda" ContentId="agenda">
                                <TextBlock Margin="10"
                                           FontSize="18"
                                           FontWeight="Black"
                                           Text="Agenda Content"
                                           TextWrapping="Wrap" />
                            </xcad:LayoutAnchorable>
                            <xcad:LayoutAnchorable Title="Contacts" ContentId="contacts">
                                <TextBlock Margin="10"
                                           FontSize="18"
                                           FontWeight="Black"
                                           Text="Contacts Content"
                                           TextWrapping="Wrap" />
                            </xcad:LayoutAnchorable>
                        </xcad:LayoutAnchorGroup>
                    </xcad:LayoutAnchorSide>
                </xcad:LayoutRoot.LeftSide>
            </xcad:LayoutRoot>
        </xcad:DockingManager>
    </Grid>
</Window>
Any idea?

Thank you!

New Post: TimePicker Selected Text

$
0
0
Is there any way to autoselect text when you tab to the time picker control?
Usually for a textbox you would do this

textbox.SelectionStart = 0;
textbox.SelectionLength = textbox.Text.Length;


But the timepicker doesnt have a selected text property? This would enable users to tab to the control, type the tiem and then tab off.

Commented Unassigned: Not able to select all row of Datagrid [20736]

$
0
0
Can't able to select all row by Ctrl+A ,there are some rows which are missing from selection when i press Ctrl+A in datagrid.
Any suggestion
Comments: ** Comment from web user: ashu_avni **

I used your approach and commented portion of code to isolate Ctrl+A feature, but still facing same issue.
Should i also change in Datagrid and its supporting classes i.e.(DataGridRow ,DataGridTextColumn)?

New Post: Dynamic attribute to change DescriptionAttribute in PropertyGrid of CollectionEditor

$
0
0
I am using attributes to define the Description, Category and Display name of properties that populate a PropertyGrid (within a CollectionEditor).

Is there any way to modify these attributes at run time such that they display different values? For instance, one of my properties is Temperature, for which I would like the Description to display "Enter temperature (°C)" if the user has selected one unit system and "Enter temperature (°F)" if a different unit system is selected.

Code for the property is shown below:
<DescriptionAttribute("Enter temperature (°C)."), _
         CategoryAttribute("Physical properties"), _
         DisplayName("Temperature")>
        Property Temperature As Double
            Get
                Return myTemperature
            End Get
            Set(ByVal value As Double)
                myTemperature = value
            End Set
        End Property
If I try and put a variable in the argument to DescriptionAttribute I get a 'Constant expression is required' error.

If this is not possible, is there another way of achieving the same effect?

Many thanks for any help.

Created Feature: TimePicker Selected Text [20802]

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

User wants to be able to tab in TimePicker and have all the text selected, The watermarkTextBox in TimePicker already has a AutoSelectBehavior (by default at Never). Maybe adding a new property on TimePicker (and other controls ? ) to manage the selection could do the job.

New Post: TimePicker Selected Text

Commented Unassigned: Not able to select all row of Datagrid [20736]

$
0
0
Can't able to select all row by Ctrl+A ,there are some rows which are missing from selection when i press Ctrl+A in datagrid.
Any suggestion
Comments: ** Comment from web user: BoucherS **

Yes, try in every classes. Does the code I copied works for you ?

Viewing all 4964 articles
Browse latest View live


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