|
Part 1
I'm using SQLiteStudio 3.0.5.
It's OK, but one think I can't figure out is how to execute 2 queries AND have both their results show at the time time:
SELECT * FROM Table1;
[UPDATED - OOPS]
SELECT * FROM Table2
This runs but only displays the results from Table 2.
Part 2
Anyone know of a better tool?
Thanks
If it's not broken, fix it until it is
modified 22-Jul-15 12:44pm.
|
|
|
|
|
SELECT * FROM Table1
Shows results from Table2?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Sorry, typo -
SELECT * FROM Table1;
SELECT * FROM Table2
Only shows the results from table2.
SQL Management Studio shows one table for each query
If it's not broken, fix it until it is
|
|
|
|
|
Not exactly sure what you're after here. If the tables are related then you need to join them on a common field and show the results as one query. If they are not related you can always use a cross join which will return rows from table1 combined with each row of table2:
SELECT * FROM Table1 CROSS JOIN Table2
or
SELECT * FROM Table1, Table2
-NP
Never underestimate the creativity of the end-user.
|
|
|
|
|
Nothing to do with joins...
Paste the following into SSMS
SELECT * FROM Table1
SELECT * FROM Table2
Press F5. The queries both run and both result sets are displayed.
When I do this in SQLiteManager, only the last result set is displayed.
If it's not broken, fix it until it is
|
|
|
|
|
Does sticking GO; between the statements change the results?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
What does this have to do with WPF or Silverlight?
|
|
|
|
|
Absolutly nothing. I posted in the wrong formum
If it's not broken, fix it until it is
|
|
|
|
|
I would like to have an icon switch between red and green, for inactive/active, and will have approximately a dozen scattered throughout several grids. I looked into DataBinding and IValueConverter, but have not been successful in getting the functionality that I am looking for. Question, is this the best way most efficient way for switching an icon off and on.
|
|
|
|
|
Did you try a Data.Trigger?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I was eventually able to get my code to function using the Converter, I had not correctly set up the DataContext. I will investigate Data.Trigger though. Thanks.
|
|
|
|
|
I've created a style that allows me to use a custom image in place of the default up/down arrow in an expander. How can I create this style so that I can set the image in the place where the expander is used, instead of setting it in the style.
Thanks
Sorry, a bit long. The image is after the second comment
<!-- ********** BASE EXPANDER STYLE********** -->
<Style x:Key="BaseLiveViewExpanderStyle"
TargetType="{x:Type Expander}">
<pre>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource Gray3}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="BorderBrush" Value="{StaticResource NormalBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontFamily" Value="{StaticResource AppFontName}"/>
<Setter Property="FontSize" Value="{StaticResource NormalFontSize}"/>
</Style>
<!-- ********** SENSOR LIST EXPANDER HEADER STYLE********** -->
<Style x:Key="SensorListExpanderDownHeaderStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Padding="{TemplateBinding Padding}">
<Grid Background="Transparent" SnapsToDevicePixels="False">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="19"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="/DFT.Falcon6.Shared;component/Media/Images/sensor_list_normal_16.png"/>
<ContentPresenter Grid.Column="1"
x:Name="cp"
HorizontalAlignment="Left"
Margin="4,0,0,0"
RecognizesAccessKey="True"
SnapsToDevicePixels="True"
VerticalAlignment="Center"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="false">
<Setter Property="Visibility" TargetName="cp" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ********** SENSOR LIST EXPANDER STYLE********** -->
<Style x:Key="sensorListExpanderStyle"
TargetType="{x:Type Expander}"
BasedOn="{StaticResource BaseLiveViewExpanderStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="3"
SnapsToDevicePixels="true">
<DockPanel>
<ToggleButton x:Name="HeaderSite"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Content="{TemplateBinding Header}"
DockPanel.Dock="Top"
Foreground="{TemplateBinding Foreground}"
FontWeight="{TemplateBinding FontWeight}"
FontStyle="{TemplateBinding FontStyle}"
FontStretch="{TemplateBinding FontStretch}"
FontSize="{TemplateBinding FontSize}"
FontFamily="{TemplateBinding FontFamily}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Margin="1"
MinWidth="0"
MinHeight="0"
Padding="{TemplateBinding Padding}"
Style="{StaticResource SensorListExpanderDownHeaderStyle}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="ExpandSite"
DockPanel.Dock="Bottom"
Focusable="false"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
Visibility="Collapsed"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
If it's not broken, fix it until it is
|
|
|
|
|
I'm trying to create a Drop Down Button UC. So far it's all going well except that the Content menu has no SelectedItem. So I tried this:
XAML
<Grid x:Name="layoutRoot">
<pre>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0"
Click="Button_Click">
<StackPanel Orientation="Horizontal">
<Image Source="sort_16.png"
VerticalAlignment="Center"
Height="16"
Width="16"/>
<Image Source="downarrow.png"
VerticalAlignment="Center"
Height="3"
Width="5"/>
</StackPanel>
<Button.ContextMenu>
<ContextMenu/>
</Button.ContextMenu>
<Button.Resources>
<ContextMenu x:Key="menu" ItemsSource="{Binding MenuItems}">
<ContextMenu.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Text}"/>
<MenuItem Command="{Binding MenuItemSelectedCommand, Mode=TwoWay}"
CommandParameter="{Binding}"/>
</StackPanel>
</DataTemplate>
</ContextMenu.ItemTemplate>
</ContextMenu>
</Button.Resources>
</Button>
Code behind
public partial class DFTDropDownButton : UserControl
{
#region Commands
private ICommand _MenuItemSelectedCommand;
public ICommand MenuItemSelectedCommand
{
get
{
if (_MenuItemSelectedCommand == null)
_MenuItemSelectedCommand = new RelayCommand<DropDownButtonMenuItem>(p => menuItemSelectedExecuted(p), p => menuItemSelectedCanExecute());
return _MenuItemSelectedCommand;
}
}
#endregion
<pre>
#region MenuItems DP
public List<DropDownButtonMenuItem> MenuItems
{
get { return (List<DropDownButtonMenuItem>)GetValue(MenuItemsProperty); }
set { SetValue(MenuItemsProperty, value); }
}
public static readonly DependencyProperty MenuItemsProperty =
DependencyProperty.Register("MenuItems", typeof(List<dropdownbuttonmenuitem>), typeof(DFTDropDownButton), new UIPropertyMetadata(null));
#endregion
#region CTOR
public DFTDropDownButton()
{
InitializeComponent();
this.layoutRoot.DataContext = this;
}
#endregion
#region Private Methods
private bool menuItemSelectedCanExecute()
{
return true;
}
private void menuItemSelectedExecuted(DropDownButtonMenuItem item)
{
}
#endregion
#region Event Handlers
private void Button_Click(object sender, RoutedEventArgs e)
{
Button b = sender as Button;
b.ContextMenu.ItemsSource = MenuItems;
b.ContextMenu.IsOpen = true;
}
#endregion
}
Problem
The Command never fires.
Anyone see what's wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
The MenuItemSelectedCommand is defined on your DFTDropDownButton class, but the MenuItem 's DataContext will be an instance of your DropDownButtonMenuItem class.
If you check the output window, you should see lots of data binding errors telling you that the DropDownButtonMenuItem class doesn't contain a property called MenuItemSelectedCommand .
Try pointing to the layoutRoot element in the binding:
<MenuItem
Command="{Binding Path=DataContext.MenuItemSelectedCommand, ElementName=layoutRoot}"
CommandParameter="{Binding}"
/>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I had already checked the output. No binding errors.
I did try your suggestion... no joy. Also, the Context Menu ItemsSource does not get set
from the bindings. It has to be done in the button's click.
Something strange with the bindings.
This is a sample project[^] if you're interested in taking a look.
If it's not broken, fix it until it is
|
|
|
|
|
I have a solution with multiple projects in it.
1) MyApp.UI.WPF... This is the Desktop project.. the main WPF project
2) MyApp.Shared.. Contains controls, media, and styles used primarily in the desktop app but also used in other WPF apps related to #1. Provides a consistent look and feel in this family of apps.
3) WPF Controls project... Contains WPF controls for use in any WPF project. Think of this as a third party control libtary.
So I created a TimePicker control in project 3 and placed an instance of it on a window in project 1.
The question...
How do I apply styles found in project #2 to a control created in project #3 that resides on a window in project #1.
Look here[^]
Thanks
If it's not broken, fix it until it is
modified 7-Jul-15 12:43pm.
|
|
|
|
|
The simple option would seem to be:
- In project #2, add a reference to project #3;
- Define styles in project #2 for the controls in project #3, in exactly the same way you define styles for the built-in controls;
You'll probably want to use the XmlNsPrefix and XmlNsDefinition attributes in project #3 to make it easier to import the control's namespace:
A Guide to Cleaner XAML with Custom Namespaces and Prefixes (WPF/Silverlight)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Project 2 is the Desktop Theme & Images project. You're saying add a ref to the User Control library??
Not sure about that. That won't work.
If it's not broken, fix it until it is
|
|
|
|
|
You can't define styles for an unknown control. The project that defines the styles for #3 must have a reference to #3.
If you can't do that in #2, then you'll need to do it in a new project.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If you bought a set of controls, such as Telerik, and used them in 3 different projects, each of those projects can have a different look and feel.
- So how does the app tell the control what style to use? The Telerik assembly doesn't know about your app.
- How do you tell specific controls in that library what to look like. It's not enough to set the TargetType because that will set ALL controls of that type. You would need a way to say "For this specific combobox, make it look like this".
This HAs to be possible. They're doing it.
If it's not broken, fix it until it is
|
|
|
|
|
You would define styles which applied to the specific controls. If you didn't want the style to apply to all instances of the same control, you would give it a name.
You would still need to have a reference from the project where the styles were defined to the project / assembly where the controls were defined.
You can't define a style for a control that your project doesn't know about!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If in the User Control library I created a reference to the app, that makes that User Control library bound forever to that one app.
The other way around is how it's used. The app know about the UC library, not the UC library knowing about the app.
The TimePicker has a TextBlock and 3 ComboBoxes. There has to be a way in the form it's on to say "Set the combo boxes to use TimerPickerComboStyle" without the entire UC assembly having a ref to the App project.
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: If in the User Control library I created a reference to the app, that makes that User Control library bound forever to that one app.
I'm not talking about the UC project having a reference to the application. I'm talking about the "shared styles" project having a reference to the UC project.
The "shared styles" project is the one that's defining the styles for the controls in the UC project, so that's the one that needs a reference to the UC project.
Kevin Marois wrote: There has to be a way in the form it's on to say "Set the combo boxes to use TimerPickerComboStyle" ...
You could expose a dependency property typed as Style , and bind that to the child control's Style property in the OnApplyTemplate method.
public static readonly DependencyProperty ComboBoxStyleProperty = DependencyProperty.Register(
"ComboBoxStyle", typeof(Style), typeof(TimePicker));
public Style ComboBoxStyle
{
get { return (Style)GetValue(ComboBoxStyleProperty); }
set { SetValue(ComboBoxStyleProperty, value); }
}
private BindingBase GetTimePickerBinding(DependencyProperty property)
{
return new Binding(property.Name)
{
Source = this
};
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
var comboBox = GetTemplateChild("PART_FirstCombo") as ComboBox;
if (comboBox != null)
{
comboBox.SetBinding(FrameworkElement.StyleProperty,
GetTimePickerBinding(ComboBoxStyleProperty));
}
}
You could then set the combo-box style each time you used the control:
<uc1:TimePicker
ComboBoxStyle="{StaticResource TimePickerComboStyle}"
/>
Or in a global style within the application:
<Style TargetType="{x:Type uc1:TimePicker}">
<Setter Property="ComboBoxStyle" Value="{StaticResource TimePickerComboStyle}" />
</Style>
However, you still wouldn't be able to specify this in a global style from the "shared styles" project unless that project had a reference to the UC project.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Or in a global style within the application:
<Style TargetType="{x:Type uc1:TimePicker}">
<Setter Property="ComboBoxStyle" Value="{StaticResource TimePickerComboStyle}" />
</Style>
Ok, I see where you're going with this....
so the App has a ref to both the shared styles project AND the UC project. Once I drop the control onto a form, I could then use the DP to set its style, assuming TimePickerComboStyle is the shared styles project?
If it's not broken, fix it until it is
|
|
|
|