Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Applying ItemTemplateMaximized disables TileCommandSource associated button's Command
posted

Consider the following bit of code:

```

DataTemplate x:Key="NormalTemplate">
        <Button Command="{Binding Path=QueryServiceCommand}" Content ="Query service">
            <ig:Commanding.Command>
                <igPrim:TileCommandSource EventName="Click" CommandType="ToggleMaximized" AllowEventHandling="False" />
            </ig:Commanding.Command>
        </Button>
    </DataTemplate>
 
    <DataTemplate x:Key="MaximizedTemplate">
        <TextBlock Text="Max"></TextBlock>
    </DataTemplate>
 
    <DataTemplate x:Key="MinimizedTemplate">
        <TextBlock Text="Min" />
    </DataTemplate>
 
    <DataTemplate x:Key="MinimizedExpandedTemplate">
        <TextBlock Text="MinExpanded" />
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type viewModels:HomeViewModel}" >
        <Grid>
            <ig:XamTileManager  Name="XamTileManager"
                                ItemsSource="{Binding Apps}"
                                ItemTemplate="{StaticResource NormalTemplate}"
                                ItemTemplateMaximized="{StaticResource MaximizedTemplate}"
                                ItemTemplateMinimized="{StaticResource MinimizedTemplate}"
                                ItemTemplateMinimizedExpanded="{StaticResource MinimizedExpandedTemplate}"/>

``` 

This results is a `XamTileManager` with _n_ number of XamTiles each in Normal mode  displaying a button with text "Query Service". Click the button, and the tile switches to Maximize mode (the text Max is displayed on the tile). You can go back to normal mode just fine by clicking the maximize button on top right. 

However, the QueryServiceCommand's Execute method is never called.

However, remove `ItemTemplateMaximized="{StaticResource MaximizedTemplate}"` and the command executes just fine and tile Maximizes too, i.e. in:

```

<DataTemplate x:Key="NormalTemplate">
        <Button Command="{Binding Path=QueryServiceCommand}" Content ="Query service">
            <ig:Commanding.Command>
                <igPrim:TileCommandSource EventName="Click" CommandType="ToggleMaximized" AllowEventHandling="False" />
            </ig:Commanding.Command>
        </Button>
    </DataTemplate>
 
    <DataTemplate x:Key="MaximizedTemplate">
        <TextBlock Text="Max"></TextBlock>
    </DataTemplate>
 
    <DataTemplate x:Key="MinimizedTemplate">
        <TextBlock Text="Min" />
    </DataTemplate>
 
    <DataTemplate x:Key="MinimizedExpandedTemplate">
        <TextBlock Text="MinExpanded" />
    </DataTemplate>
    
    <DataTemplate DataType="{x:Type viewModels:HomeViewModel}" >
        <Grid>
            <ig:XamTileManager  Name="XamTileManager"
                                ItemsSource="{Binding Apps}"
                                ItemTemplate="{StaticResource NormalTemplate}"
                                ItemTemplateMinimized="{StaticResource MinimizedTemplate}"
                                ItemTemplateMinimizedExpanded="{StaticResource MinimizedExpandedTemplate}"/>


``` 

`QueryServiceCommand.Execute()` is called and the tile Maximizes.

I think the problem is that the `TileCommand` which gets executed by the Click event sets the routed event to Handled which means the Button's Command never gets executed. Though this does not explain the strange behavior observed by removing the Maximize template. Any thoughts on what's happening here? 

I've tried:

```
<igPrim:TileCommandSource EventName="MouseUp" CommandType="ToggleMaximized" AllowEventHandling="False" />
```` 

 but that doesn't Maximize the XamTile.

Thanks!

Parents Reply Children
No Data