I want to insert 2 Buttons in my C# Project. But just one of them works. I Tried different things, and i noticed in the second button script BorderBrush="{x:Null}" /> is a /> i think this is the problem. But at the time i remove it / convert it to a > it gives me an error out.
But heres the code, maybe you can help:
*Edit: Code is to long so heres a Link: http://pastebin.com/MysA7Dh1
**Edit: First a big Thanks for the Help :)! And i dont want you to do the work for me but i dont find an solution. The first button just looks like the second on the xaml code for me.
But now i can click the button but this time i dont see the image. I see it on the first button but not on the second.
Updated code: http://pastebin.com/PZhtssSy
nvm i set the Margin wrong. :/
Are you trying to include that image inside the button code? Or is the image supposed to be separate?
If you're trying to include the image inside the button, your code should look like this (code overly simplified for clarity):
<Button>
<Image/>
</Button>
If they are supposed to be separate:
<Button />
<Image />
Related
I found a lot of similar questions on internet but no solutions to solve my problem.
The problem is really simple, I just want to resize a calendar, nothing more. Many people recommanded to use a Viewbox like that :
<Viewbox
Width="400"
Height="400"
Stretch="Fill"
StretchDirection="Both">
<Calendar />
</Viewbox>
This solution seems to work for many guys that faced the same issue, but didn't work for me as you can see on the snapshot below :
result of above code
I have tried other values for StrechDirection but nothing is getting better.
The ViewBox is inside a simple UserControl.
Thanks in advance
I found the problem. I have changed my buttons style for the whole application. Because a calendar contains a lot of buttons, each button in the calendar were impacted by my buttons style.
I'm trying to create a button in WPF with MaterialDesignInXaml installed, without the animation when clicking it:
I've already looked through each property of the button and took a look at the buttons source code, but haven't found a solution.
The problem is, that the animation exceeds the rounded window.
I'm still quite on the beginner level of designing with xaml
Set the RippleAssist.Feedback attached property to Transparent:
<Button materialDesign:RippleAssist.Feedback="Transparent" Content="..." />
This is my xaml
<usercontrol xxxxxx
xxxxxxx
<grid >
<Grid.rowdefinition>
<rowdefinition></rowdefinition>
<rowdefinition></rowdefinition>
</Grid.rowdefinition>
<grid Grid.row=2>
<canvas x:name="canvas" Button.click = "Somefunction">
</canvas>
</grid>
</usercontrol>
So I have a User control with 2 rows in a grid, I have a canvas in 2nd row. Well, I am dynamically creating buttons and adding them as a children to the canvas. Now, at present, when any button present in canvas is clicked, this somefunction which i have defined in code behind will be invoked. In somefunction, i have some code which acts according to the button clicked inside the canvas.
Now, What I want is, I want to select 2 buttons, but, selection should happen on long press of the one button followed by long press of the second button. Once, both are selected, I want to execute my own code.
How to code long press button selection on the dynamically created,attached buttons in the canvas explained as above. I found some links in the stackoverflow and codeproject. But, That really didnt gave me proper idea on how to go about with the present xaml and programmed logic. Hence, Please suggest on this, with basis to the above xaml structure and explained logic of program.
Thank you,
Rakesh.N
I think this might help you out...
I'm creating this test Metro application using Windows 8, VS2012, C# and XAML. There are different TextBox in the application page arranged in a StackPanel. When the application is launched the focus is on the first TextBox.
I was wondering how to "deactivate" this.
Here's a pic, as you can see the first field is focused (color changed and ToolTip displayed).
When your UI is loaded you can remove focus from the TextBox by applying a Programmatic focus state to any other control.
Imagine that you have a Button named myButton. You can:
myButton.Focus(FocusState.Programmatic);
You cannot however use FocusState.Unfocused state to remove focus from the TextBlock because it is not allowed and will throw an exception.
One simple fix for this is place something to catch it first with IsTabStop="True" with a 0 Opacity which is a bit hacky but the only way I know. So something like;
<TextBox IsTabStop="True" Opacity="0" Height="1" Width="1"/>
<!-- Then the rest of your content like your other TextBox stuff -->
I am currently implementing a few snapped views, and I've ran into a problem I couldn't find an answer to. Perhaps you beautiful minds can help me out.
When I drag my app from a filled state to a snapped state, there is a period of about 1 - 1.5 secs where the old "filled" view is still displayed in the snapped viewspace. Doesn't look good! I would imagine there would be a standard behavior that should be applied here. Do I show the splash screen? Do I animate in items (and if so, what event should I listen for)?
Thanks for all help!
Edit: Here is a bit of simplified code from one of my views who experiences this lag - a search results page:
<Grid x:Name="LayoutRoot">
<Grid x:Name="FullViewGrid">
<!-- Two GridViews containing up to 27 items each (not very advanced) -->
</Grid>
<Grid x:Name="SnappedViewGrid">
<!-- Two ListViews doing the same thing, with different item templates -->
</Grid>
</Grid>
Basically I'm implementing my own spin of the standard Search Contract template given in VS2012. I have a feeling the CPU is being stressed a bit too much while rendering these changes in the UI - and that's why things aren't going too smoothly.
Yeah, so this is something you are doing wrong. SnapView doesn't have a delay like that. If you are interested you can review my SnapView walkthrough: http://blog.jerrynixon.com/2012/12/walkthrough-implementing-snapview-in.html
Without a code sample from your app, this is the best I can offer right now. But hopefully this will be all you need to get on the right path for SnapView. Best of luck!