Telerik RadGridView keeping selected rows when we switch page by DataPager - telerik

If I go from one page RadGridView to the next (by DataPager) I lose the row selection from the previous page.
This is why if I come back, previously selected items will not be selected anymore.
How can I keep selected rows in RadDataGrid?
Code:
<telerik:RadGridView Margin="5" Grid.Row="2"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
Name="DataGrid"
AutoGenerateColumns="False"
ShowGroupPanel="False"
CanUserDeleteRows="False"
CanUserInsertRows="False"
CanUserFreezeColumns="False"
telerik:StyleManager.Theme="Windows8"
SelectionMode="Extended"
ValidatesOnDataErrors="None"
IsReadOnly="True"
ItemsSource="{Binding View}"
IsBusy="{Binding View.IsBusy}"
RowIndicatorVisibility="Collapsed"
IsSynchronizedWithCurrentItem="False"
FilterOperatorsLoading="DataGrid_FilterOperatorsLoading">
<i:Interaction.Behaviors>
<behaviors:MultiSelectBehavior SelectedItems="{Binding SelectedItems}" />
</i:Interaction.Behaviors>
<telerik:RadGridView.Columns>
<telerik:GridViewSelectColumn/>
<telerik:GridViewDataColumn Header="Производитель" DataMemberBinding="{Binding MakerName}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Номер" DataMemberBinding="{Binding Number}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Наименование" DataMemberBinding="{Binding Name}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Товарная группа" DataMemberBinding="{Binding GroupName}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Вес" DataMemberBinding="{Binding WeightPhysical}" ShowDistinctFilters="False"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<telerik:RadDataPager Height="28" Grid.Row="3"
NumericButtonCount="20"
Margin="5"
Name="DataPager"
Source="{Binding View}"
telerik:StyleManager.Theme="Windows8"
DisplayMode="All"
Style="{StaticResource RadDataPagerStyle}"
AutoEllipsisMode="None"/>

Related

Silverlight image bind with .png not work

I was careful to check this in the forums, but I did not find a solution.
This works perfect:
<Image Margin="0,0,0,0" Stretch="UniformToFill" Source="http://localhost:5313/Images/1.png" MaxHeight="140" MinHeight="155" VerticalAlignment="Top"/>
Why does this not work:
<Image Margin="0,0,0,0" Stretch="UniformToFill" Source="{Binding ImagenSeleccionada}" MaxHeight="140" MinHeight="155" VerticalAlignment="Top"/>
The code behind.
private string _imagenSeleccionada;
public string ImagenSeleccionada
{
get
{
return this._imagenSeleccionada;
}
set
{
if (this._imagenSeleccionada == value)
return;
this._imagenSeleccionada = value;
}
}
Main Page
The Control
ItemsSource="{Binding FilteredTemperatureReports}" UseLayoutRounding="False"
RowHeight="20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Single"
HorizontalGridLinesBrush="Transparent" VerticalGridLinesBrush="Transparent"
Background="{x:Null}" BorderBrush="{x:Null}"
IsFilteringAllowed="False" RowIndicatorVisibility="Collapsed"
CanUserFreezeColumns="False" ShowGroupPanel="False"
HeaderRowStyle="{StaticResource GridViewHeaderRowStyle}"
GroupRowStyle="{StaticResource GridViewGroupRowStyle}"
RowStyle="{StaticResource GridViewRowStyle}">
<telerik:GridViewDataColumn Width="150" DataMemberBinding="{Binding Medio}" IsReadOnly="True" Header="Medio"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyleFirst}"
CellStyle="{StaticResource GridViewCellStyle}" />
<telerik:GridViewDataColumn Width="80" DataMemberBinding="{Binding TimeStamp}" IsReadOnly="True" Header="Fecha" DataFormatString="{} {0:dd/MM/yyyy}"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="200" DataMemberBinding="{Binding Producto}" IsReadOnly="True" Header="Producto"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="180" DataMemberBinding="{Binding Version}" IsReadOnly="True" Header="Version"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="80" DataMemberBinding="{Binding Inversion}" IsReadOnly="True" Header="Inversion" DataFormatString="{}{0:C}"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewDataColumn Width="80" DataMemberBinding="{Binding Ytd}" IsReadOnly="True" Header="YTD" DataFormatString="{}{0:C}"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}"/>
<telerik:GridViewColumn Width="80" IsReadOnly="True" Header="Product"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
CellStyle="{StaticResource GridViewCellStyle}" >
The Code Behin the Grid.
void OnGridViewSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
{
var grid = sender as RadGridView;
if (grid.SelectedItem != null)
{
grid.ScrollIntoView(grid.SelectedItem);
var _internetDataViewModel = this.DataContext as InternetDataViewModel;
_internetDataViewModel.ImagenSeleccionada = ((ExecutiveDashboard.TemperatureData)(grid.SelectedItem)).Image;
}
}
What is not ok?
Thnaks
The {Binding} does not automatically know where to locate ImagenSeleccionada.
You need to either link it to a specific element, typically your named user control:
<UserControl x:Name="ThisCtrl" .... >
<Image Source="{Binding ImagenSeleccionada, ElementName=ThisCtrl}" ... />
or explicitly set the DataContext of your user control to itself; the DataContext will then propagate down to the user control children:
<UserControl DataContext="{Binding RelativeSource={RelativeSource Self}}" ... >
<Image Source="{Binding ImagenSeleccionada}" ... />
(alternatively you can set the DataContext to this in the code-behind constructor,)
or you can set the relative source of your image binding to the ancestor that is the user control, preferably via its type:
<UserControl ...>
<Image Source="{Binding ImagenSeleccionada,
RelativeSource={RelativeSource AncestorType=local:YourUserControlType}}" ... />

