@@ -28,7 +28,7 @@ | |||
</Grid.ColumnDefinitions> | |||
<!--左侧选择区域--> | |||
<TabControl SelectedIndex="0"> | |||
<TabControl x:Name="LeftSelectTab" SelectedIndex="0" SelectionChanged="TabControl_SelectionChanged"> | |||
<TabItem Header="页面编辑"> | |||
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent" > | |||
<Grid > | |||
@@ -277,7 +277,7 @@ | |||
<!--右侧属性栏--> | |||
<Grid Grid.Column="2"> | |||
<TabControl SelectedIndex="0"> | |||
<TabControl x:Name="ReditSeleceTab" SelectedIndex="0"> | |||
<TabItem Header="页面设置"> | |||
<mypro:PropertyGrid Margin="10" ShowAdvancedOptions="True" ShowDescriptionByTooltip="True" | |||
FontSize="14" ShowTitle="False" ShowSortOptions="False" ShowSearchBox="False" | |||
@@ -327,16 +327,44 @@ namespace BeDesignerSCADA.Controls | |||
/// <param name="e"></param> | |||
private void SavePage_Click(object sender, RoutedEventArgs e) | |||
{ | |||
if (viewModel.MenuModel.SelectPageModels == null) | |||
viewModel.MenuModel.SelectPageModels = viewModel.MenuModel.pageModels[0]; | |||
viewModel.MenuModel.SelectPageModels.visual?.Children.Clear(); | |||
foreach (FrameworkElement element in cav.Children) | |||
try | |||
{ | |||
string xamlText = XamlWriter.Save(element); | |||
FrameworkElement item = XamlReader.Parse(xamlText) as FrameworkElement; | |||
viewModel.MenuModel.SelectPageModels.visual.Children.Add(item); | |||
LeftSelectTab.SelectedIndex = 0; | |||
if (viewModel.MenuModel.SelectPageModels == null) | |||
viewModel.MenuModel.SelectPageModels = viewModel.MenuModel.pageModels[0]; | |||
viewModel.MenuModel.SelectPageModels.visual?.Children.Clear(); | |||
foreach (FrameworkElement element in cav.Children) | |||
{ | |||
string xamlText = XamlWriter.Save(element); | |||
FrameworkElement item = XamlReader.Parse(xamlText) as FrameworkElement; | |||
viewModel.MenuModel.SelectPageModels.visual.Children.Add(item); | |||
} | |||
viewModel.UpdatePageBase(viewModel.MenuModel.SelectPageModels); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 选中Tab改变事件 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
try | |||
{ | |||
if (LeftSelectTab.SelectedIndex <= 1 && ReditSeleceTab != null) | |||
{ | |||
ReditSeleceTab.SelectedIndex = LeftSelectTab.SelectedIndex; | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
viewModel.UpdatePageBase(viewModel.MenuModel.SelectPageModels); | |||
} | |||
#endregion | |||
@@ -510,7 +538,5 @@ namespace BeDesignerSCADA.Controls | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -221,12 +221,16 @@ | |||
</Rectangle> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | |||
<icon:PackIconModern x:Name="Sort" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,5,0" Foreground="White" Kind="Page" /> | |||
<TextBlock Margin="5,0,0,0" FontSize="12" Foreground="White" | |||
x:Name="txt" | |||
Grid.Column="1" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
<TextBlock Margin="5,0,0,0" Foreground="White" FontSize="12" HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Text="{Binding Sort,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock> | |||
<TextBlock Foreground="White" FontSize="12" HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Text="-"></TextBlock> | |||
<TextBlock Margin="0,0,0,0" FontSize="12" Foreground="White" | |||
x:Name="txt" Grid.Column="1" HorizontalAlignment="Left" | |||
VerticalAlignment="Bottom" | |||
Text="{Binding Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> | |||
</StackPanel> | |||
<StackPanel x:Name="stack" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,10,0"> | |||
<Button Width="24" Cursor="Hand" BorderBrush="Transparent" Background="Transparent" CommandParameter="{Binding .}" Command="{Binding DataContext.AddPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" Padding="0" Margin="0,0,0,0" ToolTip="增加页"> | |||