Вопрос по .net, wpf – Конкатенация DisplayMemberPath

16

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

cboRegion.DisplayMemberPath = "idregion" + "description";

Error: User Rate Limit Exceeded

Ваш Ответ

3   ответа
52

DisplayMemberPath

Specify a DataTemplate

<ComboBox>
  <ComboBox.ItemTemplate>
    <DataTemplate>
      <TextBlock>
        <TextBlock.Text>
          <MultiBinding StringFormat="{}{0}: {1}">
            <Binding Path="idregion"/>
            <Binding Path="description"/>
          </MultiBinding>
        </TextBlock.Text>
      </TextBlock>
    </DataTemplate>
  </ComboBox.ItemTemplate>
</ComboBox>

Add a property or field to your data source. How to do that depends on your data source:

If your combo box is bound to a DataTable, add a DataColumn and fill its values in a loop. Alternatively, change your SQL and add the concatenated value to your SELECT clause.

If your combo box is bound to a POCO or entity framework object, add a property that returns the concatenation.

Error: User Rate Limit Exceeded
16

DataTemplate:

<ComboBox Name="cboRegion">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock>
                <Run Text="{Binding idregion}" />
                <Run Text="{Binding description}" />
            </TextBlock>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded unairoldan
Error: User Rate Limit Exceeded unairoldan
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceededstackoverflow.com/questions/248362/…Error: User Rate Limit Exceeded
1

Похожие вопросы