WPF - Bindable chat view with selectable text












2















WPF - Bindable chat view with selectable text



I want to create a simple text chat app using WPF. And of course user should be able to select and, for example, copy text.
It's very easy to use, for example, ListView with ItemsSource bound to messages. And appearance can be tuned, but the main problem is text selection. It's possible to select text only in one single control (one message).



At the moment i use WebBrowser for showing messages. So i have tons of HTML+JS+CSS. I think i dont even have to say how terrible it is.



Can you please point me to right direction?










share|improve this question























  • Are you looking for a control that gives text selection? Like a RichTextBox? Or do you want an automatic touch message and copy to clipboard? Can you post some of your code?

    – Clayton Harbich
    Nov 14 '18 at 22:30













  • The OP wants to be able to select text from one item control item template, and have the selection span to another item, by dragging the mouse to select like you would in slack, or teams.

    – Michael G
    Nov 14 '18 at 22:31











  • @ClaytonHarbich, i have no code, because i have no idea how to do it. that's why i'm here:) Michael is right - i want a control,with which i will be able to drug mouse over content to select everything i need. like in any other messangers.

    – Sam Sch
    Nov 15 '18 at 6:18
















2















WPF - Bindable chat view with selectable text



I want to create a simple text chat app using WPF. And of course user should be able to select and, for example, copy text.
It's very easy to use, for example, ListView with ItemsSource bound to messages. And appearance can be tuned, but the main problem is text selection. It's possible to select text only in one single control (one message).



At the moment i use WebBrowser for showing messages. So i have tons of HTML+JS+CSS. I think i dont even have to say how terrible it is.



Can you please point me to right direction?










share|improve this question























  • Are you looking for a control that gives text selection? Like a RichTextBox? Or do you want an automatic touch message and copy to clipboard? Can you post some of your code?

    – Clayton Harbich
    Nov 14 '18 at 22:30













  • The OP wants to be able to select text from one item control item template, and have the selection span to another item, by dragging the mouse to select like you would in slack, or teams.

    – Michael G
    Nov 14 '18 at 22:31











  • @ClaytonHarbich, i have no code, because i have no idea how to do it. that's why i'm here:) Michael is right - i want a control,with which i will be able to drug mouse over content to select everything i need. like in any other messangers.

    – Sam Sch
    Nov 15 '18 at 6:18














2












2








2








WPF - Bindable chat view with selectable text



I want to create a simple text chat app using WPF. And of course user should be able to select and, for example, copy text.
It's very easy to use, for example, ListView with ItemsSource bound to messages. And appearance can be tuned, but the main problem is text selection. It's possible to select text only in one single control (one message).



At the moment i use WebBrowser for showing messages. So i have tons of HTML+JS+CSS. I think i dont even have to say how terrible it is.



Can you please point me to right direction?










share|improve this question














WPF - Bindable chat view with selectable text



I want to create a simple text chat app using WPF. And of course user should be able to select and, for example, copy text.
It's very easy to use, for example, ListView with ItemsSource bound to messages. And appearance can be tuned, but the main problem is text selection. It's possible to select text only in one single control (one message).



At the moment i use WebBrowser for showing messages. So i have tons of HTML+JS+CSS. I think i dont even have to say how terrible it is.



Can you please point me to right direction?







c# .net wpf user-interface






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 '18 at 22:10









Sam SchSam Sch

1559




1559













  • Are you looking for a control that gives text selection? Like a RichTextBox? Or do you want an automatic touch message and copy to clipboard? Can you post some of your code?

    – Clayton Harbich
    Nov 14 '18 at 22:30













  • The OP wants to be able to select text from one item control item template, and have the selection span to another item, by dragging the mouse to select like you would in slack, or teams.

    – Michael G
    Nov 14 '18 at 22:31











  • @ClaytonHarbich, i have no code, because i have no idea how to do it. that's why i'm here:) Michael is right - i want a control,with which i will be able to drug mouse over content to select everything i need. like in any other messangers.

    – Sam Sch
    Nov 15 '18 at 6:18



















  • Are you looking for a control that gives text selection? Like a RichTextBox? Or do you want an automatic touch message and copy to clipboard? Can you post some of your code?

    – Clayton Harbich
    Nov 14 '18 at 22:30













  • The OP wants to be able to select text from one item control item template, and have the selection span to another item, by dragging the mouse to select like you would in slack, or teams.

    – Michael G
    Nov 14 '18 at 22:31











  • @ClaytonHarbich, i have no code, because i have no idea how to do it. that's why i'm here:) Michael is right - i want a control,with which i will be able to drug mouse over content to select everything i need. like in any other messangers.

    – Sam Sch
    Nov 15 '18 at 6:18

















Are you looking for a control that gives text selection? Like a RichTextBox? Or do you want an automatic touch message and copy to clipboard? Can you post some of your code?

– Clayton Harbich
Nov 14 '18 at 22:30







Are you looking for a control that gives text selection? Like a RichTextBox? Or do you want an automatic touch message and copy to clipboard? Can you post some of your code?

– Clayton Harbich
Nov 14 '18 at 22:30















The OP wants to be able to select text from one item control item template, and have the selection span to another item, by dragging the mouse to select like you would in slack, or teams.

– Michael G
Nov 14 '18 at 22:31





The OP wants to be able to select text from one item control item template, and have the selection span to another item, by dragging the mouse to select like you would in slack, or teams.

– Michael G
Nov 14 '18 at 22:31













@ClaytonHarbich, i have no code, because i have no idea how to do it. that's why i'm here:) Michael is right - i want a control,with which i will be able to drug mouse over content to select everything i need. like in any other messangers.

