2013-05-13 1 views
0

У меня есть два ListBox es в рад-панели, я хочу, чтобы один ListBox был видимым для одного пользователя и обоих списков, видимых другому пользователю.Радарная панель и видимость в виде списка

Когда я делаю ListBox, скрытая высота не регулируется, она имеет пробел.

Вот код и, пожалуйста, обратитесь к фотографиям.

<telerik:RadPane x:Name="customerfilterPane" 
Header="{Binding ApplicationStrings.CustomerPanelTitle, Source={StaticResource ResourceWrapper}}" 
CanUserClose="False" 
GotFocus="customerfilterPane_GotFocus" 
telerik:StyleManager.Theme="Summer"> 
        <Grid> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="*" /> 
          <RowDefinition Height="*" /> 
          <RowDefinition Height="50" /> 
         </Grid.RowDefinitions> 
         <Border Grid.Row="0" > 
          <ListBox x:Name="lstCustomers" 
           ScrollViewer.VerticalScrollBarVisibility="Auto" 
           VerticalAlignment="Stretch" 
           VerticalContentAlignment="Stretch" 
           ItemsSource="{Binding ItemList, 
           Source={StaticResource CustomerViewModel}}" 
           HorizontalAlignment="Stretch" 
           HorizontalContentAlignment="Stretch" 
           > 
          <ListBox.ItemTemplate> 
           <DataTemplate> 
           <CheckBox x:Name="chkCustomer" 
           IsChecked="{Binding IsChecked, Mode=TwoWay}" 
           Content="{Binding CustomerName}" 
           Click="chkCustomer_Click" /> 
           </DataTemplate> 
          </ListBox.ItemTemplate> 
         </ListBox> 
         </Border> 

         <Border Grid.Row="1" Margin="4" BorderThickness="3" CornerRadius="2" 
            Visibility="{Binding IsPanelHiddenToCustomer, Source={StaticResource PlannerViewModel},Converter={StaticResource InvertedBooleanToVisibilityConverter}}"> 
          <StackPanel Orientation="Vertical" Visibility="{Binding IsPanelHiddenToCustomer, Source={StaticResource PlannerViewModel},Converter={StaticResource InvertedBooleanToVisibilityConverter}}"> 
           <TextBlock Text="{Binding ApplicationStrings.PlannerPanelTitle, Source={StaticResource ResourceWrapper}}" /> 

           <ListBox x:Name="lstCustomerPlanner" ScrollViewer.VerticalScrollBarVisibility="Auto" 
           VerticalAlignment="Stretch" Height="180" 
           Visibility="{Binding IsPanelHiddenToCustomer, Source={StaticResource PlannerViewModel},Converter={StaticResource InvertedBooleanToVisibilityConverter}}" 
           VerticalContentAlignment="Stretch" 
           ItemsSource="{Binding ItemList, Source={StaticResource PlannerViewModel}}" 
           HorizontalAlignment="Stretch" 
           HorizontalContentAlignment="Stretch" 
           > 
          <ListBox.ItemTemplate> 
           <DataTemplate> 
            <CheckBox x:Name="chkCustomerPlanner" 
               IsChecked="{Binding IsChecked, Mode=TwoWay}" 
               Content="{Binding PlannerId}" 
               Click="chkPlanner_Click" /> 
           </DataTemplate> 
          </ListBox.ItemTemplate> 
         </ListBox> 
         </StackPanel> 
         </Border> 
         <StackPanel Orientation="Horizontal" 
            FlowDirection="LeftToRight" 
            HorizontalAlignment="Center" 
            VerticalAlignment="Stretch" 
            Grid.Row="2"> 
          <Button Content="{Binding ApplicationStrings.CheckAll, Source={StaticResource ResourceWrapper}}" 
            Style="{StaticResource StandardButtonStyle}" 
            Click="Customer_CheckAll" Margin="0,0,4,0" /> 
          <Button Content="{Binding ApplicationStrings.UncheckAll, Source={StaticResource ResourceWrapper}}" 
            Margin="0 0 4 0" 
            Style="{StaticResource StandardButtonStyle}" 
            Click="Customer_UncheckAll" /> 
          <Button Content="{Binding ApplicationStrings.Apply, Source={StaticResource ResourceWrapper}}" 
            Margin="0 0 0 0" x:Name="btnCustApply" 
            Style="{StaticResource StandardButtonStyle}" 
            Click="Customer_Apply" /> 
         </StackPanel> 
        </Grid> 
       </telerik:RadPane> 