scrollviewer not working

y my scrollviewer not scrolling till the end.it gets struck to a limited position.
i hav attached my xaml code.i placed a canvas inside the code.and the scrollviewer is inside 2 grids.
<ScrollViewer>
<Canvas Margin="0,0,0,0">
<toolkit:ListPicker x:Name="listPicker" ItemTemplate="{StaticResource PickerItemTemplate}"
FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" CacheMode="BitmapCache"
Header="" Margin="12,246,210,298" FontFamily="Yu Gothic" FontSize="22" FontWeight="SemiBold" Width="240" />
<toolkit:ListPicker x:Name="listPicker2" ItemTemplate="{StaticResource PickerItemTemplate}" ItemCountThreshold="3"
FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" CacheMode="BitmapCache"
Header="" Margin="9,343,210,206" Width="240" />
<toolkit:ListPicker CacheMode="BitmapCache" FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" Header="" ItemCountThreshold="3" ItemTemplate="{StaticResource PickerItemTemplate}" Margin="12,440,210,108" Name="listPicker1" Width="240" />
<toolkit:ListPicker CacheMode="BitmapCache" FullModeItemTemplate="{StaticResource PickerFullModeItemTemplate}" Header="" ItemCountThreshold="3" ItemTemplate="{StaticResource PickerItemTemplate}" Margin="11,546,210,2" Name="listPicker3" Width="240" />
<TextBlock Height="40" HorizontalAlignment="Left" Margin="30,212,0,0" Name="textBlock1" Text="MONTHLY DEBTS" VerticalAlignment="Top" Width="185" FontSize="24" />
<TextBlock Height="40" HorizontalAlignment="Left" Margin="290,212,0,0" Name="textBlock2" Text="AMOUNTS" VerticalAlignment="Top" Width="147" FontSize="24" />
<clrtb:ClearableTextBox Canvas.Left="246" Canvas.Top="242" Height="75" Name="qualifytb" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="242" Canvas.Top="338" Height="75" Name="clearableTextBox1" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="246" Canvas.Top="436" Height="75" Name="clearableTextBox2" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="244" Canvas.Top="542" Height="75" Name="clearableTextBox3" Width="208" />
<TextBlock Text="DEBT RATIO" Canvas.Left="148" Canvas.Top="642" FontSize="26" FontWeight="Medium" />
<TextBlock Text="Conv Debt Ratio:" Canvas.Left="30" Canvas.Top="700" FontSize="26" FontWeight="Medium" />
<TextBlock Text="FHA Debt Ratio:" Canvas.Left="30" Canvas.Top="800" FontSize="26" FontWeight="Medium" />
<TextBlock Text="VA Debt Ratio:" Canvas.Left="30" Canvas.Top="900" FontSize="26" FontWeight="Medium" />
<clrtb:ClearableTextBox Canvas.Left="250" Canvas.Top="700" Height="75" Name="rt1" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="320" Canvas.Top="700" Height="75" Name="rt2" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="250" Canvas.Top="800" Height="75" Name="rt3" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="320" Canvas.Top="800" Height="75" Name="rt4" Width="208" />
<clrtb:ClearableTextBox Canvas.Left="250" Canvas.Top="900" Height="75" Name="rt5" Width="208" />
</Canvas>
</ScrollViewer>
I found this SO question: ScrollBars are not visible after changing positions of controls inside a Canvas, which is basically a similar problem. The question is WPF-specific but can be applied to WP/Silverlight just as well.
The problem is Canvas will always return a DesiredSize of (0, 0), so the ScrollViewer will never think it needs to scroll.
The solution is simple: just use a StackPanel or Grid instead of the Canvas. If you really need the Canvas, you have to override MeasureOverride.
Canvas is not the right layout panel to be using, it's going to produce weird behavior the way you're using it. It's meant to be used when you need finite control over positioning and you are willing to write significant logic to support edge cases that pop up. Try using Grid, and configure it with columns and rows.

