how Can i create Xam grid dynamically?
vikas227,
Begin by adding references to the following assemblies
InfragisticsWPF3.v10.3InfragisticsWPF3.Editors.v10.3InfragisticsWPF3.DataPresenter.v10.3
Or another version of the same assemblies.
Once that is done, add a using (C#) or Imports (VB) statement for the Infragistics.Windows.DataPresenter namespace:
using Infragistics.Windows.DataPresenter;
Imports Infragistics.Windows.DataPresenter
Then simply create an instance of the XamDataGrid and make it the child of a Panel or Window:
C#:
Window w = new Window();w.Title = "Dynamically Created Window With XamDataGrid";
XamDataGrid xdg = new XamDataGrid();xdg.DataSource = GetData(); // Where GetData returns an IEnumerablew.Content = xdg;w.Show();
VB:
Dim w as Window new Window()w.Title = "Dynamically Created Window With XamDataGrid"
Dim xdg as XamDataGrid new XamDataGrid()xdg.DataSource = GetData() ' Where GetData returns an IEnumerablew.Content = xdgw.Show()
Let me know if you have any questions with this matter.
How can i create Field layouts dynamically and set others setting like margin,width etc?
Rather than using List, use List<ReportCountry> and you will see the columns when you bind the grid to an empty list.
//****************Xaml Code*************************** //*************Source Code********************************* DataTable dt = new DataTable(); dt = _objDataProvider.ReportsData(ReturnConnectionString); for (Int32 i = 0; i < dt.Rows.Count; i++) { Int32 id = Convert.ToInt32(dt.Rows[i]["id"].ToString()); string visit = dt.Rows[i]["Visits"].ToString(); string visitors = dt.Rows[i]["Visitors"].ToString(); DateTime reportDate = Convert.ToDateTime(dt.Rows[i]["ReportDate"].ToString()); CreateDynamicWPFGridOld(id, visit, visitors, reportDate); Tile addTile = new Tile { Header = reportDate, Content = MainGrid }; this.xamTilesControl1.Items.Add(addTile); } private void CreateDynamicWPFGridOld(Int32 id, string visits, string visitors, DateTime reportDate) { // Create the Grid MainGrid = new Grid(); MainGrid.Width =600; MainGrid.HorizontalAlignment = HorizontalAlignment.Left; MainGrid.VerticalAlignment = VerticalAlignment.Top; MainGrid.ShowGridLines = false; ColumnDefinition maingridCol1 = new ColumnDefinition(); ColumnDefinition maingridCol2 = new ColumnDefinition(); MainGrid.ColumnDefinitions.Add(maingridCol1); MainGrid.ColumnDefinitions.Add(maingridCol2); maingridCol1.Width = new GridLength(10); RowDefinition maingridRow1 = new RowDefinition(); maingridRow1.Height = new GridLength(120); RowDefinition maingridRow2 = new RowDefinition(); MainGrid.RowDefinitions.Add(maingridRow1); MainGrid.RowDefinitions.Add(maingridRow2); /////////////////Create Dynamic Grid//////////////////////////////////////////////////// Grid DynamicGrid = new Grid(); DynamicGrid.Width = 100; DynamicGrid.HorizontalAlignment = HorizontalAlignment.Left; DynamicGrid.VerticalAlignment = VerticalAlignment.Top; DynamicGrid.ShowGridLines = false; Grid.SetRow(DynamicGrid, 0); Grid.SetColumn(DynamicGrid, 1); MainGrid.Children.Add(DynamicGrid); // Create Columns ColumnDefinition DynamicGridgridCol1 = new ColumnDefinition(); ColumnDefinition DynamicGridgridCol2 = new ColumnDefinition(); DynamicGrid.ColumnDefinitions.Add(DynamicGridgridCol1); DynamicGrid.ColumnDefinitions.Add(DynamicGridgridCol2); // Create Rows RowDefinition DynamicGridgridRow1 = new RowDefinition(); DynamicGridgridRow1.Height = new GridLength(45); RowDefinition DynamicGridgridRow2 = new RowDefinition(); DynamicGridgridRow2.Height = new GridLength(25); RowDefinition DynamicGridgridRow3 = new RowDefinition(); DynamicGridgridRow3.Height = new GridLength(25); DynamicGrid.RowDefinitions.Add(DynamicGridgridRow1); DynamicGrid.RowDefinitions.Add(DynamicGridgridRow2); DynamicGrid.RowDefinitions.Add(DynamicGridgridRow3); // Add first column header TextBlock DynamicGridtxtBlock1 = new TextBlock(); DynamicGridtxtBlock1.Text = Convert.ToString(id); DynamicGridtxtBlock1.FontSize = 14; DynamicGridtxtBlock1.FontWeight = FontWeights.Bold; DynamicGridtxtBlock1.VerticalAlignment = VerticalAlignment.Top; Grid.SetRow(DynamicGridtxtBlock1, 0); Grid.SetColumn(DynamicGridtxtBlock1, 0); // Add second column header TextBlock DynamicGridtxtBlock2 = new TextBlock(); DynamicGridtxtBlock2.Text = ""; DynamicGridtxtBlock2.FontSize = 14; DynamicGridtxtBlock2.FontWeight = FontWeights.Bold; DynamicGridtxtBlock2.Foreground = new SolidColorBrush(Colors.Green); DynamicGridtxtBlock2.VerticalAlignment = VerticalAlignment.Top; Grid.SetRow(DynamicGridtxtBlock2, 0); Grid.SetColumn(DynamicGridtxtBlock2, 1); //// Add column headers to the Grid DynamicGrid.Children.Add(DynamicGridtxtBlock1); DynamicGrid.Children.Add(DynamicGridtxtBlock2); // Create first Row TextBlock DynamicGridauthorText = new TextBlock(); DynamicGridauthorText.Text = "Visits:"; DynamicGridauthorText.FontSize = 12; DynamicGridauthorText.FontWeight = FontWeights.Bold; Grid.SetRow(DynamicGridauthorText, 1); Grid.SetColumn(DynamicGridauthorText, 0); TextBlock DynamicGridageText = new TextBlock(); DynamicGridageText.Text = visits; DynamicGridageText.FontSize = 12; DynamicGridageText.FontWeight = FontWeights.Bold; Grid.SetRow(DynamicGridageText, 1); Grid.SetColumn(DynamicGridageText, 1); // Add first row to Grid DynamicGrid.Children.Add(DynamicGridauthorText); DynamicGrid.Children.Add(DynamicGridageText); // Create second row TextBlock DynamicGridVisitorText = new TextBlock(); DynamicGridVisitorText.Text = "Visitors:"; DynamicGridVisitorText.FontSize = 12; DynamicGridVisitorText.FontWeight = FontWeights.Bold; Grid.SetRow(DynamicGridVisitorText, 2); Grid.SetColumn(DynamicGridVisitorText, 0); TextBlock DynamicGridVisitorsText = new TextBlock(); DynamicGridVisitorsText.Text = visitors; DynamicGridVisitorsText.FontSize = 12; DynamicGridVisitorsText.FontWeight = FontWeights.Bold; Grid.SetRow(DynamicGridVisitorsText, 2); Grid.SetColumn(DynamicGridVisitorsText, 1); // Add second row to Grid DynamicGrid.Children.Add(DynamicGridVisitorText); DynamicGrid.Children.Add(DynamicGridVisitorsText); XamDataGrid xdg = new XamDataGrid(); xdg.Width = 500; xdg.HorizontalAlignment = HorizontalAlignment.Left; xdg.VerticalAlignment = VerticalAlignment.Top; xdg.GroupByArea.Visibility = System.Windows.Visibility.Hidden; Grid.SetRow(xdg, 1); Grid.SetColumn(xdg, 1); MainGrid.Children.Add(xdg); xdg.FieldLayoutSettings.AutoFitMode = AutoFitMode.ExtendLastField; FieldLayout fl = new FieldLayout(); fl.Fields.Add(new Field() { Name = "code" }); fl.Fields.Add(new Field() { Name = "visitNumber" }); fl.Fields.Add(new Field() { Name = "visitorNumber" }); xdg.FieldLayouts.Add(fl); List list = new List(); list = _objDataProvider.GetCountryReport(reportDate, ReturnConnectionString); xdg.DataSource = list; } public List GetCountryReport(DateTime date, string ReturnConnectionString) { List obj = new List(); DataTable dt = new DataTable(); SqlConnection Con; Con = new SqlConnection(ReturnConnectionString); if (Con.State == ConnectionState.Closed) { Con.Open(); } SqlDataAdapter adp = new SqlDataAdapter("ReportsCountry", Con); adp.SelectCommand.CommandType = CommandType.StoredProcedure; adp.SelectCommand.Parameters.Add("@Date", SqlDbType.DateTime).Value = date; adp.Fill(dt); for (Int32 i = 0; i < dt.Rows.Count; i++) { ReportCountry country = new ReportCountry(); country.Code = dt.Rows[i]["code"].ToString(); country.Visits = Convert.ToInt32(dt.Rows[i]["visitNumber"].ToString()); country.Visitors = Convert.ToInt32(dt.Rows[i]["visitorNumber"].ToString()); obj.Add(country); } Con.Close(); adp.Dispose(); return obj; }
Do you have a question that you would like me to answer? If so, please provide me with the question and either code that I can run or formatted code so that it is easier to read.
Note that you can attach a code file from the options tab.
Were you able to resolve this or may I be of further assistance?
Hi..
my query not resolve yet....
where is option tab.so i can send code to you
Please let me know if I may be of further assistance on this.
Hello,
It will work if you also set the MaxHeight, MinHeight, MaxWidth, and MinWidth as well:
void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e){ if (e.HeightChanged) { this.xamTilesControl1.NormalModeSettings.TileConstraints.PreferredHeight = this.xamTilesControl1.NormalModeSettings.TileConstraints.MinHeight = this.xamTilesControl1.NormalModeSettings.TileConstraints.MaxHeight =this.xamTilesControl1.ActualHeight / 3 - 10; } if (e.WidthChanged) { this.xamTilesControl1.NormalModeSettings.TileConstraints.PreferredWidth = this.xamTilesControl1.NormalModeSettings.TileConstraints.MinWidth = this.xamTilesControl1.NormalModeSettings.TileConstraints.MaxWidth = this.xamTilesControl1.ActualWidth / 3; }}
i checked it,window event is firing.why it not working.please check the Xaml code i think i have to change some where in it..
igTiles:XamTilesControl.MaximizedModeSettings> <igTiles:MaximizedModeSettings VerticalTileAreaAlignment="Top"> <igTiles:MaximizedModeSettings.MinimizedExpandedTileConstraints> <igTiles:TileConstraints MinWidth="180" MaxHeight="60" MaxWidth="180" /> </igTiles:MaximizedModeSettings.MinimizedExpandedTileConstraints> <igTiles:MaximizedModeSettings.MinimizedTileConstraints> <igTiles:TileConstraints MinWidth="180" MaxHeight="60" MaxWidth="180"/> </igTiles:MaximizedModeSettings.MinimizedTileConstraints> </igTiles:MaximizedModeSettings> </igTiles:XamTilesControl.MaximizedModeSettings
When the code was added, did you also add the event handler. To verify that the event is wired up correctly place a break point in the event handler and see if it is hit when you resize the window. If the break point is not hit check to see that you have wired up the event either in XAML or in C# code.
i place that code void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e){ if (e.HeightChanged) { this.xamTilesControl1.NormalModeSettings.TileConstraints.PreferredHeight = this.xamTilesControl1.ActualHeight / 3-10; } if (e.WidthChanged) { this.xamTilesControl1.NormalModeSettings.TileConstraints.PreferredWidth = this.xamTilesControl1.ActualWidth / 3; }}
but there is no effect,Xam tiles still not customize according to screen please have a look on xaml Source code and tell me what change i have to do for it(customize according to screen)
<igTiles:XamTilesControl Name="xamTilesControl1" HeaderPath="ReportDate" Margin="10,0,0,12" InterTileSpacingX="5" InterTileSpacingY="5" Theme="LunaNormal"> <igTiles:XamTilesControl.NormalModeSettings> <igTiles:NormalModeSettings> <igTiles:NormalModeSettings.TileConstraints> <igTiles:TileConstraints MaxHeight="60" MaxWidth="180" /> </igTiles:NormalModeSettings.TileConstraints> </igTiles:NormalModeSettings> </igTiles:XamTilesControl.NormalModeSettings> <igTiles:XamTilesControl.MaximizedModeSettings> <igTiles:MaximizedModeSettings VerticalTileAreaAlignment="Top"> <igTiles:MaximizedModeSettings.MinimizedExpandedTileConstraints> <igTiles:TileConstraints MinWidth="180" MaxHeight="60" MaxWidth="180" /> </igTiles:MaximizedModeSettings.MinimizedExpandedTileConstraints> <igTiles:MaximizedModeSettings.MinimizedTileConstraints> <igTiles:TileConstraints MinWidth="180" MaxHeight="60" MaxWidth="180"/> </igTiles:MaximizedModeSettings.MinimizedTileConstraints> </igTiles:MaximizedModeSettings> </igTiles:XamTilesControl.MaximizedModeSettings> <igTiles:XamTilesControl.Resources> <BooleanToVisibilityConverter x:Key="BoolToVisConverter"/> <Style x:Key="CaptionButtonStyleBase" TargetType="{x:Type ButtonBase}"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#FFffffff"/> <GradientStop Offset="0.49" Color="#FFe2e2e2"/> <GradientStop Offset="0.5" Color="#FFcccccc"/> <GradientStop Offset="1" Color="#FFbbbbbb"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Foreground" Value="Black"/> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={x:Static RelativeSource.Self}}" Value="True"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#FF99ff99"/> <GradientStop Offset="0.49" Color="#FF00cc66"/> <GradientStop Offset="0.5" Color="#FF009933"/> <GradientStop Offset="1" Color="#FF003300"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Foreground" Value="White"/> </DataTrigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#FFff9999"/> <GradientStop Offset="0.49" Color="#FFcc6666"/> <GradientStop Offset="0.5" Color="#FF993333"/> <GradientStop Offset="1" Color="#FF990000"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Foreground" Value="White"/> </Trigger> <Trigger Property="IsEnabled" Value="False"/> </Style.Triggers> </Style> <Style x:Key="{x:Static igTiles:TileHeaderPresenter.MaximizeButtonStyleKey}" BasedOn="{StaticResource CaptionButtonStyleBase}" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <ControlTemplate.Resources> <Storyboard x:Key="BtnFadeIn"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MaximizeGlyph" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="RestoreGlyph" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Grid> <Path Width="75" Height="15" Cursor="Hand" Data="M -0.23,15 C-0.23,15 75,15 75,15 75,15 75,0 75,0 75,0 24.76,0 24.76,0 22.26,0 17.99,1.76 16.22,3.53 16.22,3.53 8.30,11.46 8.30,11.46 6.53,13.23 2.26,15 -0.23,15 z" Fill="{TemplateBinding Background}" SnapsToDevicePixels="True" Stretch="Fill"/> <Path x:Name="MaximizeGlyph" Width="8" Height="7" Margin="12,0,0,0" Data="M 1,3 C1,3 7,3 7,3 7,3 7,6 7,6 7,6 1,6 1,6 1,6 1,3 1,3 zM 0,1 C0,1 0,7 0,7 0,7 8,7 8,7 8,7 8,1 8,1 8,1 8,0.87 8,0.87 8,0.39 7.60,0 7.12,0 7.12,0 0.87,0 0.87,0 0.39,0 0,0.39 0,0.87 0,0.87 0,1 0,1 z" Fill="{TemplateBinding Foreground}" Opacity="0" SnapsToDevicePixels="True"/> <Path x:Name="RestoreGlyph" Width="8" Height="8" Margin="12,0,0,0" Data="M 1,5 C1,5 2,5 2,5 2,5 5,5 5,5 5,5 5,7 5,7 5,7 1,7 1,7 1,7 1,5 1,5 zM 6,4 C6,4 6,3.87 6,3.87 6,3.39 5.60,3 5.12,3 5.12,3 3,3 3,3 3,3 3,2 3,2 3,2 7,2 7,2 7,2 7,4 7,4 7,4 6,4 6,4 zM 0,4 C0,4 0,8 0,8 0,8 6,8 6,8 6,8 6,5 6,5 6,5 8,5 8,5 8,5 8,1 8,1 8,1 8,0.87 8,0.87 8,0.39 7.60,0 7.12,0 7.12,0 2.87,0 2.87,0 2.39,0 2,0.39 2,0.87 2,0.87 2,1 2,1 2,1 2,3 2,3 2,3 0.87,3 0.87,3 0.39,3 0,3.39 0,3.87 0,3.87 0,4 0,4 z" Fill="{TemplateBinding Foreground}" Opacity="0" SnapsToDevicePixels="True" Visibility="Collapsed"/> </Grid> <ControlTemplate.Triggers> <DataTrigger Binding="{Binding Path=Tag.State, RelativeSource={RelativeSource Self}}" Value="Maximized"> <Setter TargetName="RestoreGlyph" Property="Visibility" Value="Visible"/> <Setter TargetName="MaximizeGlyph" Property="Visibility" Value="Collapsed"/> </DataTrigger> <DataTrigger Binding="{Binding Path=Tile.IsMouseOver, RelativeSource={x:Static RelativeSource.TemplatedParent}}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard x:Name="BtnFadeIn_BeginStoryboard" Storyboard="{StaticResource BtnFadeIn}"/> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <StopStoryboard BeginStoryboardName="BtnFadeIn_BeginStoryboard"/> </DataTrigger.ExitActions> </DataTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type igTiles:TileHeaderPresenter}"> <Setter Property="Foreground" Value="White"/> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#FF0099cc"/> <GradientStop Offset="0.5" Color="#FF003399"/> <GradientStop Offset="0.50" Color="#FF000066"/> <GradientStop Offset="1" Color="#FF000099"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="BorderBrush"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#00ffffff"/> <GradientStop Offset="0.20" Color="#FFffffff"/> <GradientStop Offset="1" Color="#00ffffff"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Padding" Value="4,0,2,0"/> <Setter Property="BorderThickness" Value="0,1,0,0"/> <Setter Property="MinHeight" Value="25"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igTiles:TileHeaderPresenter}"> <ControlTemplate.Resources> <Storyboard x:Key="BtnFadeIn"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="closeBtn" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="maximizeBtn" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00.25" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Border Grid.ColumnSpan="2" Background="{TemplateBinding Background}" CornerRadius="1" SnapsToDevicePixels="True"> <Border Margin="0,1,0,0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,0" CornerRadius="1" SnapsToDevicePixels="True"> <Grid/> </Border> </Border> <ContentPresenter Margin="5,0,0,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> <Path Width="75" Height="15" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Data="M -0.23,15 C-0.23,15 75,15 75,15 75,15 75,0 75,0 75,0 24.76,0 24.76,0 22.26,0 17.99,1.76 16.22,3.53 16.22,3.53 8.30,11.46 8.30,11.46 6.53,13.23 2.26,15 -0.23,15 z" Fill="White" SnapsToDevicePixels="True" Stretch="Fill" Visibility="Collapsed"/> <Path Width="186" Height="16" Grid.ColumnSpan="3" HorizontalAlignment="Right" Margin="0,0,0,1" VerticalAlignment="Bottom" Data="M 0,15 C0,15 0,16 0,16 0,16 110.76,16 110.76,16 113.26,16 117.53,14.23 119.30,12.46 119.30,12.46 127.22,4.53 127.22,4.53 128.99,2.76 133.26,1 135.76,1 135.76,1 186,1 186,1 186,1 186,0 186,0 186,0 135.76,0 135.76,0 133.26,0 128.99,1.76 127.22,3.53 127.22,3.53 119.30,11.46 119.30,11.46 117.53,13.23 113.26,15 110.76,15 110.76,15 0,15 0,15 z" SnapsToDevicePixels="True" Stretch="Fill"> <Path.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#00ffffff"/> <GradientStop Offset="0.34" Color="#FFffffff"/> <GradientStop Offset="1" Color="#00ffffff"/> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Path.Fill> </Path> <DockPanel Grid.Column="1" Grid.ColumnSpan="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"> <Button x:Name="maximizeBtn" ClickMode="Release" Command="{x:Static igTiles:Tile.ToggleMaximizedCommand}" CommandParameter="{TemplateBinding Tile}" DockPanel.Dock="Right" Focusable="False" Style="{DynamicResource {x:Static igTiles:TileHeaderPresenter.MaximizeButtonStyleKey}}" Tag="{TemplateBinding Tile}" Visibility="{Binding Tile.MaximizeButtonVisibilityResolved, RelativeSource={RelativeSource TemplatedParent}}"/> <Button x:Name="closeBtn" Command="{x:Static igTiles:Tile.CloseCommand}" CommandParameter="{TemplateBinding Tile}" DockPanel.Dock="Right" Focusable="False" Opacity="0" Style="{DynamicResource {x:Static igTiles:TileHeaderPresenter.CloseButtonStyleKey}}" Visibility="{Binding Tile.CloseButtonVisibilityResolved, RelativeSource={RelativeSource TemplatedParent}}"/> <Image x:Name="image" DockPanel.Dock="Left" Source="{Binding Tile.Image, RelativeSource={RelativeSource TemplatedParent}}" Stretch="None" Visibility="{Binding Tile.HasImage, Converter={StaticResource BoolToVisConverter}, RelativeSource={RelativeSource TemplatedParent}}"/> </DockPanel> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </igTiles:XamTilesControl.Resources> <igTiles:XamTilesControl.ItemTemplateMaximized> <DataTemplate > <StackPanel Margin="10, 10, 0, 0"> </StackPanel> </DataTemplate> </igTiles:XamTilesControl.ItemTemplateMaximized> <igTiles:XamTilesControl.ItemTemplate> <DataTemplate> </DataTemplate> </igTiles:XamTilesControl.ItemTemplate> </igTiles:XamTilesControl>