misc‎ > ‎

XAML / Blend / WPF


Blend Importing .AI File

For Blend to import .ai (illustrator) files they must be saved as PDF compatibility files:

WPF Interop in WinForms – ElementHost control

Making WinForms project host WPF (VS 2010)

Add WindowsFormsIntegration.dll to Project Reference folder.
WindowsFormsIntegration.dll is installed with the WPF assemblies. The default location for the assembly is
%programfiles%\Reference Assemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll
New control System.Widows.Forms.Integration.ElementHost
appears in the Toolbox
Drop ElementHost control onto the Winforms host form.

WPF String Resources

Let's say we have a WPF Library DLL called "StartPagePage".
Normally we want to store .NET project strings in a \Properties\Resources.resx file.
  1. Look in the VS Solution Explorer. If there is no Resources.resx file under the Properties folder then create one (using the Resource Tab in the Properties page).
  2. In the header of each .xaml file add a reference to the resource file
  3. xmlns:p="clr-namespace:MPStartupPage.Properties"
  4. Double click Resources.resx and add ID/Strings pairs as MyString1/Some Text.
  5. Now replace the actual XAML text with this
    Text="{x:Static p:Resources.MyString1}" T
  6. etc.

Example:

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
        xmlns:local="clr-namespace:MPStartupPage" 
x:Name="UserControl"
        xmlns:p="clr-namespace:MPStartupPage.Properties"
Width="1000" Height="668">
  <TextBlock x:Name="HeaderText1" Margin="26,21,0,0"
    Text="{x:Static p:Resources.StartPage_HeaderText1}" >



Subpages (1): XAML Import
Comments