I have a sfdatepicker in my windows app project
but when i use it the SfDateSelector appears in american format, and i want to change it to european (day/month/year)
<Syncfusion:SfDatePicker x:Name="SearchDate1" Grid.Column="0" AccentBrush="{StaticResource BrandBrush}" />
for example on image bellow i want to see 09 11 2015
how can i achieve that?
You can set SelectorFormatString="d/m/y" on your DatePicker. See https://www.syncfusion.com/kb/5307/how-can-i-set-different-patterns-for-the-date-in-the-sfdatepicker
Related
I want one datetime field's background colour to depend on its value. Like if a certain date is passed, the background changes to red.
Is there a way to make this in XAML?
I know there is no possibility of an "if" condition/instruction, but maybe you guys found some way to implement a similar function.
<Canvas Canvas.Left="893" Canvas.Top="208" Height="25" Width="99" Background="red" Panel.ZIndex="-1"/>
<assembly:FieldControl Canvas.Left="890" Canvas.Top="206" FieldControlType="DateControl" FormField="{x:Null}" Height="25" LabelColumnWidth="0" Refnr="123456789" ShowCaption="False" StateImageAlignment="Hidden" Width="106" FontSize="10" Foreground="DimGray"/>
this is my code so far. The Canvas-Part makes the Background go red.
I also tried to put the background property in the "FieldControl" but there it's useless.
EDIT:
After getting the information, that Data Binding could help me with this problem, i tested it like this:
<TextBox Canvas.Left="890" Canvas.Top="226" Name="Date" Width="99" Height="25" VerticalAlignment="Top" Text="{Binding ElementName=Date, Path = SelectedItem.Content, Mode = TwoWay, UpdateSourceTrigger = PropertyChanged}" Background="{Binding ElementName=Date, Path=SelectedItem.Content}">
But this is not the direction, i need. Do you have maybe any suggestion, how I can use Data binding to solve my problem?
Yes, it is possible. The concept you need to learn is XAML Data Binding.
You can implement the IValueConverter for this.
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/data-binding/converters
You can check the value on binding and return the background color.
how to give different text color for each item of listview in xamarin forms
I want to display today's date in XAML and then return that to my view model. So this shows it in XAML
<TextBlock Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat=dd/MMM/yyyy}"/>
but I want to return it in ModifiedDate, so I did this
<TextBlock x:Name="ModifiedDate" Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat=dd/MMM/yyyy}"/>
This doesn't work. I don't want to use datepicker. I want to use Pure XAML and do not wish to go to code. Any ideas?
you have to include this name space in your xaml..if you are not able to show date..
xmlns:sys="clr-namespace:System;assembly=mscorlib"
and if you want something different update your question..
I have created a XamMenu in my silverlight page. It consists of 4 options in it. The header for the first item is 'order'. I am using xamMenuItem.icon to add an image on the right side of the header text. But it is always coming on the left side of the header text. How can I do that? Please help.
My xaml code id like this:
<ig:XamMenu x:Name="xamOrderMenu" Height="22" Width="120" ExpandOnHover="True" Canvas.Left="361" Canvas.Top="10">
<ig:XamMenuItem Header="Order" SubmenuPreferredLocation="Bottom" Background="LightGray" FontWeight="Bold" Cursor="Hand">
<ig:XamMenuItem.Icon>
<Image Source="/Asset.View;component/Images/downarrow.PNG"/>
</ig:XamMenuItem.Icon>
<ig:XamMenuItem Header="Order1" StaysOpenOnClick="True" Background="LightGray" Click="ExportToExcel_Click" Cursor="Hand"/>
<ig:XamMenuItem Header="Order2" Background="LightGray" Click="DownloadFundCountTemplate_Click" Cursor="Hand"/>
<ig:XamMenuItem Header="Order3" Background="LightGray" Click="UploadTemplate_Click" Cursor="Hand"/>
<ig:XamMenuItem Header="Order4" Background="LightGray" Click="SearchAndExportToExcel_Click" Cursor="Hand"/>
</ig:XamMenuItem>
You're going to need to retemplate the XamMenuItem to place the icon in a different spot. In the default template, the XamMenuItem is seperated into 3 columns. The icon is placed into the left-most column, header text in the center and the child indicator in the right-most column.
If you have the Infragistics product installed you have access to the default template. You can find it here:
C:\Program Files (x86)\Infragistics\NetAdvantage (release version #)\Silverlight\DefaultStyles\XamMenu
Open the generic.xaml file and do a search for XamMenuItem and the first thing that comes up should be the style for it. The template can be found there. Add this style and its dependencies to your project and then make the necessary adjustments to place the icon on the right side of the header text. You can then assign this style to your XamMenuItems.
Can someone provide me with an AvalonDock XAML code piece that when run opens the app with a floating window instead of being always docked inside the dock pane? I've seen programmatic ways to do it, but I thought there must be a way to specify it in XAML. Thanks...
I know this is a bit late, but hopefully it will help someone with the same issue in the future...
To create a floating document, add a LayoutDocumentFloatingWindow as a child of LayoutDocumentFloatingWindow, and then add your LayoutDocument as a child of the LayoutDocumentFloatingWindow, as below:
<xcad:DockingManager>
<xcad:LayoutRoot>
<xcad:LayoutRoot.FloatingWindows>
<xcad:LayoutDocumentFloatingWindow>
<xcad:LayoutDocument Title="My Document">
<!--Add document content here-->
</xcad:LayoutDocument>
</xcad:LayoutDocumentFloatingWindow>
</xcad:LayoutRoot.FloatingWindows>
</xcad:LayoutRoot>
</xcad:DockingManager>
Similarly you can add anchorables like so:
<xcad:DockingManager>
<xcad:LayoutRoot>
<xcad:LayoutRoot.FloatingWindows>
<xcad:LayoutAnchorableFloatingWindow>
<xcad:LayoutAnchorablePaneGroup>
<xcad:LayoutAnchorablePane>
<xcad:LayoutAnchorable Title="My anchorable">
<!--Add anchorable content here-->
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
</xcad:LayoutAnchorablePaneGroup>
</xcad:LayoutAnchorableFloatingWindow>
</xcad:LayoutRoot.FloatingWindows>
</xcad:LayoutRoot>
Note that unlike LayoutDocuments, for anchorables you need to add a group pane rather than just a single LayoutAnchorable, because floating anchorables are designed to be able to be grouped in a single window but LayoutDocuments are not.
As a more general guide, an example of how to set up varioius layout elements in a DockingManager can be found here: https://xceed.com/wp-content/documentation/xceed-toolkit-plus-for-wpf/AvalonDock.html
How do I go about styling a bound string to a TextBlock? I'd like to have some of the text bolded, but not all of it?
<TextBlock Name="lblZoneNumber" Margin="12, 20, 0, 0" TextWrapping="Wrap" Text="{Binding ZoneSummary}" />
A sample of the text would be:
"Your vehicle, test1234, is currently parked in Grand Rapids, MI at zone 100" and I'd like to bold the text like: "Your vehicle, test1234, is currently parked in Grand Rapids, MI at zone 100."
I can't really make these textblocks programmatically as the text is part of a view model/pivotitem.
You cannot do this until you start to develop for Mango, and then you would not use the TextBlock to do so, but the RichTextBox. A TextBlock can only have one styling. The RichTextBox is read only, BTW.
Here is a link to info about the RichTextBox: http://www.windowsphonegeek.com/articles/Windows-Phone-7-Mango-First-look-at-RichTextBox-control