enter image description hereenter image description here

Я бы замечательно, полный к вам для решения этого.

ответ

0

Я понял, что я проверяю, зарегистрирован ли пользователь и установил высоту сетки как 0 в коде позади, и вместо того, чтобы помещать окно списка в панель стеллажа, я взял отдельную сетку. Теперь я эля, чтобы удовлетворить мое требование .. спасибо за вашу помощь ....

    <telerik:RadPane x:Name="storefilterPane" 
           Header="{Binding ApplicationStrings.StorePanelTitle, Source={StaticResource ResourceWrapper}}" 
           IsPinned="True" 
           CanDockInDocumentHost="False" 
           CanUserClose="False" 
           CanUserPin="True" 
           GotFocus="storefilterPane_GotFocus" 
           telerik:StyleManager.Theme="Summer" 
           > 
        <Grid> 
         <Grid.RowDefinitions> 
          <!--<RowDefinition Height="Auto" />--> 
          <RowDefinition Height="*" x:Name="grplanner"/> 
          <RowDefinition Height="Auto" /> 
          <RowDefinition Height="*" /> 
          <RowDefinition Height="40" /> 
         </Grid.RowDefinitions> 

         <Border HorizontalAlignment="Stretch" 
               VerticalAlignment="Stretch"> 
         <!--<telerik:RadWrapPanel Grid.Row="0" 
               Orientation="Vertical" 
               HorizontalAlignment="Stretch" 
               VerticalAlignment="Stretch">--> 
          <Grid> 
           <Grid.RowDefinitions> 
            <RowDefinition Height="Auto" /> 
            <RowDefinition Height="*" /> 
           </Grid.RowDefinitions> 


          <TextBlock Text="{Binding ApplicationStrings.PlannerPanelTitle, Source={StaticResource ResourceWrapper}}" 
           Visibility="{Binding IsPanelHiddenToCustomer, Source={StaticResource PlannerViewModel},Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/> 
         <ListBox x:Name="lstStorePlanner" 
           VerticalAlignment="Stretch" 
           Visibility="{Binding IsPanelHiddenToCustomer, Source={StaticResource PlannerViewModel},Converter={StaticResource InvertedBooleanToVisibilityConverter}}" 
           VerticalContentAlignment="Stretch" 
           ItemsSource="{Binding ItemList, Source={StaticResource PlannerViewModel}}" 
           HorizontalAlignment="Stretch" 
           HorizontalContentAlignment="Stretch" 
           telerik:StyleManager.Theme="Summer" 
           Grid.Row="1" 
           > 
          <ListBox.ItemTemplate> 
           <DataTemplate> 
            <CheckBox x:Name="chkStorePlanner" 
               IsChecked="{Binding IsChecked, Mode=TwoWay}" 
               Content="{Binding PlannerId}" 
               Click="chkPlanner_Click" /> 
           </DataTemplate> 
          </ListBox.ItemTemplate> 
         </ListBox> 
          </Grid> 
         </Border> 
         <!--</telerik:RadWrapPanel>--> 

         <controls:ExtendedGridSplitter Grid.Row="1" x:Name="gridSplitterStore" 
              VerticalAlignment="Center" 
              HorizontalAlignment="Stretch" 
              Height="8" 
              CollapseMode="Next" 
              Background="LightBlue" /> 


         <Border Grid.Row="2" 
               HorizontalAlignment="Stretch" 
               VerticalAlignment="Stretch"> 
         <!--<telerik:RadWrapPanel Grid.Row="2" 
               Orientation="Vertical" 
               HorizontalAlignment="Stretch" 
               VerticalAlignment="Stretch">--> 
          <Grid> 
           <Grid.RowDefinitions> 
            <RowDefinition Height="Auto" /> 
            <RowDefinition Height="*" /> 
           </Grid.RowDefinitions> 

         <TextBlock Text="{Binding ApplicationStrings.StorePanelTitle, Source={StaticResource ResourceWrapper}}" x:Name="tbStores" 
          Visibility="{Binding IsPanelHiddenToCustomer, Source={StaticResource PlannerViewModel},Converter={StaticResource InvertedBooleanToVisibilityConverter}}" /> 
         <ListBox x:Name="lstStores" 
          VerticalAlignment="Stretch" 
          Grid.Row="1" 
          VerticalContentAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Auto" 
          ItemsSource="{Binding ItemList, Source={StaticResource StoreLookupViewModel}}" 
          HorizontalAlignment="Stretch" 
          HorizontalContentAlignment="Stretch" 
          telerik:StyleManager.Theme="Summer" 
          > 
          <ListBox.ItemTemplate> 
           <DataTemplate> 
             <CheckBox x:Name="chkStore" 
             IsChecked="{Binding IsChecked, Mode=TwoWay}" 
             Content="{Binding StoreName}" 
             Click="chkStore_Click" /> 
             </DataTemplate> 
          </ListBox.ItemTemplate> 
         </ListBox> 
          </Grid> 
         <!--</telerik:RadWrapPanel >--> 
         </Border> 
         <StackPanel Orientation="Horizontal" x:Name="spStore" 
          FlowDirection="LeftToRight" 
          HorizontalAlignment="Center" 
          VerticalAlignment="Center" Margin="0,3" 
          Grid.Row="3"> 
          <Button Content="{Binding ApplicationStrings.CheckAll, Source={StaticResource ResourceWrapper}}" 
           Style="{StaticResource StandardButtonStyle}" 
           Click="Store_CheckAll" Margin="0,0,4,0" /> 
          <Button Content="{Binding ApplicationStrings.UncheckAll, Source={StaticResource ResourceWrapper}}" 
           Margin="0 0 4 0" 
           Style="{StaticResource StandardButtonStyle}" 
           Click="Store_UncheckAll" /> 
          <Button Content="{Binding ApplicationStrings.Apply, Source={StaticResource ResourceWrapper}}" 
            Margin="0 0 0 0" x:Name="btnStrApply" 
            Style="{StaticResource StandardButtonStyle}" 
            Click="Store_Apply" /> 
         </StackPanel> 
        </Grid> 
       </telerik:RadPane> 

