Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

How to insert Ink Canvas Data in SQLite Database using WPF

$
0
0

Hi All

I've never used InkCanvas control before. What I need is how can I  insert or save the content or text written on InkCanvas into SQLite Database at runtime using WPF C#

Plz guide me how can I achieve this

Regards


how can i select all items checked in checklistbox when an item name selectall checked

$
0
0

iam using wpf form ...........

i have an extended control checklistbox .i added values to checklistbox programically

my requirement is :-i added first item is name ="Select All"

if i click select all i want to check all item checked true and opposite also

but i couldnot get item checked event in this control

if any body can solve ? is there is any way to get .

please help me..............................

thanks

sorry for bad english

CollectionViewSource.Filter not working

$
0
0

Hi,

When I try this, the observable collection is not filtered.

		CollectionViewSource myCollectionView = new CollectionViewSource();
		myCollectionView.Source = myObservableCollection;
		myCollectionView.Filter += myCollectionView_Filter;
		cbxNrc.ItemsSource = myCollectionView.View;

        void myCollectionView_Filter(object sender, FilterEventArgs e)
        {
            e.Accepted = (e.Item as MyObject).IsShown == true;
        }

But when I try it as follows, the filtering works okay:

		CollectionViewSource myCollectionView = new CollectionViewSource();
		myCollectionView.Source = myObservableCollection;
		myCollectionView.View.Filter = o => (o as MyObject).IsShown == true;
		cbxNrc.ItemsSource = myCollectionView.View;

Shouldn't these two pieces of code be equivalent? Why is the former not working?

Thanks,

Tom


luck favours the prepared

Is WPF the worst mistake in development technology Microsoft has ever made? Is WCF the best development technology Microsoft has ever made?

$
0
0

·        Clearly, my point of view is yes on both counts.

WPF is the worst, largest scale mistake in development technology Microsoft has ever made

WCF is the best development technology Microsoft has ever made

I believe that WPF shows a lack of integrity as it is a waste of time, money and effort for the development community and technology consumers world wide.  My reasoning is that Microsoft owns the desktop development platform there is no reason for a regression to a mark up language when the WYSIWYG forms platform was high productivity technology.  Mark up language development from Microsoft should have been left in the Web domain.  I personally have worked for 10 years on very large web sites hand coding mark up language - there was no need for this regression back to almost Mainframe like coding tools on the desktop platform which Microsoft owns.

I believe that this move was regressive, not in the best interests of Microsoft, nor the Microsoft developer community and certainly WPF was not a technology decision of integrity and has not brought productivity improvements for clients.

I would like to start a discussion on this and put it out there in the public domain for sensible and mature consideration by experienced developers with preferably 15+ years experience across multiple platforms and technologies.  My personal experience is 20 years starting on Unix C, then VB, Sybase, MSQL, Unix, ASP, ASP.NET, VB.NET, C#, Java, Winforms, WPF, AJAX, MTS, COM, DCOM, Web Services, WCF, SharePoint, BizTalk, Dynamics, MSCRM....

 

How do I eliminate the space placed between paragraphs in a RichTextBox?

$
0
0
How do I eliminate the space placed between paragraphs in a RichTextBox?

gobjParagaph.Inlines.Add(new Run(st));
gobjFlowDoc.Blocks.Add(gobjParagaph);
gRTbx.Document = gobjFlowDoc;

After displaying information in a RichTextBox programmatically, the customer edits the information. However, when the customer hits "Enter" button, the cursor jumps down two spaces.


bhs67

Two listbox scrollbar in synchronisation

$
0
0
Hi i have one issue in my application.

I have two listbox with two different listboxitemstyle that has same height, And those two listboxes also having same height.

what i want to do is whenever i do scrolling in one listbox, that time i want other listbox to scroll the same amount of scrolling.
i tried this way....

