首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > CAD教程 >

ComboBox选择后,鼠标离开后,要求TextBlock展示新选择的公司的中文,却没有显示任何东西,是空白的

2013-11-29 
ComboBox选择后,鼠标离开后,要求TextBlock显示新选择的公司的中文,却没有显示任何东西,是空白的。UserCont

ComboBox选择后,鼠标离开后,要求TextBlock显示新选择的公司的中文,却没有显示任何东西,是空白的。
<UserControl.Resources>
        <riaControls:DomainDataSource AutoLoad="True" x:Key ="UNITDataSource" QueryName="GetORA_UNIT_INFO">
            <riaControls:DomainDataSource.DomainContext>
                <ds:ABDataDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <local:UnitConverter x:Key="UnitConverter" ItemsSource="{StaticResource UNITDataSource}"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >
            <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}" Width="Auto">
                <riaControls:DomainDataSource Name="PersonDataSource" LoadSize="20" QueryName="GetORA_PERSON_INFO" AutoLoad="True" SubmittedChanges="PersonDataSource_SubmittedChanges">
                    <riaControls:DomainDataSource.DomainContext>
                        <ds:ABDataDomainContext/>
                    </riaControls:DomainDataSource.DomainContext>
                    <riaControls:DomainDataSource.SortDescriptors>
                        <riaControls:SortDescriptor PropertyPath="PID" Direction="Ascending" />
                    </riaControls:DomainDataSource.SortDescriptors>
                    <riaControls:DomainDataSource.FilterDescriptors>
                        <riaControls:FilterDescriptor PropertyPath="PID" Operator="IsGreaterThanOrEqualTo" IgnoredValue="" Value="{Binding ElementName=vacationHoursText, Path=Text}"  >
                        </riaControls:FilterDescriptor>
                    </riaControls:DomainDataSource.FilterDescriptors>
                </riaControls:DomainDataSource>
.....
<sdk:DataGrid AutoGenerateColumns="False" MinHeight="200" Height="Auto" ItemsSource="{Binding Data, ElementName=PersonDataSource}" Name="PersonGrid">
.....
<sdk:DataGridTemplateColumn Header="公司" >
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Path=ORA_UNIT_INFO.UNITNAME,Mode=TwoWay}" />
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                            <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <ComboBox ItemsSource="{Binding Path=Data,Mode=TwoWay,Source={StaticResource UNITDataSource}}" DisplayMemberPath="UNITNAME" SelectedItem="{Binding Path=UNITID,Mode=TwoWay,Converter={StaticResource UnitConverter}}" />


                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellEditingTemplate>
                        </sdk:DataGridTemplateColumn>



public IQueryable<ORA_PERSON_INFO> GetORA_PERSON_INFO()
        {
            return this.ObjectContext.ORA_PERSON_INFO.Include("ORA_UNIT_INFO");
        }

[Include]
 public ORA_UNIT_INFO ORA_UNIT_INFO { get; set; }


public class UnitConverter : IValueConverter
    {
        public DomainDataSource ItemsSource { get; set; }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string Id = (string)value;
            var returnValue = ItemsSource.Data.Cast<ORA_UNIT_INFO>().Where(item => item.UNITID == Id).FirstOrDefault();//.Select(c => new { AREAID = c.AREAID, AREANAME = c.AREANAME });
            return returnValue;
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ORA_UNIT_INFO objectEntity = value as ORA_UNIT_INFO;
            string returnValue = "829";
            if (objectEntity != null)
            {
                returnValue = objectEntity.UNITID;
            }
            return returnValue;
        }
    }


问题:ComboBox选择后,鼠标离开后,要求TextBlock显示新选择的公司的中文,却没有显示任何东西,是空白的。好象是TextBlock数据没有更新。 

热点排行