English 中文(简体)
在对财产具有约束力的项目中,确实有工作,但对数据具有约束力。
原标题:In an ItemControl binding to property doesent work but binding to DataContext does

当我管理这一法典时,我的习俗中的项目目标成为一种制度。 视窗。 含有无价值但无效价值的数据,但数据目录成为MyClass物体(项目有人居住)。

<UserControl x:Name="thisControl">

<Grid x:Name="LayoutRoot">
    <ItemsControl ItemsSource="{Binding ElementName=thisControl,Path=Items}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <local:UniformGrid Columns="1"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <local:CustomControl Item="{Binding}" DataContext="{Binding}"/>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</Grid>
</UserControl>

我的习俗教派

public partial class CustomControl : UserControl
{
    public CustomControl()
    {
        InitializeComponent();
    }

    public object Item { get; set; }
}

is there something i don t know about ItemsControl? this is written in Silverlight 4.0

提前感谢!

最佳回答

没有必要试图分配海关控制数据。 项目理事会将照顾你们。

以及<条码> 代码需要具体规定<代码> 项目 具有工作约束力的财产 装饰物不从事普通性质的工作。

例:

    public object Item
    {
        get { return GetValue(ItemProperty); }
        set { SetValue(ItemProperty, value); }
    }

    public static readonly DependencyProperty ItemProperty =
        DependencyProperty.Register(
            "Item",
            typeof(object),
            typeof(CustomControl),
            new PropertyMetadata(null))

(假定 缩略语

问题回答

暂无回答




相关问题
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 ...