{Binding Path = Prop}无法正常工作 [英] {Binding Path=Prop} don't work properly

查看:69
本文介绍了{Binding Path = Prop}无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下XAML代码中:

In the following XAML code:

 <ListBox x:Name="QueriesList" Grid.IsSharedSizeScope="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Queries}" Style="{StaticResource DataListboxStyle}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid x:Name="QueriesGrid" HorizontalAlignment="Stretch">
                            <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width= "{Binding Path=Querynamemaxlenght}"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                            <TextBlock Margin="0,0,5,5" TextWrapping="Wrap" Text="{Binding Path=Name}" Grid.Column="0" />
                            <TextBlock Margin="0,0,5,5" TextWrapping="Wrap" Text="{Binding Path=Question}" Grid.Column="1"/>

..

..

&strong> Querynamemaxlenght 的值未分配给   ColumnDefinition的宽度。

the value of Querynamemaxlenght is not assigned to the Width of ColumnDefinition.

注:in DataContext,"Querynamemaxlenght"和"Querynamemaxlenght"。和"查询"定义在同一级别:

NOTE: in the DataContext, "Querynamemaxlenght" and "Queries" are defined at the same level:

https://drive.google.com/open?id=0B8mNxbjSNFmEWWdpYlItRVlKUXM

https://drive.google.com/open?id=0B8mNxbjSNFmEWWdpYlItRVlKUXM

推荐答案

可能会有很多问题。 您应该在立即窗口中看到错误。

There could be many problems.  You should see the error in the Immediate window.

您是否在ListBox中收到了项目? 什么是jpg?

Are you getting items in the ListBox?  What is the jpg of?


这篇关于{Binding Path = Prop}无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