Why can't I scroll all the way to the bottom when onscreen keyboard is active

I have a bunch of controls in a collection of stackpanels that is contained in a grid. The grid is pretty long and runs off the page so I have put it in to a scrollviewer. Everything works perfectly and I can scroll up and down my page until the keyboard is active. Once that happens, I am not able to scroll the content all the way to the bottom when a textbox is highlighted. I can scroll to a certain extent but not all the way down. Am I doing something wrong? My code is as follows:
<ScrollViewer Margin="12,0,12,0" Grid.Row="1">
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Height="837" Width="456">
<StackPanel HorizontalAlignment="Left" Width="450" Margin="0,63,0,405">
<TextBlock Height="30" Name="tBlk_Username" Text="Display Name" />
<TextBox Height="71" Name="tb_UserNameVal" Text="{Binding UserNameValue, Mode=TwoWay}" Width="452" />
<TextBlock Height="30" Name="tBlk_Email" Text="Email" />
<TextBox Height="71" Name="tb_EmailVal" Text="{Binding EmailValue, Mode=TwoWay}" Width="452" />
<TextBlock Height="30" Name="tBlk_Message" Text="Message" />
<TextBox Height="130" Name="tb_MessageVal" Text="{Binding MessageValue, Mode=TwoWay}" Width="452" />
</StackPanel>
<StackPanel Height="37" HorizontalAlignment="Left" Margin="0,519,0,0" Name="stackPanel2"
VerticalAlignment="Top" Width="450">
<TextBlock Height="30" Name="tBlk_PicInfo" Text="Include a Photo" />
</StackPanel>
<StackPanel Orientation="Horizontal" Height="90" HorizontalAlignment="Left" Margin="12,432,0,0"
Name="stackPanel1" VerticalAlignment="Top" Width="450" d:LayoutOverrides="GridBox">
<TextBox Height="71" Name="tb_Location" Text="{Binding Location}" Width="367" IsReadOnly="True" />
<Button Height="60" Name="btn_Clear" Width="60" BorderThickness="0" Background="{Binding LocationImage}" Style="{StaticResource LocationButtonStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<GalaSoft_MvvmLight_Command:EventToCommand x:Name="ClearCommand" Command="{Binding ClearCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="205" HorizontalAlignment="Left" Margin="12,556,0,0"
Name="stackPanel3" VerticalAlignment="Top" Width="452" d:LayoutOverrides="GridBox">
<Image Name="img_FlickrPic" Stretch="Fill" Width="260" Source="{Binding Capture}" Margin="0,13,0,0" />
<Button Name="btn_Capture" Width="90" Height="90" Margin="0,67,0,55" BorderThickness="0">
<Button.Background>
<ImageBrush ImageSource="/Images/camera.png" />
</Button.Background>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<GalaSoft_MvvmLight_Command:EventToCommand x:Name="CaptureClick" Command="{Binding CaptureCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="100" HorizontalAlignment="Left"
Margin="4,763,0,0" Name="stackPanel4" VerticalAlignment="Top" Width="450" d:LayoutOverrides="GridBox">
<Button Content="Submit" Height="71" Name="btn_Submit" Width="130" IsEnabled="{Binding SubmitEnabled}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<GalaSoft_MvvmLight_Command:EventToCommand x:Name="SubmitCommand" Command="{Binding SubmitCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
<StackPanel Height="59" HorizontalAlignment="Left" Name="stackPanel5" VerticalAlignment="Top" Width="456" Orientation="Horizontal">
<TextBlock FontFamily="{StaticResource HelveticaNeue}" Name="tBlk_StepConf" Text="Please share my " Width="150" TextAlignment="Center" Height="33" />
<TextBlock FontFamily="{StaticResource HelveticaNeue}" Foreground="#FF00BCE4" Name="tBlk_StepConfCount" Text="{Binding StepVal}" Width="56" FontSize="34" TextAlignment="Center" VerticalAlignment="Top" />
<TextBlock FontFamily="{StaticResource HelveticaNeue}" Name="tBlk_StepConfTrail" Text=" steps for water" Width="134" TextAlignment="Center" Height="40" />
</StackPanel>
</Grid>
</ScrollViewer>
The problem is that the ScrollViewer doesn't pay attention to the Soft Input Panel (or keyboard), so it only scrolls as long as it can behind the keyboard so to speak.
A simple solution is to add a margin to the bottom of the content control of the ScrollViewer.
The longer and more complicated solution is to add the margin when the SIP is displayed. Unfortunately there's no event for it, but I guess one could listen to when a textbox gains or loses focus, and set a margin or perhaps show a control at the bottom of the page when a textbox has focus (and hence the SIP is displayed) and hide it when it doesn't.

WPF 4.0 AutoCompleteBox TwoWay Binding

I have a WPF window that has several Listbox and DataGrid controls. The main Listbox displays a list of Contractors. An Address(s) datagrid is bound to the Contractor ListBox and displays address(s) for the current selected Contractor.
I want users of this Window(WPF) to be able to add Addresses to the selected Contractor using the native Datagrid Add functionality. I also want the users to be able to edit associated Address records by clicking in the datagrid cell and having the cell function as an AutoCompleteBox.
I have partially successfully implemented the AutoCompleteBox in the State column of the datagrid control. Currently, the correct Text value for the current Contractor is displayed in the State column of the Address datagrid. If i edit the State cell I get expected autocomplete functionality and I can select a new State.
What is not working is the TwoWay binding. Currently, if I change the current Address state it does not save back to the entity model or the db. Its not surprising since I know I dont have Twoway binding implemented correctly on this control.
I have successfully implemented the Twoway binding with a combobox but the combobox obviously does not provide the autocomplete functionality I need.
Update
We worked on this late yesterday and arrive at a partial solution. Now we have a new issue.
With a ComboBox you can have:
DisplayMemberPath ="StateAbbrv"
SelectedValue="{Binding Path=tbl_Address.StateID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" and
SelectedValuePath="StateID".
With the AutoCompleteBox it seems you really only have:
ValueMemberPath="StateID" and
Text="{Binding Path=tbl_Address.StateID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource StateConverter}}" Grid.Column="1" Grid.Row="1" Margin="0,0,0,0" >
With the AutoCompleteBox you can’t have separate display and selected values. Because of my Window control binding and database structure I need to display a string value such as “CA California” while actually having a selected table key integer value in the background.
To be clear, we need to have separate Display and Selected values in the Text part of the AutoCompleteBox control.
Here is the Master ListBox displaying Contractors:
<Grid DataContext="{StaticResource tbl_PartnerViewSource}" HorizontalAlignment="Left" Name="grid3" VerticalAlignment="Top" Height="242" Width="295" Grid.Column="1" Margin="0,1,0,0" Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="31*" />
<RowDefinition Height="211*" />
</Grid.RowDefinitions>
<Label Content="Contractor List" FontWeight="Bold" Height="25" Margin="0,0,169,0" Name="label10" Padding="3" VerticalAlignment="Top" />
<ListBox DisplayMemberPath="tbl_Organization.OrgName" Height="212" HorizontalAlignment="Right" ItemsSource="{Binding}" Margin="0,30,0,0" Name="orgNameListBox" SelectedValuePath="PtnrID" VerticalAlignment="Center" Width="294" IsSynchronizedWithCurrentItem="True" Grid.RowSpan="2" SelectionChanged="orgNameListBox_SelectionChanged" TabIndex="11" MouseDoubleClick="orgNameListBox_MouseDoubleClick" DataContextChanged="orgNameListBox_DataContextChanged" SourceUpdated="orgNameListBox_SourceUpdated" IsManipulationEnabled="True" />
</Grid>
Here is the Stack Panel containing the Datacontext supporting the controls in discussion:
<StackPanel Grid.Row="3" Height="243" HorizontalAlignment="Left" Name="stackPanel5" VerticalAlignment="Top" Width="295" Grid.Column="1"></StackPanel>
<Label Content="Address(s)" FontWeight="Bold" Height="25" HorizontalAlignment="Left" Margin="306,0,0,0" Name="label1" Padding="3" VerticalAlignment="Top" Width="648" Grid.Column="1" Grid.Row="1" />
<DataGrid Name="dataGridAddress" DataContext="{StaticResource tbl_Partnertbl_PartnerAddressViewSource}" ItemsSource="{Binding}" SelectionMode="Single" SelectionUnit="CellOrRowHeader" AutoGenerateColumns="False" AlternatingRowBackground="#FFFF003B" AlternationCount="2" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Margin="308,22,0,0" Width="649" Height="113" VerticalAlignment="Top" CanUserDeleteRows="True" CanUserAddRows="True">
<DataGrid.Columns>...
Here is the AutoCompleteBox that is partially working:
<DataGridTemplateColumn x:Name="addState" Header="State" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<my1:AutoCompleteBox Name="autoCompleteBox1"
IsTextCompletionEnabled="True"
ItemsSource="{Binding Source={StaticResource tbl_StateViewSource}}"
ValueMemberPath="StateID"
Text="{Binding Path=tbl_Address.StateID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="1" Margin="0,0,0,0" >
<my1:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=StateAbbrv}" Width="30" FontWeight="Bold" Margin="0,0,0,0" />
<TextBlock Text="{Binding Path=StateName}" />
</StackPanel>
</DataTemplate>
</my1:AutoCompleteBox.ItemTemplate>
</my1:AutoCompleteBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
Here is the Combobox with working TwoWay binding:
<GridViewColumn x:Name="addrState" Header="State" Width="75">
<GridViewColumn.CellTemplate>
<DataTemplate>
<ComboBox Name="comboAddressState" SelectedValue="{Binding Path=tbl_Address.StateID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="{StaticResource Margin2}" DisplayMemberPath="StateAbbrv" SelectedValuePath="StateID" ItemsSource="{Binding Source={StaticResource tbl_StateViewSource}}" IsSynchronizedWithCurrentItem="False" IsEnabled="True" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
Here is the Windows.Resource Section:
<Window.Resources>
<CollectionViewSource x:Key="tbl_PartnerViewSource" d:DesignSource="{d:DesignInstance my:tbl_Partner, CreateList=True}"></CollectionViewSource>
<CollectionViewSource x:Key="tbl_Partnertbl_PartnerAddressViewSource" Source="{Binding Path=tbl_PartnerAddress, Source={StaticResource tbl_PartnerViewSource}}" />
<CollectionViewSource x:Key="tbl_Partnertbl_PartnerContactViewSource" Source="{Binding Path=tbl_PartnerContact, Source={StaticResource tbl_PartnerViewSource}}" />
<CollectionViewSource x:Key="tbl_Partnertbl_PartnerContacttbl_PartnerContactCommChanAddrViewSource" Source="{Binding Path=tbl_PartnerContactCommChanAddr, Source={StaticResource tbl_Partnertbl_PartnerContactViewSource}}" />
<CollectionViewSource x:Key="tbl_Partnertbl_PartnerSystemViewSource" Source="{Binding Path=tbl_PartnerSystem, Source={StaticResource tbl_PartnerViewSource}}" />
<CollectionViewSource x:Key="tbl_Partnertbl_PartnerAliasViewSource" Source="{Binding Path=tbl_PartnerAlias, Source={StaticResource tbl_PartnerViewSource}}" />
<CollectionViewSource x:Key="tbl_Partnertbl_PartnerCommentViewSource" Source="{Binding Path=tbl_PartnerComment, Source={StaticResource tbl_PartnerViewSource}}" />
<CollectionViewSource x:Key="tbl_ServicedCustomerViewSource" d:DesignSource="{d:DesignInstance my:tbl_ServicedCustomer, CreateList=True}" />
<CollectionViewSource x:Key="tbl_SystemViewSource" d:DesignSource="{d:DesignInstance my:tbl_System, CreateList=True}" />
<CollectionViewSource x:Key="tbl_PlatformViewSource" d:DesignSource="{d:DesignInstance my:tbl_Platform, CreateList=True}" />
<CollectionViewSource x:Key="tbl_ManufacturerViewSource" d:DesignSource="{d:DesignInstance my:tbl_Manufacturer, CreateList=True}" />
<CollectionViewSource x:Key="tbl_StateViewSource" d:DesignSource="{d:DesignInstance my:tbl_State, CreateList=True}" />
<CollectionViewSource x:Key="tbl_ZIPViewSource" d:DesignSource="{d:DesignInstance my:tbl_ZIP, CreateList=True}" />
<CollectionViewSource x:Key="tbl_CityViewSource" d:DesignSource="{d:DesignInstance my:tbl_City, CreateList=True}" />
<Thickness x:Key="Margin1">8,-3,-7,-3</Thickness>
<Thickness x:Key="Margin2">-7,-3,-7,-3</Thickness>
</Window.Resources>
Here is a image of the Window(WPF):

Why i can't see the button in my windows phone 7 App?

like in title:)
I wrote from tutorial: http://msdn.microsoft.com/en-us/wp7trainingcourse_yourfirstwp7applab_topic3
does everything like there.
my code:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="120"/> <!-- Problem resolved -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- this i can not see any ideas what is wrong? -->
<StackPanel Orientation="Vertical" VerticalAlignment="Stretch">
<Button x:Name = "SolveButton" Content="Solve" Margin="10"
HorizontalAlignment="Center" Click="SolveButton_Click" />
<StackPanel x:Name="StatusPanel" Orientation="Horizontal"
HorizontalAlignment="Center" Visibility="Collapsed">
<TextBlock HorizontalAlignment="Center" Text="Your Moves: " TextWrapping="Wrap"
Foreground="#FFD0D0D0" FontSize="17.333"/>
<TextBlock x:Name="TotalMovesTextBlock" HorizontalAlignment="Center" Text="N"
TextWrapping="Wrap" Foreground="#FFFFB000" FontSize="17.333"/>
</StackPanel>
</StackPanel>
<!-- Here i can see anything under this comment -->
<StackPanel Orientation="Vertical" VerticalAlignment="Top" Grid.Row="1">
<Border x:Name="CongratsBorder" Height="30" Background="#FFF10DA2"
HorizontalAlignment="Center"
Width="443" RenderTransformOrigin="0.5,0.5"
UseLayoutRounding="False" Opacity="0">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Border.RenderTransform>
<TextBlock HorizontalAlignment="Center" Text="CONGRATULATIONS!" TextWrapping="Wrap"
Foreground="White" FontSize="17.333" VerticalAlignment="Center"
FontWeight="Bold"/>
</Border>
<Border x:Name="border" BorderThickness="3" Background="#FF262626"
HorizontalAlignment="Center" VerticalAlignment="Center" Padding="1"
RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Border.RenderTransform>
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" >
<GradientStop Color="#FFF10DA2" Offset="0" />
<GradientStop Color="#FFEE7923" Offset="1" />
</LinearGradientBrush>
</Border.BorderBrush>
<Canvas Height="435" Width="435">
<Image x:Name="PreviewImage" Height="435" Width="435" Opacity="0.2" />
<Canvas x:Name="GameContainer" Height="435" Width="435" />
</Canvas>
</Border>
<TextBlock x:Name="TapToContinueTextBlock" HorizontalAlignment="Center"
Text="Tap the picture to start the puzzle"
TextWrapping="Wrap" Foreground="#FFD0D0D0" FontSize="17.333" />
</StackPanel>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION"
Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0"
Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"></Grid>
</Grid>
<!--Sample code showing usage of ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>-->
You've got a Grid
And you've got multiple things in the first row of that Grid - so they are being drawn on top of each other.
Try putting things into different Grid Rows
Or Try replacing your outermost Grid by a StackPanel instead?
Also <RowDefinition Height="0.2"/> seems quite small for a height - try using Height="Auto"
Your first stackpanel doesn't have a Grid.Row setting. It's probably behind the TitlePanel in Row 0.

Resources