Click here to Skip to main content
15,884,425 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to have duplicate model/view-model in TabControl Pin
Leif Simon Goodwin21-Apr-16 2:01
Leif Simon Goodwin21-Apr-16 2:01 
AnswerRe: How to have duplicate model/view-model in TabControl Pin
Pete O'Hanlon21-Apr-16 3:57
mvePete O'Hanlon21-Apr-16 3:57 
GeneralRe: How to have duplicate model/view-model in TabControl Pin
Leif Simon Goodwin22-Apr-16 0:41
Leif Simon Goodwin22-Apr-16 0:41 
GeneralRe: How to have duplicate model/view-model in TabControl Pin
Pete O'Hanlon22-Apr-16 0:44
mvePete O'Hanlon22-Apr-16 0:44 
QuestionWPF App for video recording from webcam into file MP4/h.264 Pin
Qinitram13-Apr-16 23:33
Qinitram13-Apr-16 23:33 
AnswerRe: WPF App for video recording from webcam into file MP4/h.264 Pin
Gerry Schmitz17-Apr-16 19:31
mveGerry Schmitz17-Apr-16 19:31 
QuestionUserControl not displayed inside the parent window only in designer Pin
hesido9-Apr-16 0:18
hesido9-Apr-16 0:18 
QuestionLoading resources from XAML, problem with fonts Pin
Jayme655-Apr-16 10:17
Jayme655-Apr-16 10:17 
I am (I have to) using an XAML file as a resource from my main window.
In this simplified example, the XAML file looks like this
XML
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="themeGrid">
    <Image Height="Auto" HorizontalAlignment="Left" Margin="0" Stretch="Fill" VerticalAlignment="Top" Width="Auto">
        <Image.Source>
            <BitmapImage UriSource="pack://siteoforigin:,,,/Resources/image1.jpg" CacheOption="OnLoad" />
        </Image.Source>
    </Image>
</Grid>


The file is loaded that way (the XAML file, as well as a 'image1.jpg' file, are in a 'Resources' folder along with the exe file)
VB
Imports System.IO
Class MainWindow
    Private Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        loadInterface()
    End Sub
    Sub loadInterface()
        ' Load xaml file as content of the window
        Dim GridUri As String = System.AppDomain.CurrentDomain.BaseDirectory & "Resources\theme.xaml"
        Dim fs As FileStream = New FileStream(GridUri, FileMode.Open, FileAccess.Read)
        Dim sri = TryCast(System.Windows.Markup.XamlReader.Load(fs), Grid)
        Me.Content = sri
        fs.Close()
    End Sub
End Class


..and that works nicely

Now I would like to use a label whit a font file taken in the same 'Resources' folder (the font used in this example: http://www.dafont.com/fr/digital-7.font)


XML
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="themeGrid">
    <Image Height="Auto" HorizontalAlignment="Left" Margin="0" Stretch="Fill" VerticalAlignment="Top" Width="Auto">
        <Image.Source>
            <BitmapImage UriSource="pack://siteoforigin:,,,/Resources/image1.jpg" CacheOption="OnLoad" />
        </Image.Source>
    </Image>
    <Label FontFamily="pack://siteoforigin:,,,/Resources/#Digital-7" Content="Have a nice day!"/>
</Grid>


...but then the label text isn't displayed with the proper FontFamily!

What should I please do for the text of the label to be displayed using the font in the resources folder?
Thanks very much!!

PS: the font file CAN'T be in resource of the application. Think of this XAML as a theme, any font could be inside and the application couldn't have all those possible fonts in resources!
AnswerRe: Loading resources from XAML, problem with fonts Pin
Pete O'Hanlon5-Apr-16 21:49
mvePete O'Hanlon5-Apr-16 21:49 
QuestionCombox with Multi Column Header Pin
fratola29-Mar-16 8:08
fratola29-Mar-16 8:08 
AnswerRe: Combox with Multi Column Header Pin
Richard Deeming29-Mar-16 8:26
mveRichard Deeming29-Mar-16 8:26 
GeneralRe: Combox with Multi Column Header Pin
fratola31-Mar-16 20:26
fratola31-Mar-16 20:26 
Questionlistviewitem style Pin
caradri13-Mar-16 0:41
caradri13-Mar-16 0:41 
Questionxceed datagrid (community) and virtualization Pin
amigoface9-Mar-16 18:47
amigoface9-Mar-16 18:47 
AnswerRe: window application form work in KIOSK Pin
Pete O'Hanlon8-Feb-16 21:37
mvePete O'Hanlon8-Feb-16 21:37 
AnswerRe: window application form work in KIOSK Pin
Richard Deeming9-Feb-16 1:55
mveRichard Deeming9-Feb-16 1:55 
AnswerRe: window application form work in KIOSK Pin
ZurdoDev9-Feb-16 8:36
professionalZurdoDev9-Feb-16 8:36 
QuestionHow to Programatically click a Button on a navigated Frame Page Pin
Vimalsoft(Pty) Ltd14-Jan-16 3:22
professionalVimalsoft(Pty) Ltd14-Jan-16 3:22 
AnswerRe: How to Programatically click a Button on a navigated Frame Page Pin
Vimalsoft(Pty) Ltd14-Jan-16 5:40
professionalVimalsoft(Pty) Ltd14-Jan-16 5:40 
QuestionCustom FrameworkElement with child controls Pin
Kenneth Haugland12-Jan-16 7:51
mvaKenneth Haugland12-Jan-16 7:51 
AnswerRe: Custom FrameworkElement with child controls Pin
Gerry Schmitz12-Jan-16 17:06
mveGerry Schmitz12-Jan-16 17:06 
GeneralRe: Custom FrameworkElement with child controls Pin
Kenneth Haugland13-Jan-16 1:39
mvaKenneth Haugland13-Jan-16 1:39 
GeneralRe: Custom FrameworkElement with child controls Pin
Gerry Schmitz13-Jan-16 6:25
mveGerry Schmitz13-Jan-16 6:25 
QuestionBinding a CompositeCollection to a Canvas (C#) Pin
Kenneth Haugland8-Jan-16 22:31
mvaKenneth Haugland8-Jan-16 22:31 
AnswerRe: Binding a CompositeCollection to a Canvas (C#) Pin
Kenneth Haugland9-Jan-16 2:42
mvaKenneth Haugland9-Jan-16 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.