Can anyone explain me meaning of dg:DataGridComboBoxColumn+TextBlockComboBox in Generic.XAML of WPF toolkit

Oct 21, 2009 at 7:12 AM

Hi ,

Recently i was going thru styles of WPF datagrid in Generic XAML.Surprisingly I found style key with dg:DataGridComboBoxColumn+TextBlockComboBox.Does it mean tht While DatagridCombobox gets render will it be concatenation of DataGridComboBoxColumn and TextBlockComboBox

which results in different type control.

Can any1 Please explain me about usage '+' inside style key.


 <Style x:Key="{x:Type dg:DataGridComboBoxColumn+TextBlockComboBox}" TargetType="{x:Type dg:DataGridComboBoxColumn+TextBlockComboBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type dg:DataGridComboBoxColumn+TextBlockComboBox}">
          <ContentPresenter Margin="1,1,1,1"
                            Content="{TemplateBinding SelectionBoxItem}"
                            ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                            ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                            ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            IsHitTestVisible="false" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

 

 

 

 <Style x:Key="{x:Type dg:DataGridComboBoxColumn+TextBlockComboBox}" TargetType="{x:Type dg:DataGridComboBoxColumn+TextBlockComboBox}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type dg:DataGridComboBoxColumn+TextBlockComboBox}">
          <ContentPresenter Margin="1,1,1,1"
                            Content="{TemplateBinding SelectionBoxItem}"
                            ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                            ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                            ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            IsHitTestVisible="false" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

 

 

Nov 11, 2009 at 2:49 PM

Bump.  I am also having trouble importing the June 2009 release DataGrid\Themes\Generic.xaml due to 

<font size="2" color="#ff0000"><font size="2" color="#ff0000">

dg

</font></font><font size="2" color="#ff0000">

 

</font>

:DataGridComboBoxColumn+TextBlockComboBox

Can someone enlighten me on the syntax usage of the '+' operator?  I am not able to compile with this in my current project.  I am getting:

 Error 3 Only public or internal classes can be used within markup. 'TextBlockComboBox' type is not public or internal. C:\secretpathtomyfileinmyproject...\ToolkitGridStyles.xaml 319 20 CAMS.Client
 

 

Nov 12, 2009 at 2:43 PM

Hi All,

The '+' means inner class. TextBlockComboBox is a inner class DataGridComboBoxColumn. According to the source code inside the WPF Toolkit, the TextBlockComboBox is a workaround of the bug in Selector.

Selector has a bug regarding DataContext change and SelectedItem property,

 

where if the SelectedItem due to old DataContext is a valid item in ItemsSource

but the SelectedItem due to new DataContext is not a valid item in ItemsSource,

the SelectedIndex remains that of old context instead of changing to -1.

This method is a workaround to that problem, since it is of high impact to DataGrid

Regards,

Tony