(lstBox1.Template.FindName("scrollViewer", lstBox1) as ScrollViewer).ScrollToVerticalOffset(e.VerticalOffset);
here whenever lstbox2 ScrollViewer.ScrollChanged event is firee, that time i m changing scrolloffset of first listbox, and the same thing i m doing with second listbox also.

But the problem is scrolloffset is not working precisely, means for one listbox if i m scrolling two listboxitem, then for second listbox also it should be scrolled 2 listboxitems as listboxitem and listbox height is same, but it is not happening and only 0.5 or 1 listboxitem is scrolled.

Moreover, these two listbox having same collection of data and isSynchronizedwithcurrentitem is set to true for both, so when i select any item in one listbox, then if i keep changing selected item in that listbox, so in other listbox the same item gets selected, but if suppose that item is not in view to user, then even though in first listbox that item is in viewsight of user, the same indexed item in second listbox is not.

Is this is the right way to make sure that two listbox scrolling (and whenever first listbox item scrolls into view while selection changing then the same indexed item in second listbox also should scroll into view) is in Synch, or any other better way is there to accomplish this.

if this way it is ok , then why it is not behaving the way i want.

How do i get the selected item in a listview when its datatemplate contains 2 elements, one being a webview?

$
0
0
<ListView x:Name="BrowserListview" ItemsSource="{Binding browserCollection}"><ListView.ItemTemplate><DataTemplate><VirtualizingStackPanel Orientation="Horizontal"><awe:WebControl Source="{Binding mySource}"/><Rectangle/></VirtualizingStackPanel></DataTemplate></ListView.ItemTemplate></ListView>
As you can see, my datatemplate has a WebControl and a Rectangle. When the webcontrol is clicked, it has focus instead of the listview, and therefore the IsSelected property of the browserCollection item does not get changed because the notification does not bubble up from the control to the listview. I want to be able to handle the SelectionChanged event of the listview's items. Anyone have any suggestions?

WPF: how to make the grid column edtiable base on cell content?

$
0
0

our WPF application uses DataGrid.

One grid column we need base on cell has value or not to decide if make the cell editable.

If cell is empty, not editable. If cell is not empty, make it editable.

The cell is bind to a class. We try to make property to bind to the

DataGridTextColumn

IsReadOnly property

public bool IsSampleIdFieldReadOnly { get { return string.IsNullOrEmpty(_sampleId); } }

DataGridTextColumn MinWidth="120"
    Binding="{Binding SampleId}"
    IsReadOnly="{Binding IsSampleIdFieldReadOnly}"
    Header="Sample ID" />

However all cells in the column are editable.

how to achieve that? Thx!


JaneC





How do I select the entire text when the focus is moved to one TextBox?

$
0
0

How do I select the entire text when the focus is moved to one TextBox?

There are three TextBoxes.  I use <TextBox TabIndex="1"/> to set the order they are selected.  When I enter one specific TextBox, I would like to have the entire text selected ... one key stroke removes all of the text in that TextBox.


bhs67

WPF: why does DataGridComboBoxColumn not show initial value?

$
0
0

We use WPF DataGrid. One of columns is combobox. Combo box values are dynamically change base on other cell value.

We have implement following, however. It does not show the initial value in the ComBo Box cell.

If selecting from the dropdown list, selected value will display.

 public SampleType SelectedSampleType {get; set;}

 public class SampleType
    {
        public SampleType(string name, EnumSampleType type)
        {
            Name = name;
            Type = type;
        }

        public string Name          { get; set;}
        public EnumSampleType Type  { get; set;}

        public override string ToString()
        {
            return Name;
        }
    }
<DataGridComboBoxColumn MinWidth="160"
     Header= "SampleType"
     SelectedItemBinding="{Binding SelectedSampleType}"><DataGridComboBoxColumn.ElementStyle><Style TargetType="ComboBox"><Setter Property="ItemsSource" Value="{Binding SampleTypes}"/></Style></DataGridComboBoxColumn.ElementStyle><DataGridComboBoxColumn.EditingElementStyle><Style TargetType="ComboBox"><Setter Property="ItemsSource" Value="{Binding SampleTypes}"/></Style></DataGridComboBoxColumn.EditingElementStyle></DataGridComboBoxColumn>

