hello i am trying to create a click textblock event on a textblock inside a user control ,
with a button it is simple , using the buttonbase property on the main window but here
i am not sure what to do i will show you my code:
this is my user control:
<Border BorderBrush="Purple" BorderThickness="3" CornerRadius="3" Margin="3" >
<DockPanel>
<Grid DockPanel.Dock="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<Label Foreground="Blue">Message Number:</Label>
<Label Foreground="Blue" Grid.Row="1">Title:</Label>
<Label Foreground="Blue" Grid.Row="2">Message Date:</Label>
<Label Foreground="Blue" Grid.Row="3">Contact Mail:</Label>
<Label Foreground="Blue" Grid.Row="4">Message Type:</Label>
<Label Foreground="Blue" Grid.Row="5">Message Details:</Label>
<Label x:Name="lblMessageNum" Grid.Column="1"></Label>
<Label x:Name="lblTitle" Grid.Column="1" Grid.Row="1"></Label>
<Label x:Name="lblMessageDate" Grid.Column="1" Grid.Row="2"></Label>
<Label x:Name="lblContactMail" Grid.Column="1" Grid.Row="3"></Label>
<Label x:Name="lblMessageType" Grid.Column="1" Grid.Row="4"></Label>
<Label x:Name="lblMessageDetails" Grid.Column="1" Grid.Row="5"></Label>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Margin="23,0,0,0" x:Name="tbkRemove">
<Underline>Remove Message</Underline>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property= "Foreground" Value="Blue"/>
<Style.Triggers>
<Trigger Property ="IsMouseOver" Value="True">
<Setter Property= "Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Border Grid.Row="1" BorderBrush="Purple" CornerRadius="3" BorderThickness="3" Margin="23,10,6,0">
<Image x:Name="ImgPic" Width="102" Height="110"></Image>
</Border>
</Grid>
</DockPanel>
</Border>
inside this usercontrol i got tbkRemove textblock which should have an event to remove it self (the all user control) from the main window so the code of the click event should be on the main window but how can i make such an event
thanks in advance for your help
i created a new button that looks like a textblock using expression blender so i can bubble it up using buttonbase .
Related
I am working on sidebar wpf application. Sidebar has several dockpanels. My question is, how can collapse / visible same of dockpanels in sidebar based on click buttons. For example: Button 1 should be collapse dockPanel1 and everything inside in. Button 2 should be display it.
Here is an example:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="370*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Background="Black" x:Name="sidebarControl">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<DockPanel LastChildFill="False">
<Image DockPanel.Dock="Top" Source="{StaticResource logo}" />
<DockPanel DockPanel.Dock="Top" Height="160" Name="dockPanel1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Label Content="Label1"></Label>
<Label Content="Label2"></Label>
</StackPanel>
<StackPanel Grid.Row="1">
<Label Content="Label3"></Label>
<Label Content="Label4"></Label>
</StackPanel>
</Grid>
</DockPanel>
<DockPanel DockPanel.Dock="Top" Height="160" Name="dockPanel2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<!-- other content -->
</StackPanel>
<StackPanel Grid.Row="1">
<!-- other content -->
</StackPanel>
</Grid>
</DockPanel>
</DockPanel>
</Grid>
</Grid>
I solved this problem using BooleanToVisibilityConverter. In ViewModel i put boolean property named IsVisible. Wherever i change my IsVisible property (set to true or false) BooleanToVisibilityConverter class check it and change dockpanel visibility. Here is my code:
<DockPanel DockPanel.Dock="Top" Height="160" Name="dockPanel1"
Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibility}, Mode=TwoWay}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Label Content="Label1"></Label>
<Label Content="Label2"></Label>
</StackPanel>
<StackPanel Grid.Row="1">
<Label Content="Label3"></Label>
<Label Content="Label4"></Label>
</StackPanel>
</Grid>
</DockPanel>
I have a Button that lives outside a tab control element. Each Tab on the TabControl has either a text box for manual text entry or a search tool to look up something from a database (the value of which will also be written to the label in tab 2 & 3).
I want to enable the Print button if the textbox has content or a variable that is populated from a database query on the selected tab has content.
What would be the best way to do this, given a button can only be bound to one source? I pondered having a staging variable, but then that would also be only bound to one element.
Any ideas? I'm really new to data-binding and I'm struggling to get my head around some of the concepts.
It doesn't help that the back-end is in VB because i'm porting a number of WinForms apps to WPF and I want to do them properly.
Quick XAML:
<Window x:Name="Main1" x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" SizeToContent="Height">
<Grid>
<StackPanel >
<Grid x:Name="Activity" Margin="5,5,5,0" >
<StackPanel>
<TabControl x:Name="Main_Tabs" Background="{x:Null}" BorderBrush="Gainsboro">
<TabItem x:Name="T1" Header="H1" >
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="80*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right">Address:</Label>
<TextBox x:Name="Single_Address"
Margin="5,3"
SpellCheck.IsEnabled="True"
IsManipulationEnabled="True"
TextWrapping="Wrap"
AcceptsReturn="True"
VerticalScrollBarVisibility="Auto"
Grid.Column="1" Grid.Row="2"
Language="en-GB" Height="80">
</TextBox>
</Grid>
</TabItem>
<TabItem x:Name="T2" Header="H2" >
<Grid Grid.ColumnSpan="2" Grid.Row="1" x:Name="Grid_Elucid_Label2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="80*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right">Address:</Label>
<Label x:Name="Elucid_Address"
Margin="5,3"
Grid.Column="1" Grid.Row="2" Height="80">
</Label>
</Grid>
</TabItem>
<TabItem x:Name="T3" Header="H3">
<Grid x:Name="Grid_Sage_Label" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="80*"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right">Address:</Label>
<Label x:Name="Sage_Address" Margin="5,3" Grid.Column="1" Grid.Row="2" Height="80">
</Label>
</Grid>
</TabItem>
</TabControl>
</StackPanel>
</Grid>
<Button x:Name="Print_Button" Content="Print" Padding="10" Background="{x:Null}" BorderBrush="Gainsboro" />
</StackPanel>
</Grid>
</Window>
#1 VM with few textproperties to evaluate
if you have just a few text properties and use a VM, you can go with some triggers.
I wrote this by hand so I'm sorry if the syntax isn't a 100% match.
<button content="print">
<button.style>
<style targettype={x:type button}>
<style.triggers>
<multidatatrigger>
<multidatatrigger.conditions>
<condition Binding="{Binding VMprop1}" Value="">
<condition Binding="{Binding VMprop2}" Value="">
<condition Binding="{Binding VMprop3}" Value="">
</multidatatrigger.conditions>
<multidatatrigger.setters>
<setter property="IsEnabled" value="false"/>
</multidatatrigger.setters>
</multidatatrigger>
</style.triggers>
</style>
</button.style>
<button>
2 no VM or a lot of properties to evaluate
bind to the TextChanged of all TextBoxes and evaluate their state, and set the IsEnabled from your button (if you want use a Dependency Property)
<button x:Name="btn1" content="print" IsEnabled="{Binding CanPrint}"/>
<textbox x:Name="tb1" TextChanged="EvaluateCanPrint"/>
<textbox x:Name="tb2" TextChanged="EvaluateCanPrint"/>
<textbox x:Name="tb3" TextChanged="EvaluateCanPrint"/>
<textbox x:Name="tb4" TextChanged="EvaluateCanPrint"/>
...
private void EvaluateCanPrint() {
// ViewModel.EvaluateCanPrint();
ViewModel.CanPrint =
!string.isNullOrEmpty(tb1.Text) &&
!string.isNullOrEmpty(tb2.Text) &&
...;
}
// Original answer
//private void EvaluateTextChanged() {
// if (string.isNullOrEmpty(tb1.Text) &&
// string.isNullOrEmpty(tb2.Text) &&
// ...)
// {
// btn1.IsEnabled = false;
// }
//}
I have two usercontrols:
Usercontrol 1:
- contains a storyboard animation in the usercontrol resources named "somestoryboard".
- contains a keyboard that has to be slide up when someone clicks on a textbox in usercontrol 2.
- contains a contentcontrol where any usercontrol dynamically resides.
Usercontrol 2:
- Contains a textbox with an eventtrigger. When touched the storyboard from usercontrol 1 has to be fired.
Unfortunately the whole binding goes wrong in the second user control. I constantly get the message "couldn't find object of storyboard".
How do I set this binding right in usercontrol 2, or is this even possible in purely xaml?
Here are the two usercontrols:
Usercontrol 1:
<UserControl (some namespaces)>
<UserControl.Resources>
<Storyboard x:Key="SomeControl">
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="aControl"
Storyboard.TargetProperty="Expanded" >
<DiscreteBooleanKeyFrame Value="True" KeyTime="0:0:0" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="500" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="800" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" Grid.Row="1" Background="{StaticResource DefaultBackground}" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition />
<RowDefinition Height="70" />
</Grid.RowDefinitions>
<ContentControl Grid.Row="1" Grid.Column="2" Margin="10,0,20,0" VerticalContentAlignment="Top"/>
</Grid>
<Controls:Somecontrol x:Name="aControl" VerticalAlignment="Bottom" Height="0" HorizontalAlignment="Stretch"
Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="1" Grid.RowSpan="2" UseAnimation="True"
Style="{StaticResource AnimatedControl}" />
</Grid>
Usercontrol 2:
<UserControl (some namespaces)>
<Grid Margin="5" >
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBox Grid.Row="0" Text="{Binding InputMessage}" VerticalAlignment="Center" FontSize="12" Margin="0,0,0,5" />
<TextBox Grid.Row="1" Text="{Binding InputResult}" InnerBorderBrush="Blue" CornerRadius="5" Background="White" >
<TextBox .Triggers>
<EventTrigger RoutedEvent="TextBox.TouchUp">
<BeginStoryboard Storyboard="{StaticResource SomeControl}" />
</EventTrigger>
</TextBox.Triggers>
</TextBlock >
</Grid>
</UserControl>
So I'm convinced that this is probably an easy answer and I'm just not seeing it, but after 20 google searches and 3 days of trying to figure it out on my own, I surrender. The xaml I'm using is below. What I need is for the two textboxes to fill all remaining space and to be equally sized. I've tried StackPanel, DockPanel, Grid (as it is below), and even nesting each of these and nesting a UniformGrid. Nothing seems to work, I just get 2 textboxes with whatever height I specify for MinHeight. Changing the Grid.Row setting from Auto to * just results in the TextBoxes centering themselves and moving as the window shrinks and grows.
<TabItem Header="Notes" Name="notesTab">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="23"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Content="Select Contact:" Height="28" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" FontStyle="Italic" FontWeight="Bold"></Label>
<ComboBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Right" Width="150" ItemsSource="{Binding Source={StaticResource contactList}}" DataContext="{Binding Source={StaticResource contactList}}" Name="contactSelectionBox"></ComboBox>
<WrapPanel Grid.Row="1" Height="Auto" Grid.ColumnSpan="2" Margin="5">
<WrapPanel.Width>
<Binding ElementName="callNotes" Path="ActualWidth" />
</WrapPanel.Width>
<Label Content="TAD" Width="Auto" Name="tadShortcut" MouseLeftButtonDown="tadShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="VI" Width="Auto" Name="verifyInfoShortcut" MouseLeftButtonDown="verifyInfoShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Not there" Width="Auto" Name="uipShortcut" MouseLeftButtonDown="uipShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="WUSP" Width="Auto" Name="wuspShortcut" MouseLeftButtonDown="wuspShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="FNYD" Width="Auto" Name="fnydShortcut" MouseLeftButtonDown="fnydShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Not Employed" Width="Auto" Name="notEmployedShortcut" MouseLeftButtonDown="notEmployedShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Message" Width="Auto" Name="messageShortcut" MouseLeftButtonDown="messageShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Late Fees" Width="Auto" Name="lateFeesShortcut" MouseLeftButtonDown="lateFeesShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Payoff" Width="Auto" Name="payoffReqShortcut" MouseLeftButtonDown="payoffReqShortcut_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="No Commit" Width="Auto" Name="noCommit" MouseLeftButtonDown="noCommit_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="12/12" Width="Auto" Name="twelve12" MouseLeftButtonDown="twelve12_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="No ID" Width="Auto" Name="vmNoID" MouseLeftButtonDown="vmNoID_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Wrong #" Width="Auto" Name="wrongNumber" MouseLeftButtonDown="wrongNumber_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Day Off" Width="Auto" Name="dayOff" MouseLeftButtonDown="dayOff_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="FPD" Width="Auto" Name="firstPaymentDefault" MouseLeftButtonDown="firstPaymentDefault_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Repo Pmnt" Width="Auto" Name="repoPayment" MouseLeftButtonDown="repoPayment_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="CS Xfer" Width="Auto" Name="custServ" MouseLeftButtonDown="custServ_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
<Label Content="Spanish" Width="Auto" Name="spanish" MouseLeftButtonDown="spanish_MouseLeftButtonDown" MouseEnter="notesLabel_MouseEnter" MouseLeave="notesLabel_MouseLeave" />
</WrapPanel>
<MyNamespace:WatermarkTextBox Grid.Row="2" Grid.ColumnSpan="2" Style="{StaticResource TextBox Style}" MinHeight="98" Margin="15,5,15,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Name="callTwoNotes" TextChanged="callTwoNotes_TextChanged" FontWeight="Bold" IsEnabled="False" ClipToBounds="False"></MyNamespace:WatermarkTextBox>
<Button Grid.Row="3" Grid.ColumnSpan="2" Height="23" Name="flipFlopButton" VerticalAlignment="Center" Width="75" Click="flipFlopButton_Click">
<Image Source="Images/FlipFlop.gif" />
</Button>
<MyNamespace:WatermarkTextBox Grid.Row="4" Grid.ColumnSpan="2" Style="{StaticResource TextBox Style}" MinHeight="98" Margin="15,5,15,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Name="callNotes" TextChanged="callNotes_TextChanged" FontWeight="Bold"></MyNamespace:WatermarkTextBox>
</Grid>
</TabItem>
The xaml for the style on the TextBoxes is below, just for completeness.
<Style x:Key="TextBox Style" TargetType="{x:Type MyNamespace:WatermarkTextBox}">
<Setter Property="CharacterCasing" Value="Upper" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="23" />
<Setter Property="Width" Value="Auto" />
<Setter Property="SelectAllOnGotFocus" Value="True" />
</Style>
There are two issues with the code posted
The Grid's RowDefintion for the TextBoxes is listed as Auto instead of *. This means the Row will be sized based on the size of the cell contents, not based on the Grid's size. Change this to * so it's size will be based on available space.
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="23"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
The other problem is your TextBox style is defining a Height for your item. This means it will keep the TextBox at the specified Height and not re-size it to fit the available space. You can either remove this style setter, or set the Height on your TextBoxes in the Grid to Auto.
Remove this setter
<Style x:Key="TextBox Style" TargetType="{x:Type MyNamespace:WatermarkTextBox}">
<Setter Property="Height" Value="23" />
...
</Style>
Or set the Height property on your TextBox tag to Auto. Setting the property in the object's tag will overwrite a styled property
<MyNamespace:WatermarkTextBox Height="Auto" Grid.Row="2" ... />
<MyNamespace:WatermarkTextBox Height="Auto" Grid.Row="4" ... />
This was answered a few minutes ago by someone else but now the answer it gone. Try deleting these lines:
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
As might be overwriting the Stretch
Edit: Ok i tried your code and what you need to change is your Grid RowDefinitions, try
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="23"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
and you might want to remove your minheight aswell. In fact, you should try to remove all you explicit heights and widths, let WPF take care of that, thats what the layout system is for.
If the ItemSource property of a combo box has been set, why could clicking on the drop down botton of a combobox not display the list of available items? This may be related but within the same control, any context menu is displayed behind the user control:
The XAML for this control is as follows:
<Border Name="Border" Padding="5">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ScrollViewer.Resources>
<Style TargetType="{x:Type CheckBox}">
<Setter Property="Padding" Value="8,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</ScrollViewer.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Margin="5,4,0,4" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition SharedSizeGroup="labelColumn1" />
<ColumnDefinition SharedSizeGroup="labelColumn2" />
<ColumnDefinition SharedSizeGroup="dataEntryColumn" />
<ColumnDefinition Width="30"/>
<ColumnDefinition SharedSizeGroup="labelColumn2"/>
<ColumnDefinition SharedSizeGroup="dataEntryColumn" />
<ColumnDefinition MaxWidth="0" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition MinHeight="23" />
<RowDefinition MinHeight="23" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Geometry Type" VerticalAlignment="Center" Grid.Column="1" Grid.Row="0"/>
<ComboBox Grid.Column="3" Margin="6,1,0,1" Grid.Row="0" Width="150"
Name="cmboGeometryTypes"
SelectedItem="{Binding GeometryType, Mode=TwoWay}"
HorizontalAlignment="Left"
DisplayMemberPath="Name"
Grid.ColumnSpan="1"
/>
<TextBlock Text="Symbol Type"
Grid.Column="1" Grid.Row="1" VerticalAlignment="Center"/>
<ComboBox
Name="cmboSymbolEditors"
SelectedItem="{Binding SymbolEditorViewModel, Mode=TwoWay}"
HorizontalAlignment="Left"
DisplayMemberPath="Alias"
Width="150"
Grid.Column="3"
Margin="6,1,0,1"
Grid.Row="1"
Grid.ColumnSpan="1" />
</Grid>
<Label Padding="10,0,0,0" Margin="10,0,0,3" Style="{StaticResource fadingLabelSeperatorStlye}" Grid.Row="1">
Editor
</Label>
<local:SymbologyEditorControl x:Name="editor" Grid.Row="2"/>
</Grid>
</ScrollViewer>
</Border>
and the effect I am observing is illustrated below
How do I fix this?
There was a common WPF bug that caused this behavior of any Popup type UI displaying in back instead of topmost so that may be what you're seeing. I haven't seen the issue in a while but I'm not sure if it was fixed or not. It's related to bad video drivers so you might see it only on certain machines and not all the time.
There was a hotfix available from MS support but it might be easier to just switch your application to use software rendering instead.