Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

binding problem

$
0
0
Hi,

I started this week with some testing of wpf and xaml, but there a few things about binding that don't work. I looked on many places on google, but I can't seem to find an awnser on my question or I'm doing something wrong (most probably).

In my mainwindow.xaml.vb I do this:
Code:

Public Sub Hydraulicsapp_Activated(sender As Object, e As EventArgs) Handles Hydraulicsapp.Activated
    Try
        Using sr As New StreamReader("c:\temp\windows\test\send_to_exe.txt")
            Dim Line As String
                Line = sr.ReadToEnd()
                sr.Close()
            End Using
        Catch ex As Exception
        End Try
    End Sub

And now I want to do something like this.

Code:

<TextBlock Margin="0,240,0,0">
            <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}{1}">
                    <Binding Source="Select the basic module for element "/>
                    <Binding Source="{StaticResource Line}"/>
                </MultiBinding>
            </TextBlock.Text>
        </TextBlock>

So in the Second Binding Source I want to readout the variable Line, but it doesn't work. Can somebody help me with this?


Second problem:
In my .xaml I use many pictures that are in the same directory, so I put this in my <Window.Resources>.
Code:

<System:String x:Key="imageloc">C:\Users\rvn\Dropbox\Programming\1-lisps\hydraulics\images\</System:String>
And then furtheron I want to use this in a Multibinding like this.
Code:

<Image Width="180" Height="86">
                            <Image.Source>
                                <MultiBinding StringFormat="{}{0}{1}">
                                    <Binding Source="{StaticResource imageloc}"/>
                                    <Binding Source="0000006225.bmp"/>
                                </MultiBinding>
                            </Image.Source>
                        </Image>

This also doesn't work and it has something to do with a stringconverter, but all the examples I find are about C# and not about VB. Can someone help me on this?

Thanks in advance
kind regards
Ruben

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>