Domanda

I have the following rule definition:

<Rule ...>
  <... />
  <StringProperty Subtype="file" ...>
  <StringProperty.ValueEditors>
    <ValueEditor EditorType="DefaultStringPropertyEditor" DisplayName="&lt;Edit...&gt;"/>
    <ValueEditor EditorType="DefaultFilePropertyEditor" DisplayName="&lt;Browse...&gt;"/>
  </StringProperty.ValueEditors>
  </StringProperty>
  <... />
</Rule>

It adds the "<Edit...>" and "<Browse...>" options for editing a property, but the Browse dialog asks for an *.exe file, when I need to let user select a *.txt file. There is a combobox in the dialog that allows to choose "All files .", but really that's not an option.

I have tried to find a solution but this extensibility bit does not seem to be well documented.

È stato utile?

Soluzione

I have finally found a way to do that, yet for VS2012 only. Putting a metadata piece named Filters with the filters string in the typical open file dialog format seems to do the trick now.

Example:

<ValueEditor EditorType="DefaultFilePropertyEditor" DisplayName="&lt;Browse...&gt;">
  <ValueEditor.Metadata>
    <NameValuePair Name="Filters" Value="Text (*.txt)|*.txt" />
  </ValueEditor.Metadata>
</ValueEditor>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top