Vault Data Standard - Blank Rows in Combo Box

Vault Data Standard - Blank Rows in Combo Box

Darin.Green
Mentor Mentor
1,289 Views
7 Replies
Message 1 of 8

Vault Data Standard - Blank Rows in Combo Box

Darin.Green
Mentor
Mentor

Issue:

Within my combo box, there are a number of blank rows before the row containing information:

 

blank_rows.png

 

The combo box has uses the SelectedItem from the previous Combo Box.

 

SourceItem.png

 

 

Below is the XML structure of the content. NOTICE: There are a number of Types listed before my Build attributes. Those are actually the blank lines in my Combo Box...

 

structure.png

 

I would like to know how to get rid of the blank rows...

 

Any help would be appreciated.

 

Thanks,

Darin

 



If this information was helpful, please consider using the Accept Solution


0 Likes
Accepted solutions (1)
1,290 Views
7 Replies
Replies (7)
Message 2 of 8

wangdu
Collaborator
Collaborator

Hi,

 

It is difficult to say what could be the cause for the blank rows. Maybe you could post a simple sample (xaml + xml etc.) that reproduces this behaviour so that I can give a look.

 

Anyway, FYI, I have found a nice example on the web that uses XmlDataProvider and XPath queries to filter unwanted data. https://docs.microsoft.com/en-us/dotnet/framework/wpf/data/how-to-bind-to-xml-data-using-an-xmldatap...

 

 

Wangdu

 

coolOrange

www.coolOrange.com

0 Likes
Message 3 of 8

Darin.Green
Mentor
Mentor

@wangdu

 

I was able to remove the blank rows using a DataContext method as follows:

 

<ComboBox x:Name="Build1" Height="Auto" Grid.Row="6" Grid.Column="1" 
  ItemsSource="{Binding XPath=Build}" 
  DataContext="{Binding SelectedItem, ElementName=Option1}" 
  DisplayMemberPath="@Build" 
  SelectedValuePath="@Build" 
  SelectedValue="{Binding Prop[Building].Value}"/>

No Blank Rows.png

 

Although it's displaying correctly, the value within the Custom Property is no longer selected when the dialog is opened...

 

The Property is already set to 1 for Building, but the form is no longer selected that value since making the changes above. @wangdu, Do you know why that may be?

 

Thanks,
Darin



If this information was helpful, please consider using the Accept Solution


0 Likes
Message 4 of 8

wangdu
Collaborator
Collaborator

Hi,

 

Is it the Mode property that you have to set to TwoWay?

 

<ComboBox x:Name="Build1" Height="Auto" Grid.Row="6" Grid.Column="1" 
  ItemsSource="{Binding XPath=Build}" 
  DataContext="{Binding SelectedItem, ElementName=Option1}" 
  DisplayMemberPath="@Build" 
  SelectedValuePath="@Build" 
  SelectedValue="{Binding Prop[Building].Value, Mode=TwoWay}"/>

Hope this helps!

 

Wangdu

 

coolOrange

www.coolOrange.com

0 Likes
Message 5 of 8

Darin.Green
Mentor
Mentor

@wangdu

 

Changing the Mode to TwoWay didn't help. 

 

Do you know if there's something I can add into the Default.ps1 file to not list the blank rows? I'm open to anything at this point.



If this information was helpful, please consider using the Accept Solution


0 Likes
Message 6 of 8

wangdu
Collaborator
Collaborator

hi,

 

 

<ComboBox x:Name="Build1" Height="Auto" Grid.Row="6" Grid.Column="1" 
  ItemsSource="{Binding XPath=./Build/@Type}" 
  DataContext="{Binding SelectedItem, ElementName=Option1}" 
  SelectedIndex="0" 
  SelectedItem="{Binding Prop[Building].Value}"/>

Does this help? I am assuming the 'Type' attribute is what you want in the Prop[Building].Value. Correct the attribute name, if that's not the one.

 

Wangdu

 

coolOrange

www.coolOrange.com

0 Likes
Message 7 of 8

Darin.Green
Mentor
Mentor
Accepted solution

@wangdu

 

I was able to resolve the issue by incorporating LastChild.ChildNodes

 

<ComboBox
   x:Name="Build1"
   Height="Auto"
   Grid.Row="7"
   Grid.Column="1"
   ItemsSource="{Binding SelectedItem.LastChild.ChildNodes, ElementName=Option1}"
   DisplayMemberPath="@Build" 
   SelectedValuePath="@Build" 
   SelectedValue="{Binding Prop[Building].Value}"/>

 



If this information was helpful, please consider using the Accept Solution


0 Likes
Message 8 of 8

wangdu
Collaborator
Collaborator

Hi,

 

Glad that you have been able to resolve the issue.

 

You could accept it as solution and could help some others in the future..

 

Wangdu

coolOrange