MyToolkit icon indicating copy to clipboard operation
MyToolkit copied to clipboard

VisualStateManager does not work with DataGridText Column WIdth

Open ajmcateer opened this issue 9 years ago • 1 comments

This worked back in December when I was last using this library but now that I am trying to use it again I can't get it to work. I am using the VisualStateManger to try to set the Column width to 0 to accommodate for different screen sizes but the columns width is not affected by the VisualStateManger.

<VisualState x:Name="VisualStateNarrow">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NarrowMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="Station.Header" Value="Test" />
                        <Setter Target="Volume.Width" Value="0" />
                        <Setter Target="Expires.Width" Value="0" />
                        <Setter Target="SellStation.Width" Value="0" />
                        <Setter Target="SellVolume.Width" Value="0" />
                        <Setter Target="SellExpires.Width" Value="0" />
                    </VisualState.Setters>
                </VisualState>

<TKcontrols:DataGrid Grid.Row="1"
                           ItemsSource="{Binding BuyOrder}" 
                           SelectionMode="Multiple" 

                           DefaultOrderIndex="1" Margin="5,0,0,0">

                    <TKcontrols:DataGrid.Columns>
                        <TKcontrols:DataGridTextColumn x:Name="Region" Width="150" Header="Region" Binding="{Binding Region}" />
                        <TKcontrols:DataGridTextColumn x:Name="Station" Width="550" Header="Station" Binding="{Binding Station}"/>
                        <TKcontrols:DataGridTextColumn x:Name="Price" Width="100" Header="Price" Binding="{Binding Price}" />
                        <TKcontrols:DataGridTextColumn x:Name="Volume" Width="100" Header="Vol Remain" Binding="{Binding Vol_remain}" />
                        <TKcontrols:DataGridTextColumn x:Name="Expires" Width="100" Header="Expires" Binding="{Binding Expires}" />
                        <!--<TKcontrols:DataGridTextColumn.Header>
                                <TextBlock Text="Lastname" Foreground="Green" />
                            </TKcontrols:DataGridTextColumn.Header>-->
                    </TKcontrols:DataGrid.Columns>

Gist Example

ajmcateer avatar Jun 13 '16 00:06 ajmcateer

I can't remember that something big changed with the DataGrid since December. I have to check this, however currently I don't have the spare time for this... will update this issue as soon as possible.

RicoSuter avatar Jul 24 '16 20:07 RicoSuter