А в коде позади

   grdCustPlanner.Height = new GridLength(0); 
       grplanner.Height = new GridLength(0); 
       gridSplitterCust.Visibility = Visibility.Collapsed; 
       gridSplitterStore.Visibility = Visibility.Collapsed; 
0

Вы определили высоту для обоих рядов:

<Grid.RowDefinitions> 
    <RowDefinition Height="*" /> 
    <RowDefinition Height="*" /> 
    <RowDefinition Height="50" /> 
</Grid.RowDefinitions> 

Это означает, что независимо от того, содержание строки высота строки будет всегда следовать этой формуле:

(Available Height - 50)/2 

Для того, для обеспечения того, чтобы сетка обрушилась, вам необходимо указать высоту = «авто» для рядов сетки

<Grid.RowDefinitions> 
    <RowDefinition Height="auto" /> 
    <RowDefinition Height="auto" /> 
    <RowDefinition Height="50" /> 
</Grid.RowDefinitions> 

0 очевидно, это будет означать, что ячейки сетки будут занимать все необходимое пространство (что может быть неправильного размера) - в этом случае вы можете просто использовать MinHeight в верхней строке, чтобы предотвратить сокращение строки или обеспечить набор дочерних элементов управления сами до нужного размера.

+0

Я попробовал ... не повезло, она все еще показывает пустое пространство ... Tanq – Karthik

+0

Я скопировал ваш код в проект silverlight, и приведенные выше изменения сработали для меня, у меня будет другой взгляд – Charleh

Смежные вопросы