Note: the SelectedSampleType  is object (class). It will get default values such as

SelectedSampleType = new SampleType("xxx", EnumSampleType.xxx);

However, we do not see the intial value "xxx" show on the cell. If we select "xxx" from the drop down box, "xxx" will display in the cell of Combo Box.

Does anyone know what is reason? Thx!


JaneC



How to disable hittesting for a DrawingVisual?

$
0
0

Hello all,

I'm trying to optimize my rendering code a little and thought that disabling hittesting of my many DrawingVisuals might help. Surprisingly I don't see anything in the documentation about a "IsHitTestVisible" property (or something of the sort) for the DrawingVisual class. Is this possible? Thanks in advance.

-L

How to implement Lync or Skype in a WPF application

$
0
0

Dear all,

We need to build a WPF application in which we need to implement a remote assistance help deks.

The idea is that we need Inside the application to be apple to place a phone call to Lync or Skype to a remote help desk assistant.

Then when connected, we have a live video view of the help desk person where the user can request help from and in addition the remote help person could take control to the application and show user what to do.

Does anyone have any idea how to integrate such feature and which to use Lync, or Skype ?

regards

WPF WebBrowser Control Navigate to File containing XML but With Different File Extension

$
0
0

I'm writing a WPF application to look at XML files and validate them against Schema files.

In the prior WinForms version, I would set the URL property of the WebBrowser control to the path of the file I wanted to open.  Regardless of the file extension, it contains pure XML.  This worked just fine.

In WPF, the WebBrowser control doesn't have a URL property, so I need to use the NavigateTo() method.  If I put in the full name of an XML file, (ie: C:\Folder\file.xml), all works fine.  If I put the full name with a different extension (ie: C:\Folder\file.crd), instead of opening in the WebBrowser control, it tries to open the file in the default application for that extension.

Since I know the file will contain well-formed XML regardless of the extension, is there any way to defeat the default behavior and simply open the file in the WebBrowser control?  If it's not well-formed xml, no problem, I can handle the exception thrown.

Thanks...


Ron Mittelman

TranslateZoomRotateBehavior on ItemTemplate in ItemsControl Causes shaky dragging with touch

$
0
0

The TranslateZoomRotateBehavior works fine with touch in these circumstances:

  1. When put on an element that is a child of a Grid
  2. When put in the Items of an ItemsControl

But when the behavior is put in the data template of an ItemsControl.ItemTemplate and the control is data bound to a collection, touching to translate, rotate, or scale the item causes very bad shaky interaction while dragging.  The shakiness is not seen when using mouse, just touch.

Here is a WPF window with a simple sample data source that reproduces the problem.

Any suggestions?

Thanks,

Michael

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Class="DragTest.MainWindow"
        Title="MainWindow" Height="350" Width="525"><Window.Resources><DataTemplate x:Key="DataTemplate1"><Grid Background="#FFE01E1E" Width="100" Height="100"><i:Interaction.Behaviors><ei:TranslateZoomRotateBehavior RotationalFriction="1" TranslateFriction="1"/></i:Interaction.Behaviors><TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Property1}" VerticalAlignment="Top"/></Grid></DataTemplate><ItemsPanelTemplate x:Key="ItemsPanelTemplate1"><Canvas Background="Green" /></ItemsPanelTemplate></Window.Resources><Grid DataContext="{Binding Source={StaticResource SampleDataSource}}"><ItemsControl ItemTemplate="{DynamicResource DataTemplate1}" ItemsSource="{Binding Collection}" ItemsPanel="{DynamicResource ItemsPanelTemplate1}" ScrollViewer.VerticalScrollBarVisibility="Disabled"/></Grid></Window>


