ElementFlow element disables controls - c#

I am using the Fluidkit ElementFlow control that I use to display a UserControl that contains textblock with a ScrollViewer as well as button and when they are displayed in the ElementFlow control, all of the buttons and the ScrollViewer seem to be disabled because I can't scroll the ScrollViewer scrollbar and even a simple action as hovering over a button doesn't do anything to the button.
Below is an example of the TextBlock in a ScrollViewer that does not allow for scrolling when used in the ElementFlow.
How can this be fixed?
<ScrollViewer
Height="1200" Width="800"
MaxHeight="1200" MaxWidth="800"
VerticalScrollBarVisibility="Auto">
<TextBlock
Height="Auto" Width="800"
MaxWidth="800"
FontSize="20"
Text="Super long text"
TextWrapping="Wrap"/>
</ScrollViewer>

Just looking over the source code for the project, it looks like it is creating a 3D mesh, and painting the controls on the mesh. This would prevent all user interaction. I don't think there is an easy way to work around this.
However, since you have the source code, you can do the work yourself to make it happen. You're going to need to modify how the ElementFlow represents its items. Look at the CreateMeshModel function. It is currently creating a mesh and applying a VisualBrush to it. Instead, look at the blog post Interacting with 2D on 3D in WPF to figure out what needs to happen.

Related

How to put an auto show panel over a LibVLCSharp.WPF.VideoView?

I'm writing a WPF desktop application, with some video playback functions. I decided to use LibVLCSharp.WPF to complete the playback task.
Xaml code:
<UserControl ...
xmlns:vlc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
... >
<vlc:VideoView VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Canvas VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MouseEnter="Canvas_MouseEnter">
</Canvas>
</vlc:VideoView>
</UserControl>
It works fine with playing video, but when I tried to put some hidden controls inside Canvas (or any other type of Panel control) and change their visiblity with MouseEnter event, nothing happens.
While debugging, I found out that MouseEnter event can only fire when Canvas has at least one visible control as its child, and mouse pointer entered that visible control.
I have read the articles about "airspace issue". It seems nothing to do with me since I just want to draw a control layer exactly inside playback area.
Is there any way that I can put an auto show panel on VLC player, which only shows when mouse "hovered" over playback area?
Problem solved with hint from #cube45 . Thank you.
I changed Background of Canvas to something that "not so transparent".
Xaml code:
<Canvas Background="#01000000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MouseEnter="Canvas_MouseEnter">
</Canvas>
And mouse events worked. Tricky, but useful.

WPF ScrollViewer for ListBox -> Performance issues

I'm trying to create grid with listbox with Scrollbar.
It's done somehow like that:
<Grid>
<ListBox Name="xxx" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
....
</ListBox>
</Grid>
The problem is that if I use scrollbar, then the size of bar-button jumps back and forward within scrolling. If I remove ScrollViewer from properties and instead put ListBox in ScrollViewer tag, then everything is working perfect, except of terrible performance of rerendering UI (resize, move window, resource consuming). According to google it does "disable virtualization". This sounds crazy that there's no simple solution to get properly working scrollbar and usable UI without issues.
Is there compromise for both of these things? Virtualization + properly working scrollviewer with fixed size of scrollbar button.

How to disable all the controls on windows phone by displaying a semi transparent control over the page?

I'd like to have some sort of semi transparent/translucent effect displayed over the entire page and then display my option buttons on top of it but I just can't figure out how and it's driving me nuts! I've seen it in plenty of wp8 apps so it is doable but I just don't know how!
Once this semi transparent/translucent effect is displayed, I want it to dissapeared if clicked on or if one of my option buttons is clicked, and restore the screen as it was or execute an action accordingly.
I've somehow managed to do it by setting the Background colors using a storyboard but strangely enough, once displayed and my options buttons appear, they look fine but once the storyboard is completed, the button then look disabled as well which just looks wrong!!
What is the proper way to give a "Disabled" effect as if you had a semi transparent dialog box displayed over a window.
Any ideas, suggestions or code would be appreciated.
Thanks.
You may be making this more complicated than it needs to be. Consider the following XAML for example:
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="ContentRoot">
...
</Grid>
<Grid x:Name="ContentOverlay" Background="#AA000000" Visibility="Collapsed">
...
</Grid>
</Grid>
Both ContentRoot and ContentOverlay will anchor at the top left of the LayoutRoot grid and span the row height. They will stack from furthest to closest in order of declaration, so ContentRoot will be rendered beneath ContentOverlay. Simply manipulate the Visibility of ContentOverlay based on user input.
Alternatively, you can set the Opacity for ContentOverlay to 0 along with collapsed visibility (required so it doesn't intercept hits to the ContentRoot child controls below) and fade it in and out using storyboarding in Blend. That probably looks like a slightly cleaner transition to a user, even if it's only 0.3 seconds long or so.
Use Blend to specify VisualStates (View | States. Then 'states' tab.) You can switch between states in code behind using VisualStateManager.GoToState. One state would be normal, the other all controls disabled.
Mike

What is VerticalPanningRoot (C# Metro ScrollBar Template)

I am currently looking at the C# Metro default controltemplate for scrollbar. And in it the scrollbar template, there is this portion that called verticalpanningroot. Do you have any idea which part of the scrollbar UI is it responsible to render?
<Grid x:Name="VerticalPanningRoot" VerticalAlignment="Top" MinHeight="66">
<Border x:Name="VerticalPanningThumb"
Background="{StaticResource ScrollBarPanningBackgroundThemeBrush}"
BorderBrush="{StaticResource ScrollBarPanningBorderThemeBrush}"
BorderThickness="{StaticResource ScrollBarPanningBorderThemeThickness}"
Width="4" MinHeight="17"/>
</Grid>
Thanks.
If you mean x:Name="VerticalPanningRoot", it just means that you can access your Grid by it's name in your code behind (C#) which is VerticalPanningRoot.
Example:
VerticalPanningRoot.HorizontalAlignement = // something
Edit:
Your Grid is actually holding the "thumb" (the Border element) of the ScrollBar (the thumb is the part you can drag and drop to go down and up more faster).
You can see here all the ScrollBar parts, this image is taken from this tuto.

Place WPF Popup Along Bottom of Screen

I have a Popup that consists of a grid of labels. The popup sits inside a Canvas like this.
<Canvas x:Name="mainCanvas">
<Popup x:Name="mainPopup"
IsOpen="True"
PlacementTarget="{Binding ElementName=mainCanvas}"
PopupAnimation="Fade"
AllowsTransparency="True"
Placement="Center">
Wrapping inside the canvas (or similar control) is the only way I've found to allow the popup's contents to be transparent.
Anyway, all of this works fine and I see my grid of labels across the center of the screen. What I'd really want though is to display the grid of labels across the bottom of the screen. However when I change Placement="Center" to Placement="Bottom", I don't see the popup at all.
Have you seen this? It is a pretty good explanation about how popup placement works.
I created a test WPF project in Blend and pasted your exact code, then changed Placement to Bottom. I did see the content I added to the popup (a TextBlock with some junk text), but it was hard to see, since it is positioned below mainCanvas (as expected).
So... there must be some other problem aside from the code you showed.

Categories