I have created a Resource for the ImageBrush, see below, but I do not know how I would add it to the AvalonDock LayoutDocumentPane. I want to add it to the pane because I want to have a logo in the background, but LayoutDocumentPane covers the Window background.
<BitmapImage x:Key="LogoBitmap" UriSource="pack://application:,,,/myLibrary;component/myImages/myBigLogo.PNG"/>
<ImageBrush x:Key="LogoImage" ImageSource="{StaticResource LogoBitmap}"/>
Right now, I have the following:
<ad:DockingManager x:Name="dockManager" >
<ad:LayoutRoot>
<ad:LayoutPanel x:Name="myLayoutPanel" Orientation="Horizontal">
<ad:LayoutAnchorablePane x:Name="myLayoutAnchorablePane" DockWidth="400"/>
<ad:LayoutDocumentPane x:Name="myDocumentPane"/>
</ad:LayoutPanel>
</ad:LayoutRoot>
</ad:DockingManager>
I was able to find a method of setting a background image that works for my use case, but I am using a very simple AvalonDock configuration so I'm not sure if it will work for you.
This will set the image for the entire dock control, I was not able to find any way to set a background at any level lower than this.
<xcad:DockingManager x:Name="dockingManager">
<xcad:DockingManager.Background>
<ImageBrush ImageSource="/Resources/Images/MDIBACKGROUNDIMAGE.png"/>
</xcad:DockingManager.Background>
<xcad:LayoutRoot>
<xcad:LayoutPanel Orientation="Horizontal">
<xcad:LayoutDocumentPaneGroup>
<xcad:LayoutDocumentPane >
<xcad:LayoutDocument>
<views:MyForm></views:MyForm>
</xcad:LayoutDocument>
</xcad:LayoutDocumentPane>
</xcad:LayoutDocumentPaneGroup>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
Related
How can I set Opacity of WebView2 control in WPF
I need to change opacity of WebView2 from 0 to 1 by using Storyboard but when I am trying to set "Opacity =0" to WebView2 it doesn't get apply.
So is there any way I can dynamically set its opacity?
WebView2 is not a native wpf control,it does not support transparency settings.
you can use CEFSharp,it provides the same feature of WebView2, and supports transparency settings.
NuGet\Install-Package CefSharp.Wpf -Version 108.4.130
It's simply impossible. WebView2 is HwndHost. it means they are native win32 windows placed exactly in location of specified in your WPF. So It's not a WPF element you can manipulate.
If you want to somehow hide the WebView for a while, you can use Visibility.
<wv2:WebView2 Visibility="Hidden" MinHeight="300" />
Above that control you can show a loading icon or something and animate it, not the WebView itself.
<Grid>
<wv2:WebView2 Visibility="Hidden" Width="500" Height="500" />
<custom:MyFancyLoadingControl Visibility="Visible" Width="500" Height="500" />
</Grid>
I have 2 images in a Gridview, and when I run my app the images have a border around them when I mouseover. (see behaviour ->)
Behaviour
Can this be disabled, I've tried all the settings which seem related, such as:
Image x:Name="image1" Height="67" Width="67"
Source="ms-appx:///Assets/logo67.png"
HorizontalAlignment="Right"
IsDoubleTapEnabled="False"
IsHoldingEnabled="False"
IsRightTapEnabled="False"
IsTapEnabled="False"
ManipulationMode="None"/
You need to edit the GridViewItem template, which have default value here https://msdn.microsoft.com/en-us/library/windows/apps/mt299127.aspx
Create a custom style and apply it using ItemContainerStyle property of GridView
I have a panorama app, and is localized. it is applied the flow direction for the app:
FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
RootFrame.FlowDirection = flow;
this way it applies the direction for the app, but the problem is that I don't want the direction of the background Image also change:
<phone:Panorama.Background>
<ImageBrush ImageSource="/MyApp;component/Assets/CustomBackground.png"/>
</phone:Panorama.Background>
So I thought I can change the FlowDirection of this background image, or use its name to change it programmatically or add something like StackPanel and change its direction, but at the end neither one worked.
How to not allow the direction of the background image to change, or how to assign prefered direction to it? (this is a windows phone 8 app)
Set the FlowDirection of the Panorama itself to be LeftToRight, but change the FlowDirection of the PanoramaItem controls to match the parent control of your Panorama
Example:
<Grid x:Name="LayoutRoot" Background="Transparent" FlowDirection="RightToLeft">
<!--Panorama control-->
<phone:Panorama Title="my application" FlowDirection="LeftToRight">
<phone:Panorama.Background>
<ImageBrush ImageSource="/PanoramaApp1;component/Assets/PanoramaBackground.png"/>
</phone:Panorama.Background>
<!--Panorama item one-->
<phone:PanoramaItem Header="first item" FlowDirection="{Binding FlowDirection, ElementName=LayoutRoot}">
</phone:PanoramaItem>
<!--Panorama item two-->
<phone:PanoramaItem FlowDirection="{Binding FlowDirection, ElementName=LayoutRoot}">
</phone:PanoramaItem>
</phone:Panorama>
</Grid>
Also the app will flow to whatever the Culture of the phone is. There is not a need to store the FlowDirection. Taking this knowledge, you would remove the FlowDirection property from the Grid (LayoutRoot) but leave it on the Panorama/PanoramaItems so they are set correctly
I have the following code in silverlight for windows phone :
<Border CornerRadius="0" x:Name="brdTest" BorderBrush="Black" BorderThickness="4" Width="100" Height="60">
<Border.Background>
<ImageBrush x:Name="backgroundImageBrush" Stretch="Fill">
<ImageBrush.ImageSource>
<BitmapImage x:Name="bmpBackground" UriSource="http://www.images.com/1.jpg">
</BitmapImage>
</ImageBrush.ImageSource>
</ImageBrush>
</Border.Background>
</Border>
How can i add a loading activity indicator from silverlight toolkit in the image place while the image(http://www.images.com/1.jpg) loads and remove it when the image has loaded?
Do the images load in a background thread? Or do they block the main UI Thread? (i.e. i would like to use this in a template for lots of list box items)
UPDATE I tried this code and loaded a big image (70MP), and while the image was loading, the app's main UI thread didn't froze
You could use a ProgressOverlay, or a PerformanceProgressBar. Here's an example with a ProgressOverlay:
<Grid>
<Border CornerRadius="0" x:Name="brdTest" BorderBrush="Black" BorderThickness="4" Width="400" Height="360">
<Border.Background>
<ImageBrush x:Name="backgroundImageBrush" Stretch="Fill">
<ImageBrush.ImageSource>
<BitmapImage x:Name="bmpBackground"
UriSource="http://www.bestmotherofthegroomspeeches.com/wp-content/themes/thesis/rotator/sample-4.jpg"
ImageOpened="bmpBackground_ImageOpened">
</BitmapImage>
</ImageBrush.ImageSource>
</ImageBrush>
</Border.Background>
</Border>
<Controls:ProgressOverlay
x:Name="overlay"
Width="400" Height="360">
<Controls:ProgressOverlay.Content>
<StackPanel>
<TextBlock HorizontalAlignment="Center">Loading Image</TextBlock>
<toolkit:PerformanceProgressBar IsIndeterminate="True"/>
</StackPanel>
</Controls:ProgressOverlay.Content>
</Controls:ProgressOverlay>
</Grid>
And in the bmpBackground_ImageOpened event handler you add overlay.Hide(); which hides the OverlayProgress.
This approach seems better than just using a PerformanceProgressBar alone, because it gives the user an indication on what's going on.
PS: The OverlayProgress didn't work properly for me until I added a PerformanceProgressBar in it's "Content" as shown in the code. (try removing it and see if it works for you).
I hope this helps :)
Check this link. Here the author has explained about progress indicators and using different threads using Dispatcher.BeginInvoke
You could toggle the visibility of the progress bar once done, and display the image.
Hope this helps.
just added to the BitmapImage : ImageOpened="bmpBackground_ImageOpened" and this calls a method so that i may remove a child ( toolkit loading item ) .
EDIT
how can i call for that listbox that contains the image that called "bmpBackground_ImageOpened" to remove a child? Practically i want to call the parent listboxItem of this spacific BitmapImage so that i may remove a child (the loading image).
Below is the XAML code i have for a Bing Maps Silverlight weather related implementation.
Here is what i am trying to do:
Have a bing maps with several (over 100) pushpins- on mouseover - show a contentpopup (canvas=myPopup) below. Simple enough.
Everything works fine - however, when mypopup displays on mouseover, it is not on the foreground (the other pins appear on top of the contentpopup) - hence making it not very readable.
Question:
How do i specifiy the myPopup canvas specified in XAML below to always appear in the foreground, i.e. top most of the Bing Maps silverlight control when a user views it on mouseover.
Thanks!
<Grid x:Name="LayoutRoot" Background="White">
<m:Map x:Name="GlobalMap" Mode="Road" Center="15,7" ZoomLevel="2" CredentialsProvider="{StaticResource MyCredentials}" Margin="-70,-40,-100,-72">
<m:MapLayer x:Name="myLayer">
<Canvas x:Name="myPopup" Visibility="Collapsed" Opacity="1">
<Rectangle x:Name="myPopupRectangle" Fill="White" Canvas.Left="0" Canvas.Top="0" Height="100"
Width="100" RadiusX="15" RadiusY="15"/>
<StackPanel Canvas.Left="8" Canvas.Top="8">
<TextBlock x:Name="myPopupTexts" FontSize="5" Width="100">
</TextBlock>
</StackPanel>
</Canvas>
</m:MapLayer>
</m:Map>
</Grid>
Try adding Canvas.ZIndex to the MapLayer element, give it a large value like 200 or add your push pins to another MapLayer (rather than adding the pins directly to the map) that appears ahead of this popup layer in document order.
I did something similar to this, but took a different approach. What I did was create a custom pushpin template and create a PopUp within the template.
When the user hovers over the pushpin, the popup is displayed. Using the PopUp will solve your problem, since the control will automatically position it on top of everything. Try wrapping the Canvas in a PopPup and see if that works.
hth