I'm supposed to make a user-control using WPF, and now i'm bumping into a weird problem.
I came up with a kinda weird solution to get an image along with some text in a button, like this:
<Button Height="24" Width="100" Name="btn_change">
<StackPanel Width="90">
<Image Source="Images\11.png" Width="24" Height="18" HorizontalAlignment="Left" Panel.ZIndex="-1" Stretch="Uniform"></Image>
<Label Content="Change" HorizontalAlignment="Right" Margin="0,-18,0,0" Height="20" Padding="0,0,0,0" />
</StackPanel>
</Button>
This worked perfectly, until i started using a MVVM Framework (Caliburn.Micro). From that point on the images no longer show up in the buttons, just the text. I can't figure out why it doesn't work.
Maybe someone with knowledge of MVVM Frameworks can explain this or give me a solution :)
Thanks in advance!
EDIT:
Never mind! I looked it over thanks to H.B. and it seemed I moved the View to a subfolder. I changed the image source from "Images\11.png" to "..\Images\11.png" and it worked!
Just change your image source from "Images\11.png" to "..\Images\11.png" and it will work.
Related
So every time i add images to a button this effect happens, usually when brushing over the button.
i assume it has something to do with the default button mouse over effect but so far i've had no luck with changing the default style and this effect keeps happening. is this just wpf being wpf or something that shouldn't usually happen.
Button before mousing over/ brushing over:
Wrongly displayed button:
<Button Grid.Row="5" Grid.Column="0" x:Name="savebutton" HorizontalAlignment="Center" Click="savebutton_Click">
<Button.Content>
<Image Source="Images/folder.png" Width="40" Height="40" />
</Button.Content>
</Button>
I got a problem with the ScrollViewer in Visual Studio.
First off, I'm german and my english isn't that good, so I hope you guys understand me.
Here's the problem:
I made a timetable in C# and it's way too big for the window to display everything on the timetable. Then I added scrollbars but the problem is that they're not "active". Means I can't scroll even though they're visible. I have no idea what isn't working there, so I thought you could help me. Hopefully somebody knows how to solve the problem.
Here's the code for the scrollviewer:
<ScrollViewer HorizontalScrollBarVisibility="Visible VerticalScrollBarVisibility="Visible" Margin="10,0,0,0" >
<Canvas x:Name="uiCVStundenplan" Background="White" Margin="116,65,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
</Canvas>
</ScrollViewer>
As I said before, the timetable is way too big for the window. So I don't understand why the scrollbars aren't active.
I hope I explained it well enough for you. I'm counting on you!♥
I think there is a mistake in your code. You forget a double quote after HorizontalScrollBarVisibility, after Visible.
<ScrollViewer HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Margin="10,0,0,0" >
<Canvas x:Name="uiCVStundenplan" Background="White" Margin="116,65,10,10" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
</Canvas>
</ScrollViewer>
I want to know how to add additional button to Form ControlBox that is present at image below:
I know in this forum are few similar questions but no single one answered my question. I checked few links and its not that what i expected because its not working at every operating system. I checked those links:
http://www.codeproject.com/Articles/11510/Add-Transparent-Menus-and-XP-Titlebar-Buttons-to-y
http://www.codeproject.com/Articles/10171/Adding-a-Minimize-to-tray-button-to-a-Form-s-capti
Other idea is to change default click event and icon for MaximizeBox because i don't need this one in my app.
Scratch this - just realized it's a Winforms issue.
Kinda lame suggestion, but in WPF I'd do:
Drop the title
<Window> ... WindowStyle="None" ... /<Window>
Then roll my own:
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right">
<Button HorizontalAlignment="Right" Width="25" Content="Yo!"/>
<Button HorizontalAlignment="Right" Width="20" Content="-"/>
<Button HorizontalAlignment="Right" Width="20" Content="■"/>
<Button HorizontalAlignment="Right" Width="20" Content="X"/>
</StackPanel>
Caveats:
You will have to do a mouse capture to move the window, not difficult but not trivial either. Also change the style of the buttons to look like the regular icons etc
Not ideal I know, but in a pinch ...
I'm trying to implement a nice-looking horizontally scrolled gridview inside my app. I have already implemented it using the Q42.WinRT library like this:
<Canvas>
<StackPanel Orientation="Horizontal" Height="768">
<StackPanel.RenderTransform>
<CompositeTransform
TranslateX="{Binding ElementName=MyScrollViewer, Path=HorizontalOffset, Converter={StaticResource ParallaxConverter}}" />
</StackPanel.RenderTransform>
<Image Source="/Assets/3.jpg" Width="1366" Stretch="UniformToFill"/>
<Image Source="/Assets/1.jpg" Stretch="UniformToFill"/>
<Image Source="/Assets/2.jpg" Stretch="UniformToFill"/>
</StackPanel>
</Canvas>
<ScrollViewer
x:Name="MyScrollViewer"
HorizontalScrollMode="Enabled"
HorizontalScrollBarVisibility="Auto"
VerticalScrollMode="Disabled"
VerticalAlignment="Center"
Height="768">
<GridView>
//...my gridview goes here
</GridView> </ScrollViewer>
Everything works fine, however in my app I need to use semantic zoom, and I found that semantic zoom does NOT WORK properly when put inside a ScrollViewer.
Generally all the solutions for parallactic backgrounds that I found on the internet implement some kind of functionality over a scrollviewer, which is unfortunate for me as I cannot use it.
Can anybody think of another way to achieve the desired effect?
Generally putting GridViews inside a ScrollViewer is not a great idea since they already have ScrollViewers inside of them...
You should put your 2 GridViews inside a SemanticZoom.
Perhaps you could edit the template for your GridView and put a parallax background in there - perhaps as a Canvas with some content that responds to the ViewChanged events on the GridView.
EDIT*
You inspired me to try to write a ParallaxBackgroundBehavior for the Toolkit. :)
You can see an early version here. There is also a sample included.
I'm applying EntranceThemeTransition to StackPanel that contains bunch of controls. When I show a popup everything works fine except TextBlocks that jump a little after animation.
Here is a video of that:
http://screencast.com/t/VXSiti6Mh
Here is code I'm using:
<StackPanel Margin="40">
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition FromHorizontalOffset="100" />
</TransitionCollection>
</StackPanel.ChildrenTransitions>
<TextBlock Text="Filter Results" />
<TextBlock >Show</TextBlock>
</StackPanel>
The popup itself has PaneThemeTransition set as it's Transition.
Any ideas why it could be happening?
Have you tried:
UseLayoutRounding="True" SnapsToDevicePixels="True"
on the container.
I found a workaround - wrap each textblock with StackPanel. Clearly it's not ideal but it works.
I still wonder if there is a way to fix it without hacks...