– Sam Sch
Nov 15 '18 at 6:18





@ClaytonHarbich, i have no code, because i have no idea how to do it. that's why i'm here:) Michael is right - i want a control,with which i will be able to drug mouse over content to select everything i need. like in any other messangers.

– Sam Sch
Nov 15 '18 at 6:18












1 Answer
1






active

oldest

votes


















0














A textbox should give you what you are looking for I think. You will need to do the styling so it looks like you want but here is code:
XAML:



<TextBox Text="{Binding AllMessages}"/>


ViewModel:



    public IEnumerable<string> Messages { get; set; }

public string AllMessages => GetAllMessages();

private string GetAllMessages()
{
var builder = new StringBuilder();
foreach (var message in Messages)
{
//Add in whatever for context
builder.AppendLine(message);
}
return builder.ToString();
}


You will probably want to use a RichTextBox for better formatting.






share|improve this answer


























  • please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

    – Sam Sch
    Nov 15 '18 at 17:17











  • Updated answer.

    – Clayton Harbich
    Nov 15 '18 at 22:56











  • thanks for your time, but this is extremely dirty solution for many reasons.

    – Sam Sch
    Nov 16 '18 at 9:14













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309494%2fwpf-bindable-chat-view-with-selectable-text%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














A textbox should give you what you are looking for I think. You will need to do the styling so it looks like you want but here is code:
XAML:



<TextBox Text="{Binding AllMessages}"/>


ViewModel:



    public IEnumerable<string> Messages { get; set; }

public string AllMessages => GetAllMessages();

private string GetAllMessages()
{
var builder = new StringBuilder();
foreach (var message in Messages)
{
//Add in whatever for context
builder.AppendLine(message);
}
return builder.ToString();
}


You will probably want to use a RichTextBox for better formatting.






share|improve this answer


























  • please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

    – Sam Sch
    Nov 15 '18 at 17:17











  • Updated answer.

    – Clayton Harbich
    Nov 15 '18 at 22:56











  • thanks for your time, but this is extremely dirty solution for many reasons.

    – Sam Sch
    Nov 16 '18 at 9:14


















0














A textbox should give you what you are looking for I think. You will need to do the styling so it looks like you want but here is code:
XAML:



<TextBox Text="{Binding AllMessages}"/>


ViewModel:



    public IEnumerable<string> Messages { get; set; }

public string AllMessages => GetAllMessages();

private string GetAllMessages()
{
var builder = new StringBuilder();
foreach (var message in Messages)
{
//Add in whatever for context
builder.AppendLine(message);
}
return builder.ToString();
}


You will probably want to use a RichTextBox for better formatting.






share|improve this answer


























  • please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

    – Sam Sch
    Nov 15 '18 at 17:17











  • Updated answer.

    – Clayton Harbich
    Nov 15 '18 at 22:56











  • thanks for your time, but this is extremely dirty solution for many reasons.

    – Sam Sch
    Nov 16 '18 at 9:14
















0












0








0







A textbox should give you what you are looking for I think. You will need to do the styling so it looks like you want but here is code:
XAML:



<TextBox Text="{Binding AllMessages}"/>


ViewModel:



    public IEnumerable<string> Messages { get; set; }

public string AllMessages => GetAllMessages();

private string GetAllMessages()
{
var builder = new StringBuilder();
foreach (var message in Messages)
{
//Add in whatever for context
builder.AppendLine(message);
}
return builder.ToString();
}


You will probably want to use a RichTextBox for better formatting.






share|improve this answer















A textbox should give you what you are looking for I think. You will need to do the styling so it looks like you want but here is code:
XAML:



<TextBox Text="{Binding AllMessages}"/>


ViewModel:



    public IEnumerable<string> Messages { get; set; }

public string AllMessages => GetAllMessages();

private string GetAllMessages()
{
var builder = new StringBuilder();
foreach (var message in Messages)
{
//Add in whatever for context
builder.AppendLine(message);
}
return builder.ToString();
}


You will probably want to use a RichTextBox for better formatting.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 21:30

























answered Nov 15 '18 at 17:09









Clayton HarbichClayton Harbich

272513




272513













  • please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

    – Sam Sch
    Nov 15 '18 at 17:17











  • Updated answer.

    – Clayton Harbich
    Nov 15 '18 at 22:56











  • thanks for your time, but this is extremely dirty solution for many reasons.

    – Sam Sch
    Nov 16 '18 at 9:14





















  • please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

    – Sam Sch
    Nov 15 '18 at 17:17











  • Updated answer.

    – Clayton Harbich
    Nov 15 '18 at 22:56











  • thanks for your time, but this is extremely dirty solution for many reasons.

    – Sam Sch
    Nov 16 '18 at 9:14



















please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

– Sam Sch
Nov 15 '18 at 17:17





please read my question carefully. ListView does not work. in this case i able to select only one message. i cant press mouse button and drug it over all messages to select them all. i described it in my question.

– Sam Sch
Nov 15 '18 at 17:17













Updated answer.

– Clayton Harbich
Nov 15 '18 at 22:56





Updated answer.

– Clayton Harbich
Nov 15 '18 at 22:56













thanks for your time, but this is extremely dirty solution for many reasons.

– Sam Sch
Nov 16 '18 at 9:14







thanks for your time, but this is extremely dirty solution for many reasons.

– Sam Sch
Nov 16 '18 at 9:14






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309494%2fwpf-bindable-chat-view-with-selectable-text%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine