Can't do x:Bind
for DataTemplate
<models:EffectModel x:Name="EffectModel" x:Key="EffectModel"/>
...
<ListView.ItemTemplate> <DataTemplate x:DataType="{StaticResource EffectModel}"> <TextBlock Text="{x:Bind Title}"/> </DataTemplate> </ListView.ItemTemplate>
Title
is a public string
property. Constantly writes on Title
that it is not in the context of MainPage
. Why he does not address to EffectModel
public class EffectModel { public string Title { get; set; } public Uri FrameImage { get; set; } }
UPD
<DataTemplate x:DataType="models:EffectModel"> <Border Width="400" Height="240"> <Border.Background> <ImageBrush Stretch="Fill" ImageSource="{x:Bind FrameImage}"/> </Border.Background> </Border> </DataTemplate>
x:DataType="{StaticResource EffectModel}"
and notx:DataType="models:EffectModel"
? Maybe this is the problem? - VladD{StaticResource EffectModel}
- this is not the type! This is an object. And you need exactly the type. - VladDBinding
works without any converters - SmiLe