<p>Michael S. Scherotter<br/> Media Experience Evangelist, Microsoft Corporation<br/> <a href="http://blogs.msdn.com/synergist">Blog</a>, <a href="http://twitter.com/synergist"> Twitter</a>, <a href="http://facebook.com/synergist">Facebook</a> </p>

Extension method break down the string format.

$
0
0

Hi

If I hard code it works just fine, if not it doesn't work. Why?

Public Sub CreateSimpleTextColumn(objectToCopy As ObservableCollection(Of DataGridColumn), headerString As String, boundProperty As String, Optional isVisible As Boolean = True, Optional stingFormat As String = "") Dim dataGridTextColumn As New DataGridTextColumn() dataGridTextColumn.Header = headerString dataGridTextColumn.Visibility = If(isVisible = True, Visibility.Visible, Visibility.Collapsed) Dim bindingElement = New Binding(boundProperty)

' Working 'bindingElement.StringFormat = "{0:MM/dd/yyyy}"

'doesn't work bindingElement.StringFormat = stingFormat

dataGridTextColumn.Binding = bindingElement objectToCopy.Add(dataGridTextColumn) End Sub



WebBrowser script error when using google maps

$
0
0

Can't find anything related to this, so there is my entry on this.

Until a few weeks my app would work perfectly with webbrowser control and google maps(With this i mean, my app would show the route between 2 points on a webbrowser control). This week on monday i got a call from a customer complaining about a script error on my app, and that they couldnt see the google maps anymore, and indeed there is a problem, whenever i try to call the webbrowser from code i got a script error window with the information:

Error: InvalidCharachterError

Like i said this have been working so far until this week. I havent found anything on this problem.

Im using wpf with vb.net and on my usercontrol code i have:

Dim URLExample As String = "http://maps.google.nl/maps?f=d&hl=nl&geocode=&saddr=Lijnbaan+3d,+3252CK+Leiderdorp&daddr=3064+HW+Vleutenseweg+386-,+Utrecht&dirflg=h"       

web_view.Navigate(New Uri(URLExample ))

that url is just an example. The same url works on both google chrome and Internet explorer without any error, only when is used from the webbrowser control.

Things i have done:

Hide script errors with supress

add maps.google to trusted web sites

enable scripts on browser

change uri function to anotherURI("transparent", url) that i found on this forum(didnt work)

Thanks for reading and i hope you can help me.

Sorry if i sounded rude but i really dont meant to.

EDIT: even by going to https://maps.google.com i got the script error.

Regards,

Rui Nunes




How do I center multiple lines (each line) on a button?

$
0
0

How do I center multiple lines (each line) on a button?

    <Button Content="X" HorizontalContentAlignment="Center" Margin="10, 10, 10, 0" x:Name="gBuRegistrationMsg"/>

    gBuRegistrationMsg.Content = "MemoPad has been registered by\n";
    gBuRegistrationMsg.Content += "Someone\n";
    gBuRegistrationMsg.Content += "To register your own copy, select Help (menu) => Register";

The HorizontalContentAlignment centers everything, not each line. 


bhs67

'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute sp

$
0
0

 

Error : 'ResourceDictionary' root element is a generic type and requires a x:Class attribute to support the x:TypeArguments attribute specified on the root element tag.

 

Hi,

 

I get this error when i include some namespaces in my ResourceDictionary to specify a Style for a custom control.
Can anyone help me?

 

Thx

Stardusty

ToolBar

$
0
0
<ToolBar Grid.Row="0" ToolBarTray.IsLocked="True">

How do I hide the toolbar in this part ?

Thanks;

How do I make a text box flash

$
0
0
I want a text box to flash slowly. The idea I have is that it slowly fades away then slowly fades back but not too slow just enough to draw attention to it.
Viewing all 18858 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>