databind the Source property of the WebBrowser in WPF

Posted by Russ on Stack Overflow See other posts from Stack Overflow or by Russ
Published on 2008-11-04T21:39:37Z Indexed on 2010/05/07 21:08 UTC
Read the original article Hit count: 272

Filed under:
|
|
|

Does anyone know how to databind the .Source property of the WebBrowser in WPF ( 3.5SP1 )? I have a listview that I want to have a small WebBrowser on the left, and content on the right, and to databind the source of each WebBrowser with the URI in each object bound to the list item.

This is what I have as a proof of concept so far, but the "<WebBrowser Source="{Binding Path=WebAddress}"" does not compile.

<DataTemplate x:Key="dealerLocatorLayout" DataType="DealerLocatorAddress">                
                    <StackPanel Orientation="Horizontal">
                         <!--Web Control Here-->
                        <WebBrowser Source="{Binding Path=WebAddress}"
                            ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                            ScrollViewer.VerticalScrollBarVisibility="Disabled" 
                            Width="300"
                            Height="200"
                            />
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <Label Content="{Binding Path=CompanyName}" FontWeight="Bold" Foreground="Blue" />
                                <TextBox Text="{Binding Path=DisplayName}" FontWeight="Bold" />
                            </StackPanel>
                            <TextBox Text="{Binding Path=Street[0]}" />
                            <TextBox Text="{Binding Path=Street[1]}" />
                            <TextBox Text="{Binding Path=PhoneNumber}"/>
                            <TextBox Text="{Binding Path=FaxNumber}"/>
                            <TextBox Text="{Binding Path=Email}"/>
                            <TextBox Text="{Binding Path=WebAddress}"/>
                        </StackPanel>
                </StackPanel>
            </DataTemplate>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about web-browser