English 中文(简体)
能够在等级数据栏内使用bo纸箱上所附财产
原标题:Can t use attached property on combobox inside hierarchical datatemplate WPF

我不想利用所附财产来为选择改变的 com子事件分配指挥权,因为box子已植根于树图。 I m试图将所附财产放在树体数据模板内,但指挥没有固定,在子体内的物品发生变化时不会火灾。

我发现,将所附财产直接放在一个数据模版工程罚款之外的 com子上;

这里是我如何试图将财产列入模板:

<HierarchicalDataTemplate x:Key="template1"
                ItemsSource="{Binding Path=ChildColumns}">

        <Border
                Background="{StaticResource TreeItem_Background}"
                BorderBrush="Blue"
                BorderThickness="2"
                CornerRadius="5"
                Margin="2,5,5,2"
                HorizontalAlignment="Left" >


            <Grid>
                <Grid.ColumnDefinitions >
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>

                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>


                <TextBlock MinWidth="80" HorizontalAlignment="Left" Grid.Column="0" Margin="5,2,2,2"  Grid.Row ="0" 
                           Text="{Binding Path=ColName}"/>

                <ComboBox Name="cboColType" Grid.Column="1" 
                          HorizontalAlignment="Right" 

                                      ItemsSource="{Binding Source={StaticResource dataFromEnum}}"
                                      SelectedItem="{Binding Path=ColumnType}"
                                      Margin="2,2,2,2"
                                      local:ItemSelectedBehavior.ItemSelected="{Binding Path=LoadConfigCommand}"
                                       />




            </Grid>
        </Border>




    </HierarchicalDataTemplate>

我还试图制造一种风格。

<Style x:Key="childItemStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="local:ItemSelectedBehavior.ItemSelected" Value="{Binding Path=LoadConfigCommand}" />

    </Style>

并且将项目内容定在等级数据表中的风格上。

<HierarchicalDataTemplate>
...
    <ComboBox Name="cboColType" Grid.Column="1" 
                              HorizontalAlignment="Right" 

                                          ItemsSource="{Binding Source={StaticResource dataFromEnum}}"
                                          SelectedItem="{Binding Path=ColumnType}"
                                          Margin="2,2,2,2"
                               ItemContainerStyle={StaticeResource childItemStyle}"
                                           />
...
</HierarchicalDataTemplate>

我仍学到很多有关世界森林论坛的内容,因此,我假定,对于不允许 attach子 set立的单体数据,有一点特别意义。 我在论坛中找到了类似职位,并努力落实上述解决办法,但在搜索和试验无一uck一 m的时候,有些人对此有想法。

问题回答




相关问题
WPF Datagrid, Setting the background of combox popup

I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I ve edited the Template for a normal Combobox and it works great for selected ...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always ...

How do I bind a ComboBox to a one column list

I ve seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" But ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...