views:

33

answers:

1

Hi,

I am not able to apply style at runtime on child window.I have created two styles one with chrome and one without chrome. What i wanted to do is on mediaplayer fullscreen mode disable the dragging of child window and on press on escape button(normal mode) enable dragging of child window. My code looks like this :

void Content_FullScreenChanged(object sender, EventArgs e)
{

        if (App.Current.Host.Content.IsFullScreen)
        {

            ObjChildMediaPlayer.Style  = Application.Current.Resources["TestStyle"] as Style;
        }
        else
        {

            ObjChildMediaPlayer.Style  = Application.Current.Resources["TestBasicStyle"] as Style;                

        }

        ObjChildMediaPlayer.UpdateLayout();
    } 

On full screen dragging is disabling but when i press escape button it does not drag. I want the child window to be dragging in normal mode.

A: 

TestStyle :

                                    <Border Background="{TemplateBinding Background}" Margin="7" Grid.Row="1">
                                        <ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                </Grid>
                            </Border>
                        </Border>
                    </Grid>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Other style does not have chrome rest everything is same.

Swapnil Gupta