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
450
Maximize Tile when clicking on all tile's area
posted

Hi

I have XamTilesControl. and I want to do such behavior that when I click in all area of the XamTile it expands from normal to max mode.

my XamTilesControl is bound to observable collection.

each normal tile contains usercontrol with grid.

so here what I tried to do on the control mouse down event:

((sender as Grid).Parent as CtrlGeneratorNormal).Parent

but the last "Parent" that suppose to return XamTile (I guess) is null

Any suggestions?

Thamks,

Parents
No Data
Reply
  • 30945
    Verified Answer
    Offline posted

    Hello,

     

    I have been looking into the functionality that you are looking for and I can suggest using a style for the Tile with an EventSetter for its PreviewMouseLeftButtonDown event as follows:

    <igTiles:XamTilesControl.Resources>
        <Style TargetType="{x:Type igTiles:Tile}">
            <EventSetter 
                Event="PreviewMouseLeftButtonDown"
                Handler="Tile_Clicked"/>
        </Style>
    </igTiles:XamTilesControl.Resources>
    

     

     In the event handler you can set the State property of the style to Maximized like this:

    void Tile_Clicked(object sender, MouseButtonEventArgs e)
    {
        if (Utilities.GetAncestorFromType(
            e.OriginalSource as DependencyObject, typeof(Button), false) == null)
        {
            (sender as Tile).State = TileState.Maximized;                           
        }
    }
    

     

    The if statement is used in order to check if one of the buttons in the Tiles’ header has been clicked. If you do not want the when the header is clicked the tile to maximize you can change the event of the EventSetter to MouseLeftButtonDown and remove the if statement. I have created a sample application that demonstrates this approach.

     

    If you need any further assistance please do not hesitate to ask.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

     

Children
No Data