I'm trying to get a color gradient like this picture :
I tried to deal with this via this description, I think I need a deep understanding about the Offset feature
<LinearGradientBrush x:Key="GradientCard1" StartPoint="0,0" EndPoint="10,10">
<GradientStop Offset="0.10" Color="#00FFA3" />
<GradientStop Offset="10.10" Color="#03E1FF" />
<GradientStop Offset="0.2" Color="#101921" />
</LinearGradientBrush>
Related
I am using geoserver styles, and i want to add point layer withe icons like google maps or custom icon,
I made this :
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:type="simple" xlink:href="administration.png" />
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</PointSymbolizer>
But it takes the center of icon, how can I make displacement X and Y to take into consideration the top right on my icon for example knowing that the icone has 32x32px
Thanks lot
I found a solution but not very well :
This is :
<svg version="1.1"
id="Ebene_1"
xmlns="&ns_svg;"
xmlns:xlink="&ns_xlink;"
width="32"
height="74"
overflow="visible"
xml:space="preserve">
<image x="0" y="0" width="32" height="37" xlink:href="administration.png" />
</svg>
The problem is that the clicked area is big than the visual icon in openlayers.
Any help is very precious
I have a telerik RadCartesianChart and i just want to add horizontaly aligned static text on the Y axis of the chart.
Below is the chart xaml`
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Minimum="-10" Maximum="100" MajorStep="10" FontFamily="Verdana" FontSize="9" ShowLabels="True" LabelFitMode="None">
</telerik:LinearAxis>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:LinearAxis Minimum="1" Maximum="100" MajorStep="10" ShowLabels="True" FontFamily="Verdana" FontSize="9" >
</telerik:LinearAxis>
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.Grid>
<telerik:CartesianChartGrid MajorLinesVisibility="XY">
<telerik:CartesianChartGrid.MajorXLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#868686"/>
</Style>
</telerik:CartesianChartGrid.MajorXLineStyle>
<telerik:CartesianChartGrid.MajorYLineStyle>
<Style TargetType="Line">
<Setter Property="Stroke" Value="#868686"/>
</Style>
</telerik:CartesianChartGrid.MajorYLineStyle>
</telerik:CartesianChartGrid>
</telerik:RadCartesianChart.Grid>
<telerik:RadCartesianChart.Series>
<telerik:ScatterPointSeries Cursor="Arrow" DisplayName="Name" ItemsSource="{Binding}" ShowLabels="True" >
<telerik:ScatterPointSeries.XValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="X" ></telerik:PropertyNameDataPointBinding>
</telerik:ScatterPointSeries.XValueBinding>
<telerik:ScatterPointSeries.YValueBinding>
<telerik:PropertyNameDataPointBinding PropertyName="Y"></telerik:PropertyNameDataPointBinding>
</telerik:ScatterPointSeries.YValueBinding>
<telerik:ScatterPointSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinition HorizontalAlignment="Center" Strategy="{StaticResource strategy}">
</telerik:ChartSeriesLabelDefinition>
</telerik:ScatterPointSeries.LabelDefinitions>
</telerik:ScatterPointSeries>
<!--ScatterAreaSeries-->
<telerik:ScatterAreaSeries XValueBinding="X" YValueBinding="Y" ZIndex="-200" Fill="Red" ShowLabels="True">
<telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterDataPoint XValue="0" YValue="200"/>
<telerik:ScatterDataPoint XValue="200" YValue="0"/>
</telerik:ScatterAreaSeries.DataPoints>
</telerik:ScatterAreaSeries>
<telerik:ScatterAreaSeries XValueBinding="X" YValueBinding="Y" ZIndex="-200" Fill="Yellow" ShowLabels="True">
<telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterDataPoint XValue="0" YValue="140"/>
<telerik:ScatterDataPoint XValue="140" YValue="0"/>
</telerik:ScatterAreaSeries.DataPoints>
</telerik:ScatterAreaSeries>
<telerik:ScatterAreaSeries XValueBinding="X" YValueBinding="Y" ZIndex="-200" Fill="Green" ShowLabels="True">
<telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterDataPoint XValue="0" YValue="90" Label="Category" />
<telerik:ScatterDataPoint XValue="90" YValue="0"/>
</telerik:ScatterAreaSeries.DataPoints>
<telerik:ScatterAreaSeries.LegendSettings>
<telerik:SeriesLegendSettings Title="Low Moderate High Significant Critical" />
</telerik:ScatterAreaSeries.LegendSettings>
</telerik:ScatterAreaSeries>
</telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>`
all i needed was setting the Title property
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis Minimum="-10" Maximum="100" MajorStep="10" FontFamily="Verdana" FontSize="9" ShowLabels="True" LabelFitMode="None" Title="This is all i needed to set">
</telerik:LinearAxis>
</telerik:RadCartesianChart.VerticalAxis>
I have a long list selector and i have a datatemplate as item template, containing an image. I want the source to change based on a property from the model. I tried with a converter but i could't get it to work.
Now i'm trying with triggers. I have:
<Image Name="MovieThumbnail">
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding DataContext.IsCategoryCurrent,ElementName=LayoutRoot}" Value="true">
<ei:ChangePropertyAction TargetObject="{Binding ElementName=MovieThumbnail}" TargetName="Source" Value="{Binding Path=Image120x170}" PropertyName="Source"/>
</ei:DataTrigger>
<ei:DataTrigger Binding="{Binding DataContext.IsCategoryCurrent,ElementName=LayoutRoot}" Value="false">
<ei:ChangePropertyAction TargetObject="{Binding ElementName=MovieThumbnail}" TargetName="Source" Value="{x:Null}" PropertyName="Source"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
</Image>
It work almost how i want it to, except that images repeat themselves. As in a movie has the picture of another movie. I think it's because i bind by element name and the image control has multiple instances (one for each item), but i would think they can't see each other. Any help highly appreciated.
EDIT:
After further investigation, it seems that this happens because of the long list selector.
I first load 40 items, and then load another 40, but the second batch of 40 items get the pictures from the first batch. If i raise a property changed event, then the pictures from the second batch are set on all items repeating themselves. I have no idea why this is happening.
If i load another 40 and raise property changed on IsCategoryCurrent again, the pictures from the 3rd batch get set 3 times.
I managed to fix it:
<Image
Grid.RowSpan="2"
Name="MovieThumbnail"
Stretch="Fill"
Width="130" Height="195"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<i:Interaction.Triggers>
<ei:DataTrigger Binding="{Binding DataContext.IsCategoryCurrent,ElementName=LayoutRoot}"
Value="true">
<ei:ChangePropertyAction TargetObject="{Binding ElementName=MovieThumbnail}"
TargetName="Source"
PropertyName="Source">
<ei:ChangePropertyAction.Value>
<BitmapImage CreateOptions="BackgroundCreation"
UriSource="{Binding Path=Image120x170}"/>
</ei:ChangePropertyAction.Value>
</ei:ChangePropertyAction>
</ei:DataTrigger>
<ei:DataTrigger Binding="{Binding DataContext.IsCategoryCurrent,ElementName=LayoutRoot}"
Value="false">
<ei:ChangePropertyAction TargetObject="{Binding ElementName=MovieThumbnail}"
TargetName="Source"
Value="{x:Null}"
PropertyName="Source"/>
</ei:DataTrigger>
</i:Interaction.Triggers>
</Image>
And i raise a property changed event of IsCategoryCurrent at every change.
Has anyone had this problem before?
I want to show an animation in windows phone 7, my sdk version is 7.1,I wanna rotate a picture as animation in my app.but it didn't work.
<Image.Resources>
<Storyboard x:Name="myStoryboard">
<DoubleAnimation
Storyboard.TargetName="myTransform"
Storyboard.TargetProperty="Angle"
From="0" To="360" Duration="0:0:5"
RepeatBehavior="Forever" />
</Storyboard>
</Image.Resources>
WP7 animations are not the same as WPF - one CompositeTransform object instead of a few for different purposes. First off, I would declare this animation in PhoneApplicationPage.Resources.
You need specify target animation and the property.
<phone:PhoneApplicationPage.Resources>
<Storyboard x:Name="myStoryboard">
<DoubleAnimation
Storyboard.TargetName="myTransformPanel" <!-- Here is a object that
you'd like to move e.g. StackPanel -->
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)"
From="0" To="360" Duration="0:0:5"
RepeatBehavior="Forever" />
</Storyboard>
</phone:PhoneApplicationPage.Resources>
Also you need to set CompositeTransform for the object that you want to transform.
<StackPanel x:Name="myTransformPanel" >
<StackPanel.RenderTransform>
<CompositeTransform></CompositeTransform>
</StackPanel.RenderTransform>
</Stackanel>
My client has this requirement :
i.e. a grid with collapsible columns. The easiest way I found to do that is to have 3 separate datagrids and 2 buttons, showing or collapsing the grids.
Here is the associated XAML:
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="0" VerticalAlignment="Stretch">
<toolkit:DataGridDragDropTarget VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch">
<sdk:DataGrid Name="Grid1" SelectionChanged="Grid_SelectionChanged" AutoGenerateColumns="False">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Binding="{Binding somefield}" Header="someheader" />
<sdk:DataGridTextColumn Binding="{Binding somefield}" Header="someheader" />
<sdk:DataGridTextColumn Binding="{Binding somefield}" Header="someheader"/>
<sdk:DataGridTextColumn Binding="{Binding somefield}" Header="someheader" />
</sdk:DataGrid.Columns>
</sdk:DataGrid>
</toolkit:DataGridDragDropTarget>
<Button Content=">" Click="Button_Click" Name="btn1" />
<sdk:DataGrid Name="Grid2" SelectionChanged="Grid_SelectionChanged" AutoGenerateColumns="False" ItemsSource="{Binding ItemsSource, ElementName=Grid1}">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Header="someheader" Binding="{Binding somefield}" />
<sdk:DataGridCheckBoxColumn Header="someheader" Binding="{Binding somefield}" />
<sdk:DataGridCheckBoxColumn Header="someheader" Binding="{Binding somefield}" />
<sdk:DataGridTextColumn Header="someheader" Binding="{Binding somefield}" />
<sdk:DataGridTextColumn Header="someheader" Binding="{Binding somefield}" />
</sdk:DataGrid.Columns>
</sdk:DataGrid>
<Button Content=">" Name="btn2" Click="Button_Click"/>
<sdk:DataGrid Name="Grid3" SelectionChanged="Grid_SelectionChanged" AutoGenerateColumns="False" ItemsSource="{Binding ItemsSource, ElementName=Grid1}">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Header="someheader" Binding="{Binding somefield}" />
</sdk:DataGrid.Columns>
</sdk:DataGrid>
</StackPanel>
This is working correctly. My problem occurs when I want to sort one of the grid. As the sorting is internal to the datagrid, the changes are not propagated to the other (even tough they are bound to the same source !).
Is there a way to "propagate" the sorting to the other grids ? I tried to find a way to intercept a sorting event, but it doesn't seem to exist...
Thanks in advance !
Why use 3 database?
It's better to use just 1 database and a Options page where the person can hide his / her columns.
you can hide to columns by using DataGrid.Columns[0].Visibility = Visibility.Collapsed.
You can do this with a button above the column.. or a checkbox somewhere... or a options page. Lots of oppertunaties. The only downside is that this can't be implemented in MVVM since DataGridColumn dont support Visibility Binding.
As a answer to your question:
Perhaps this information helps you, just apply sorting to both datagrids
private void Sort_DataGrid(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
// Never use Queries like this always use Stored procedures
SqlCommand myCommand = new SqlCommand("SELECT * FROM Categories", myConnection);
myCommand.CommandType = CommandType.Text;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds,"Categories");
DataView dv = new DataView(ds.Tables["Categories"]);
if( (numberDiv%2) == 0 )
dv.Sort = e.SortExpression + " " + "ASC";
else
dv.Sort = e.SortExpression + " " + "DESC";
numberDiv++;
myDataGrid.DataSource = dv;
myDataGrid.DataBind();
}
Source: http://www.codeproject.com/KB/webforms/SortingDataGridColumns.aspx
If you stick to the three DataGrid solution I think you'd better wrap them in a control and add some sort buttons to this control. The buttons should then trigger the sorting of ALL datagrids.
Another way is to use 1 DataGrid and change the visibilty of the column(s) you would want to hide.