Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Change Background color using WPF (Read 2268 times)
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Change Background color using WPF
May 23rd, 2008 at 1:20pm
Print Post  
Hi: Using Windows Forms I was able to easily change the Background color of my diagram.  I have now moved to WPF.  Here is what I thought would work, but had not.   However, the "ShowScrollBars" statement does work.  This is in my .XAML document:

xmlns:mf="clr-namespace:MindFusion.Diagramming.WinForms;assembly=MindFusion.Diag
ramming.WinForms"
xmlns:mf2="clr-namespace:MindFusion.Diagramming;assembly=MindFusion.Diagramming"
     
    Title="MOM2" Height="980" Width="1200" Icon="file:///C:/MARS4/Archive/VBNET/MOM2/MOM2/mars-logo.ico">
    <Grid>
       <Grid Name="MainW">
           <wfi:WindowsFormsHost FontSize="18" Margin="0,25,0,0" >
               <mf:DiagramView x:Name="view"  BackColor="Khaki"  Font="Microsoft Sans Serif, 8pt" ShowScrollbars="False" />


Thanks, Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Change Background color using WPF
Reply #1 - May 23rd, 2008 at 2:01pm
Print Post  
With that you are setting DiagramView.BackColor, but should set Diagram.BackBrush. I don't know if that can be done through XAML, but if it's possible, perhaps it will look like this -

<DiagramView ...>
  <DiagramView.Diagram BackBrush="..." />
</DiagramView>

You could add a Diagram to e Windows Forms form, set the BackBrush using the property grid, and copy the generated string value to the XAML file in place of the "..." above.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Change Background color using WPF
Reply #2 - May 23rd, 2008 at 2:21pm
Print Post  
Thanks. I couldn't figure out the XAML approach, so put it in the .vb code on load:


Me.view.Diagram.BackBrush = New MindFusion.Drawing.SolidBrush(System.Drawing.Color.Khaki)

This works!

Thanks
Jim
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint