|
*Edit*
With your Separators wrapped in StatusBarItem, they default to a horizontal orientation, so
you'd need to give your separators a vertically oriented style, otherwise you can't see them...
<StatusBar Grid.Row="1"
DockPanel.Dock="Bottom"
Height="23"
VerticalAlignment="Bottom"
BorderBrush="Black"
BorderThickness="0,.5,0,0" >
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0" >
<TextBlock Text="TextBlock 1" Name="statusBarHelp" />
</StatusBarItem>
<StatusBarItem Grid.Column="1" >
<Separator >
<Separator.Style>
<Style TargetType="{x:Type Separator}">
<Setter Property="Height" Value="20"/>
<Setter Property="Margin" Value="2,0,2,0"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border BorderBrush="LightSlateGray" BorderThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Separator.Style>
</Separator>
</StatusBarItem>
<StatusBarItem Grid.Column="2" HorizontalContentAlignment="Center" >
<TextBlock Text="TextBlock 2" Name="statusBarFullPath" />
</StatusBarItem>
<StatusBarItem Grid.Column="3" >
<Separator >
<Separator.Style>
<Style TargetType="{x:Type Separator}">
<Setter Property="Height" Value="20"/>
<Setter Property="Margin" Value="2,0,2,0"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border BorderBrush="LightSlateGray" BorderThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Separator.Style>
</Separator>
</StatusBarItem>
<StatusBarItem Grid.Column="4" >
<TextBlock Text="TextBlock 3" Name="imageCount" />
</StatusBarItem>
</StatusBar>
In my second reply is a simpler version with the StatusBarItem wrappers removed.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
modified on Sunday, June 21, 2009 5:06 PM
|
|
|
|
|
Shouldn't that style then be a template, so it gets reused ? :P
OK, so a seperator is invisible without a style ? I've never used one, so I had no idea about that.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
|
Christian Graus wrote: Shouldn't that style then be a template, so it gets reused ?
That exercise is left to the reader
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
To use the default Separator style, remove the StatusBarItem
wrappers from the Separators:
<StatusBar Grid.Row="1"
DockPanel.Dock="Bottom"
Height="23"
VerticalAlignment="Bottom"
BorderBrush="Black"
BorderThickness="0,.5,0,0" >
<StatusBar.ItemsPanel>
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Grid.Column="0" >
<TextBlock Text="TextBlock 1" Name="statusBarHelp" />
</StatusBarItem>
<Separator Grid.Column="1" />
<StatusBarItem Grid.Column="2" HorizontalContentAlignment="Center" >
<TextBlock Text="TextBlock 2" Name="statusBarFullPath" />
</StatusBarItem>
<Separator Grid.Column="3" />
<StatusBarItem Grid.Column="4" >
<TextBlock Text="TextBlock 3" Name="imageCount" />
</StatusBarItem>
</StatusBar>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Okay, now we're talking. Good answer. Thanks, Mark. Looks good. I just make them invisible when the middle TextBlock is empty. Sure was a lot of screwing around for a lousy pair of Separator elements.
|
|
|
|
|
Hi,
I am working on a WPF application. In this I need to find the temporary drives created i.e., like drives created when some mobile or pen drive are created. From this Temporary drive created I need to get the image files.
If any one have any idea to get the names or path of the temparory drives created please reply me.
Thanks in advance.
|
|
|
|
|
|
|
Please don't create a new account. You're the only person on EARTH who thinks it's wise to mix a 'browser application' ( i.e. you will put a web browser control in a window ), with a database.
CBenac wrote: Data Source=TOSHIBA_PC\SQLEXPRESS
Is this your local machine ? Have you tried logging in with a username and password ? Have you googled the error message to see possible solutions ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
|
A WPF browser application runs in the browser ? I would assume that the issue is the application being sandboxed then.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I'm sorry if I misunderstood you at first, someone else has been posting about a browser application in WPF, and asking the same thing for days. I am trying to help you here, there's no need to delete your posts, or feel unwelcome. I am sorry for the misunderstanding, I do suspect that you're saying the app is running inside your browser, and that sandboxing is why you can't access a local DB, but you can probably access a network one. Have you had any luck with that avenue ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
There is a sample application that uses the DataGrid (from the WPF Toolkit) and displays the customers table from the NorthWind database. It runs fine if it is created as an EXE which is the original intention of the author. However, since I need the application to run in the browser, I recreate the same project as a XPAP but the browser displays the bellow error message (snipet) from the "More information" link. It appears to be a connection issue with the database. I'm using Windows authentication mode.
>>
..
The action that failed was:
Demand
The type of the first permission that failed was:
System.Data.SqlClient.SqlClientPermission
The first permission that failed was:
<IPermission class="System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
AllowBlankPassword="False">
<add ConnectionString="Data Source=TOSHIBA_PC\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
KeyRestrictions=""
KeyRestrictionBehavior="AllowOnly"/>
</IPermission>
.....
>>
The sample code was retrieved from here:
http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx
|
|
|
|
|
OK - well, if you're in the browser, then I assume you're serving your app over the web. You're going to need a connection string that connects to a remote machine, not one that relies on Windows security, because the browser is sandboxed from the rest of the machine. It's basically the security in the browser that is hitting you. Have you tried using a username/password to connect to the DB ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I changed from Windows to SQL Server authentication and logged as User: sa and the password, but it didn't make any difference. I'll look into this remote machine you mentioned. But any additional sugestion is welcomed. It is surprise to me the few online documentation regarding WPF.
Thanks so far for your input.
|
|
|
|
|
Christian,
I changed the properties of the application to "Full trusted site" and it worked nicely
Thanks for your help
CBenac
|
|
|
|
|
|
You need to remember the size of the image itself, then you need to calculate the size of the canvas and work out a ratio to calculate a pixel position. If the aspect ratio is different, you need to work out if you use the width or the height to calculate position, and if you did any centring of the image, you need to calculate that offset, too.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
|
Welcome to hell. Width is the one you can set, but ActualWidth is the one that contains the width of the control. I believe the idea is, you can set what width you want, but you're not necessarily going to get it. I've had trouble, for example, placing an image in a grid. If they grid has no explicit size, even if it's told to stretch itself, you can put a BitmapImage in the Image, you can even set the Width of the Image, and the Height, but ActualWidth will stay zero.
ActualWidth is the one that you always use to know what the Width is.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
|
Glad to help.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
This shouldn't be a "bumpy ride" if you understand how WPF layout works.
"There is a difference between the properties of Height and Width and
ActualHeight and ActualWidth. For example, the ActualHeight property is
a calculated value based on other height inputs and the layout system.
The value is set by the layout system itself, based on an actual rendering
pass, and may therefore lag slightly behind the set value of properties
such as Height that are the basis of the input change.
Because ActualHeight is a calculated value, you should be aware that
there could be multiple or incremental reported changes to it as a result
of various operations by the layout system. The layout system may be
calculating required measure space for child elements, constraints by
the parent element, and so on."
WPF: The Layout System[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The goal is to remember the position of a GridSplitter from one execution of a window to the next so I can restore the previous position when the window reloads.
For purposes of discussion, assume my GridSplitter is vertical. I remember reading somewhere that to remember the position of the GridSplitter all you have to do is remember the width of the left element and when the window loads, set the element to that width.
However, my SizeChanged event for the left element only happens when the window is first loaded. Dragging the position of the splitter (hence changing the size of the left element - as well as the right element) does not generate any more SizeChanged events for the left element. That seems totally illogical.
Here is something else that seems totally illogical. I also tried getting MouseUp and MouseLeftButtonUp events for both the splitter and the Grid element the splitter is in, and I don't get any of these events either!
What could possibly be going on? The element that is in the left column of the Grid is a TreeView and I haven't even started populating it yet.
|
|
|
|