I have an issue with the NavigationView control in my UWP app. When I set the IsPaneToggleButtonVisible to false, my PaneHeader collapses too. Offically this bug was solved, am I doing something wrong?
<NavigationView PaneDisplayMode="Left" IsPaneToggleButtonVisible="False" IsBackButtonVisible="Collapsed" OpenPaneLength="200" IsSettingsVisible="False" Height="923">
<NavigationView.PaneHeader>
<Image x:Name="Header" Source="/Assets/Header.png" Stretch="UniformToFill" Margin="0,0,0,0" HorizontalAlignment="Left" Width="216" Height="53"/>
</NavigationView.PaneHeader>
<NavigationView/>
Based on this thread, it mentions
This issue was addressed in #1083, which has now been successfully
released as Microsoft.UI.Xaml v2.2.190731001-prerelease.
This means the bug has solved in the Windows UI Library version of NavigationView, so if you want to show your PaneHeader, you need to install the Microsoft.UI.Xaml nuget package and then add <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/> to your Application.Resources.
.App.xaml:
<Application>
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</Application.Resources>
</Application>
.MainPage.xaml:
<Page
......
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
>
<Grid>
<muxc:NavigationView PaneDisplayMode="Left" IsPaneToggleButtonVisible="False" IsBackButtonVisible="Collapsed" OpenPaneLength="200" IsSettingsVisible="False" Height="923">
<muxc:NavigationView.PaneHeader>
<Image x:Name="Header" Source="Assets/StoreLogo.png" Stretch="UniformToFill" Margin="0,0,0,0" HorizontalAlignment="Left" Width="53" Height="53"/>
</muxc:NavigationView.PaneHeader>
</muxc:NavigationView>
</Grid>
</Page>
By default, Pivots transition their PivotItems in/out using a horizontal translation with an opacity fade. I'd like a way to remove them (firstly), but also customize if possible.
Things I've tried to remove them (just passing an empty TransititionCollection in):
<Pivot>
<Pivot.Transitions>
<TransitionCollection />
</Pivot.Transitions>
<Pivot.ItemContainerTransitions>
<TransitionCollection />
</Pivot.ItemContainerTransitions>
<PivotItem Header="Red">
<PivotItem.Transitions>
<TransitionCollection />
</PivotItem.Transitions>
<PivotItem.ContentTransitions>
<TransitionCollection />
</PivotItem.ContentTransitions>
<Grid Background="Red" Width="100" Height="200" />
</PivotItem>
<PivotItem Header="Green">
<Grid Background="Green" Width="100" Height="200" />
</PivotItem>
</Pivot>
If you dig into the default Pivot template, you will find the following part for the content:
<ItemsPresenter x:Name="PivotItemPresenter" Grid.ColumnSpan="3" Grid.Row="1">
<ItemsPresenter.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
<CompositeTransform x:Name="ItemsPresenterCompositeTransform"/>
</TransformGroup>
</ItemsPresenter.RenderTransform>
</ItemsPresenter>
These two Transforms inside the TransformGroup manage the animation of the items, there is no Transition behind it. This means that setting TransitionCollection empty has unfortunately no effect.
Even more unfortunate is the fact that you cannot easily remove the transition, because trying trying to remove either of the two Transforms from the Pivot style will make the control not render properly. This is likely because both transforms are referenced within the controls code-behind.
As a result, it seems that customizing the animation of the built-in Pivot is unfortunately not possible.
I have 93 SVG files which I converted to XAML using XamlTune and following these instructions. The resulting files place the vector information into a Canvas.
I know need to how to use these files in my application. Do I need to put these into a ResourceDictionary, or can I access them directly from the app package?
An example XAML file:
<Canvas Name="Layer_1" Width="20" Height="20" ClipToBounds="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Canvas><Path Fill="#FF222222"><Path.Data><PathGeometry FillRule="Nonzero" Figures="M4.3,0.025C3.776,0.025,3.35,0.451,3.35,0.975L3.35,4.775C3.35,5.299 3.776,5.725 4.3,5.725 4.824,5.725 5.25,5.299 5.25,4.775L5.25,0.975C5.25,0.451,4.824,0.025,4.3,0.025z" /></Path.Data></Path><Path Fill="#FF222222"><Path.Data><PathGeometry FillRule="Nonzero" Figures="M15.7,0.025C15.176,0.025,14.75,0.451,14.75,0.975L14.75,4.775C14.75,5.299 15.176,5.725 15.7,5.725 16.224,5.725 16.65,5.299 16.65,4.775L16.65,0.975C16.65,0.451,16.224,0.025,15.7,0.025z" /></Path.Data></Path><Path Fill="#FF222222"><Path.Data><PathGeometry FillRule="Nonzero" Figures="M18.55,3.35L17.6,3.35 17.6,4.775C17.6,5.82 16.745,6.675 15.7,6.675 14.655,6.675 13.8,5.82 13.8,4.775L13.8,3.35 6.2,3.35 6.2,4.775C6.2,5.82 5.345,6.675 4.3,6.675 3.255,6.675 2.4,5.82 2.4,4.775L2.4,3.35 1.45,3.35C0.926,3.35,0.5,3.776,0.5,4.3L0.5,7.15 0.5,8.575 1.925,8.575 18.075,8.575 19.5,8.575 19.5,7.15 19.5,4.3C19.5,3.776,19.074,3.35,18.55,3.35z" /></Path.Data></Path><Path Fill="#FF222222"><Path.Data><PathGeometry FillRule="Nonzero" Figures="M0.5,9.525L0.5,19.025C0.5,19.549,0.926,19.975,1.45,19.975L18.55,19.975C19.074,19.975,19.5,19.549,19.5,19.025L19.5,9.525 0.5,9.525z M17.6,18.075L2.4,18.075 2.4,11.425 17.6,11.425 17.6,18.075z" /></Path.Data></Path></Canvas></Canvas>
I suppose I understand what you are asking. Let's start that using them in a ResourceDictionary is perfectly fine, and might be ideal. The second, most obvious use, would be to put them in a UserControl. Both options would allow you to reuse them however you want.
Let's pretend I had a Canvas and I wanted to do just that.
<Canvas Height="100" Width="100" Background="Blue" />
Now, to use a ResourceDictionary, I would do this:
<Grid>
<Grid.Resources>
<DataTemplate x:Name="MyShape">
<Canvas Height="100" Width="100" Background="Red" />
</DataTemplate>
</Grid.Resources>
<ContentPresenter Content="{x:Null}" ContentTemplate="{StaticResource MyShape}" />
</Grid>
Note you can remove this from Resources and move it to a file if you like.
And, if you want a user control which gives you advantage of code-behind, you can do that, too.
Best of luck.
Is it possible to make a round image from a squared image on a Windows phone? I have a lot of images which should be displayed as a circle. But how can I do this?
In XAML you want to make the circle using an Ellipse control. Then give it an ImageBrush fill.
<Ellipse Height="100" Width="100">
<Ellipse.Fill>
<ImageBrush ImageSource="YourImage.png"/>
</Ellipse.Fill>
</Ellipse>
My idea is very simple:
<Image Source="ImagePath" Width="326" Height="188">
<Image.Clip>
<EllipseGeometry Center="170,90" RadiusX="90" RadiusY="90" />
</Image.Clip>
</Image>
Or you can apply an OpacityMask to an Image to create a variety of opacity-related photo masking
<Image Source="ImagePath" >
<Image.OpacityMask>
<RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<GradientStop Color="#ffffffff" Offset="0.5" />
<GradientStop Color="#00ffffff" Offset="0.8" />
</RadialGradientBrush>
</Image.OpacityMask>
</Image>
You can use Image.Clip but i prefer the #robwirving solution. But you need to choice now!
Information here => http://msdn.microsoft.com/fr-fr/library/system.windows.uielement.clip(v=vs.110).aspx
I am new to Silverlight. I am trying to provide a zoom in functionality along with inkpresenter. I am using Silverlight 4, c#, asp.net. I can bind the slider to canvas and it does zoom in but i am facing problem with the scrollviewer layout which is not updating. there are allot of post that mentioned that i need to used layout transform. Can any one please let me know what i am doing wrong or any other suggestion.
<Slider x:Name="slider" Maximum="2" Minimum="0" Value="1" Width="100"/>
</StackPanel>
<ScrollViewer x:Name="scrollBar" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Column="1" Margin="6,1,1,1" Grid.Row="1">
<ScrollViewer.Content>
<toolkit:LayoutTransformer Name="TheTransformer" Background="{x:Null}">
<toolkit:LayoutTransformer.LayoutTransform>
<ScaleTransform x:Name="contentScale" ScaleX="{Binding ElementName=slider,Path=Value}" ScaleY="{Binding ElementName=slider,Path=Value}" />
</toolkit:LayoutTransformer.LayoutTransform>
<toolkit:LayoutTransformer.Content>
<Canvas x:Name="cnsImageEditable" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" OpacityMask="#FFE89E9E">
<!--The following commented bit does work i can zoomin and out but scroller not updating -->
<!--<Canvas.RenderTransform>
<ScaleTransform x:Name="scale" ScaleX="{Binding ElementName=slider,Path=Value}" ScaleY="{Binding ElementName=slider,Path=Value}"/>
</Canvas.RenderTransform>-->
<InkPresenter x:Name="inkCanvas" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Image x:Name="imgEditableImage" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></Image>
</InkPresenter>
</Canvas>
</toolkit:LayoutTransformer.Content>
</toolkit:LayoutTransformer>
</ScrollViewer.Content>
</ScrollViewer>
any help is much appretiated thanks
Check out https://stackoverflow.com/questions/9899729/layouttransformer-in-silverlight-not-working , worked for me. Specifically:
I found that Transforms in silverlight happens after Layout, so I changed the CanvasWidth property only once till the scrollbars show, and then zooming would work perfectly,