Reputation: 1505
Usually in winforms, you can load control Text as well as other properties like size from FormName.resx file.
Similarly we can load control Text from resource file in WPF as follows;
<Button Content="{x:Static res:Resources.ButtonText}" Height="100" Width="150">
But I also want to load Height and Width from .resx file. How can I achieve it in WPF?
Upvotes: 0
Views: 184
Reputation: 169370
Right-click on the .resx
file in Visual Studio and choose Open With->XML (Text) Editor
and add a data value of type double
at the bottom of the file:
<data name="Height" type="System.Double, mscorlib">
<value>20</value>
</data>
You should then be able to use this resource as usual:
<Button ... Height="x:Static res:Resources.Height" />
Upvotes: 1