English 中文(简体)
收集物品必须空洞,才能在银灯使用物品
原标题:Items collection must be empty before using ItemsSource in Silverlight

习俗控制 我试图约束我的项目。 项目来源和错误。 在这方面,模板如何看待:

<Style TargetType="controls:IdattFilterBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:IdattFilterBox">
                    <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
                        <ItemsControl x:Name="PART_ItemsControl">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Grid HorizontalAlignment="Stretch">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Text="{Binding Caption}" />
                                        <ComboBox Grid.Column="1">
                                            <ComboBoxItem Content="Contains" />
                                            <ComboBoxItem Content="Begins with" />
                                            <ComboBoxItem Content="Ends with" />
                                        </ComboBox>
                                        <TextBox Grid.Column="2" Text="{Binding FieldFilter1, Mode=TwoWay}" />
                                        <TextBox Grid.Column="3" Text="{Binding FieldFilter2, Mode=TwoWay}" />
                                    </Grid>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                                                                                                                            <Border Grid.ColumnSpan="2" x:Name="ValidationErrorElement" BorderBrush="#FFDB000C" BorderThickness="1" CornerRadius="1" Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible" Storyboard.TargetName="validationTooltip">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <System:Boolean>true</System:Boolean>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Background="Transparent" HorizontalAlignment="Right" Height="12" Margin="1,-4,-4,0" VerticalAlignment="Top" Width="12">
                                <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="#FFDC000C" Margin="1,3,0,0"/>
                                <Path Data="M 0,0 L2,0 L 8,6 L8,8" Fill="#ffffff" Margin="1,3,0,0"/>
                            </Grid>
                        </Border>
                        </ItemsControl>
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>    

在试图确定本部分的法典中,

this.WrapperItemsControl.ItemsSource = filterData;

在这一行文上,我有错误(电文标上)。 为什么我能够确定项目,这一错误意味着什么? 我想对数据模板进行控制,以约束存储在<代码>filterData上的物体。

EDIT:

第一部分:项目

this.WrapperItemsControl = GetTemplateChild(PartItemsControl) as ItemsControl;

<><> ><>>>

Screenshot showing that there is one item (Border?) Where does it come from?! enter image description here

http://www.ohchr.org。

DOH! 我把验证边界放在错误的现场。

最佳回答

如果你手工增加项目“Control”,你可以使用项目。 例如,如果你尝试的话,你会犯错误:

<ItemsControl ItemsSource="{Binding MyItems}">
    <ListBoxItem>Item1</ListBoxItem>
    <ListBoxItem>Item2</ListBoxItem>
</ItemsControl>

你可能认为你没有这样做,但你实际上就是这样做的。 您在“Control”项目上增列一个项目,该项目为“数据模板”。 展望:

<ItemsControl ...>
    <DataTemplate ... />

该辛加税是指“在项目财产中添加数据”。 (如果项目为Control的违约财产,那么在项目Control下,如果你没有具体说明的话,就添加到项目上。)

I think you intended to assign that DataTemplate to the ItemsControl s ItemTemplate property, rather than adding it to Items. Try this instead:

<ItemsControl ...>
    <ItemsControl.ItemTemplate>
        <DataTemplate ... />
    </ItemsControl.ItemTemplate>
</ItemsControl>
问题回答

暂无回答




相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签