【问题标题】:Radcombobox loses value when clicked on another control单击另一个控件时,Radcombobox 失去价值
【发布时间】:2017-03-07 16:52:18
【问题描述】:

两个组合框 - 用户在第一个中进行选择,为第二个提供默认值。在发生一系列击键之前,这很有效。如果第二个获得焦点,但没有改变,那么第一个获得焦点,第二个的默认值消失。

什么会导致默认值消失?

我怀疑第二个组合设置不正确,但我不确定如何修复它。

<telerik:RadComboBox x:Name="cboGlaze" FontSize="16" Background="#F6F8FA" BorderBrush="#D7D8DD" 
ItemsSource="{Binding}" 
Text="{Binding glaze, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
telerik:TextSearch.TextPath="Glaze" 
IsEditable="True" IsReadOnly="True"
Style="{DynamicResource RadComboBoxStyle3}" >

<telerik:RadComboBox.ItemTemplate>
    <DataTemplate>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Glaze}"></TextBlock>
            <TextBlock Text="{Binding pctUpcharge}"  Grid.Column="1"></TextBlock>
        </Grid>
    </DataTemplate>
 </telerik:RadComboBox.ItemTemplate>

在第一个组合的 DropDown 事件中处理与属性“glaze”的绑定。

感谢您的任何帮助或建议。

【问题讨论】:

  • RadComboBox的DataContext是什么,“glaze”是什么属性?
  • 数据上下文:da.Fill(dt) thisCombo.ItemsSource = dt.DefaultView
  • 属性:Private _glaze As String 公共属性 glaze As String Get Return _glaze End Get Set(value As String) _glaze = value NotifyPropertyChanged("glaze") End Set End Property

标签: wpf vb.net radcombobox


【解决方案1】:

如果DataTable 包含具有此名称的列,请尝试将RadComboBoxSelectedValue 属性绑定到glaze 源属性并将SelectedValuePath 属性设置为“Glaze”:

<telerik:RadComboBox x:Name="cboGlaze" FontSize="16" Background="#F6F8FA" BorderBrush="#D7D8DD" 
    ItemsSource="{Binding}" 
    SelectedValuePath="Glaze"
    SelectedValue="{Binding glaze}" 
    telerik:TextSearch.TextPath="Glaze" 
    IsEditable="True" IsReadOnly="True"
    Style="{DynamicResource RadComboBoxStyle3}" >
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2020-03-29
    相关资源
    最近更新 更多