- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要在 xaml 中设置 CustomMessageBox 的 DataTemplate,如下所示:
<Grid.Resources>
<DataTemplate x:Key="CustomMessageBoxTemplate">
<phone:LongListSelector
LayoutMode="Grid"
ItemsSource="{Binding}"
GridCellSize="210 200"
toolkit:TiltEffect.IsTiltEnabled="True"
ItemTemplate="{StaticResource ItemTemplate}" />
</DataTemplate>
</Grid.Resources>
我正在尝试像这样在我的代码隐藏中使用它:
CustomMessageBox messageBox = new CustomMessageBox()
{
Caption = "Title",
DataContext = myList,
ContentTemplate = (DataTemplate)this.LayoutRoot.Resources["CustomMessageBoxTemplate"],
LeftButtonContent = "OK"
};
messageBox.Show();
其中myList是正确设置的List(我通过调试检查过的)。
但问题是我的 DataContext 没有改变,我在 CustomMessageBox 中的 LongListSelector 仍然没有填充。
我不知道我哪里弄错了。我尝试搜索如何执行此操作,但没有找到任何有用的信息。
感谢您的帮助!
最佳答案
ContentTemplate
中 xaml 的 DataContext
自动设置为 Content
属性。尝试设置 Content = myList
关于xaml - 设置 CustomMessageBox 的 DataContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20470945/
我有一个列表框的奇怪问题,它被放置在一个自定义消息框中。 问题:您无法向下滚动列表,因为“拖动手势”向上与向下的效果相同。所以我唯一得到的就是当您位于列表顶部时的响应动画。 我做了一个小样本:
好吧,我想在 customMessageBox 中的 next 旁边显示两个文本框。所以我已经为两个文本框编码了。像下面。我为它命名为 soora 和 ayath。但是在customMessageBo
我需要在 xaml 中设置 CustomMessageBox 的 DataTemplate,如下所示: 我正在尝试像这样在我的代码隐藏中使用它: Custom
我正在使用 Windows Phone 工具包开发 Windows Phone 8 应用程序。使用此扩展提供的 CustomMessageBox 时,您必须将 Content 属性设置为您希望此控件显
我正在使用 Silverlight Toolkit for Windows Phone 中的 CustomMessageBox 控件。将匿名回调(MS 语言中的“委托(delegate)”?)传递为
创建 CustomMessageBox 的代码: CustomMessageBox 是一个属性,而不是对工具包中 C# 类的引用。 CustomMessageBox.Dismissed += (dis
创建 CustomMessageBox 的代码: CustomMessageBox 是一个属性,而不是对工具包中 C# 类的引用。 CustomMessageBox.Dismissed += (dis
我是一名优秀的程序员,十分优秀!